From af0de616ae1b4cade8cb4bfa43fc71e75d383562 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 17 Aug 2006 23:36:35 +0000 Subject: [PATCH] Add a variableWidthAttack smoketest, and add analysis to some smoketests. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@294 48356398-32a2-884e-a903-53898d9a118a --- smoketests/utf8.php | 12 +++++- smoketests/variableWidthAttack.php | 62 ++++++++++++++++++++++++++++++ smoketests/xssAttacks.php | 13 +++++-- 3 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 smoketests/variableWidthAttack.php diff --git a/smoketests/utf8.php b/smoketests/utf8.php index 1b43f368..09b3d7af 100644 --- a/smoketests/utf8.php +++ b/smoketests/utf8.php @@ -1,4 +1,9 @@ - @@ -27,5 +32,10 @@ $string = '

Purified

purify($string); ?> +

Analysis

+

The content in Raw should be equivalent to the content +in Purified. If Purified is mangled, there +is likely trouble a-brewing in the library. If +both are mangled, check to see that this file was not corrupted.

\ No newline at end of file diff --git a/smoketests/variableWidthAttack.php b/smoketests/variableWidthAttack.php new file mode 100644 index 00000000..c9bbcb1e --- /dev/null +++ b/smoketests/variableWidthAttack.php @@ -0,0 +1,62 @@ + + + +HTMLPurifier Variable Width Attack Smoketest + + + +

HTMLPurifier Variable Width Attack Smoketest

+

For more information, see +Cheng Peng Su's +original advisory. This particular exploit code appears only to work +in Internet Explorer, if it works at all.

+

Test

+ + + + +A"'; // in our out the attribute? ;-) + $html .= "onerror=alert('$i')>O"; + $pure_html = $purifier->purify($html); +?> + + + + + + + + +
ASCIIRawOutputRender
+ +

Analysis

+ +

This test currently passes the XSS aspect but fails the validation aspect +due to generalized encoding issues. An augmented UTF-8 smoketest is +pending, until then, consider this a pass.

+ + + \ No newline at end of file diff --git a/smoketests/xssAttacks.php b/smoketests/xssAttacks.php index 5b0e2605..bd6800a6 100644 --- a/smoketests/xssAttacks.php +++ b/smoketests/xssAttacks.php @@ -1,10 +1,14 @@ - -HTMLPurifier XSS Attacks Smoketest - + HTMLPurifier XSS Attacks Smoketest +

HTMLPurifier XSS Attacks Smoketest

@@ -13,6 +17,8 @@

The last segment of tests regarding blacklisted websites is not applicable at the moment, but when we add that functionality they'll be relevant.

+

Most of the XSS broadcasts its presence by spawning an alert dialogue.

+

Test

Requires PHP 5.

'); @@ -24,6 +30,7 @@ $xml = simplexml_load_file('xssAttacks.xml'); $purifier = new HTMLPurifier(); ?> +
NameRawOutputRender