410 lines
12 KiB
Plaintext
410 lines
12 KiB
Plaintext
|
[
|
||
|
{
|
||
|
"name": "IE_Comments",
|
||
|
"input": "<!--[if gte IE 4]><script>alert('XSS');</script><![endif]-->",
|
||
|
"output": ""
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "IE_Comments_2",
|
||
|
"input": "<![if !IE 5]><script>alert('XSS');</script><![endif]>",
|
||
|
"output": "<script>alert('XSS');</script>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "allow_colons_in_path_component",
|
||
|
"input": "<a href=\"./this:that\">foo</a>",
|
||
|
"output": "<a href='./this:that'>foo</a>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "background_attribute",
|
||
|
"input": "<div background=\"javascript:alert('XSS')\"></div>",
|
||
|
"output": "<div/>",
|
||
|
"xhtml": "<div></div>",
|
||
|
"rexml": "<div></div>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "bgsound",
|
||
|
"input": "<bgsound src=\"javascript:alert('XSS');\" />",
|
||
|
"output": "<bgsound src=\"javascript:alert('XSS');\"/>",
|
||
|
"rexml": "<bgsound src=\"javascript:alert('XSS');\"></bgsound>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "div_background_image_unicode_encoded",
|
||
|
"input": "<div style=\"background-image:\a5\a2\006C\0028'\006a\0061\a6\0061\a3\0063\a2\0069\a0\a4\003a\0061\006c\0065\a2\a4\0028.1027\0058.1053\0053\0027\0029'\0029\">foo</div>",
|
||
|
"output": "<div style=''>foo</div>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "div_expression",
|
||
|
"input": "<div style=\"width: expression(alert('XSS'));\">foo</div>",
|
||
|
"output": "<div style=''>foo</div>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "double_open_angle_brackets",
|
||
|
"input": "<img src=http://ha.ckers.org/scriptlet.html <",
|
||
|
"output": "<img src='http://ha.ckers.org/scriptlet.html'/><",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "double_open_angle_brackets_2",
|
||
|
"input": "<script src=http://ha.ckers.org/scriptlet.html <",
|
||
|
"output": "<script src=\"http://ha.ckers.org/scriptlet.html\"><",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "grave_accents",
|
||
|
"input": "<img src=`javascript:alert('XSS')` />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "img_dynsrc_lowsrc",
|
||
|
"input": "<img dynsrc=\"javascript:alert('XSS')\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "img_vbscript",
|
||
|
"input": "<img src='vbscript:msgbox(\"XSS\")' />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "input_image",
|
||
|
"input": "<input type=\"image\" src=\"javascript:alert('XSS');\" />",
|
||
|
"output": "<input type='image'/>",
|
||
|
"rexml": "<input type='image' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "link_stylesheets",
|
||
|
"input": "<link rel=\"stylesheet\" href=\"javascript:alert('XSS');\" />",
|
||
|
"output": "<link rel=\"stylesheet\" href=\"javascript:alert('XSS');\"/>",
|
||
|
"rexml": "<link href=\"javascript:alert('XSS');\" rel=\"stylesheet\"/>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "link_stylesheets_2",
|
||
|
"input": "<link rel=\"stylesheet\" href=\"http://ha.ckers.org/xss.css\" />",
|
||
|
"output": "<link rel=\"stylesheet\" href=\"http://ha.ckers.org/xss.css\"/>",
|
||
|
"rexml": "<link href=\"http://ha.ckers.org/xss.css\" rel=\"stylesheet\"/>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "list_style_image",
|
||
|
"input": "<li style=\"list-style-image: url(javascript:alert('XSS'))\">foo</li>",
|
||
|
"output": "<li style=''>foo</li>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "no_closing_script_tags",
|
||
|
"input": "<script src=http://ha.ckers.org/xss.js?<b>",
|
||
|
"output": "<script src=\"http://ha.ckers.org/xss.js?\"><b/>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "non_alpha_non_digit",
|
||
|
"input": "<script/XSS src=\"http://ha.ckers.org/xss.js\"></script>",
|
||
|
"output": "<script XSS=\"\" src=\"http://ha.ckers.org/xss.js\"></script>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "non_alpha_non_digit_2",
|
||
|
"input": "<a onclick!\#$%&()*~+-_.,:;?@[/|\\]^`=alert(\"XSS\")>foo</a>",
|
||
|
"output": "<a>foo</a>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "non_alpha_non_digit_3",
|
||
|
"input": "<img/src=\"http://ha.ckers.org/xss.js\"/>",
|
||
|
"output": "<img src='http://ha.ckers.org/xss.js'/>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "non_alpha_non_digit_II",
|
||
|
"input": "<a href!\#$%&()*~+-_.,:;?@[/|]^`=alert('XSS')>foo</a>",
|
||
|
"output": "<a>foo</a>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "non_alpha_non_digit_III",
|
||
|
"input": "<a/href=\"javascript:alert('XSS');\">foo</a>",
|
||
|
"output": "<a>foo</a>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "platypus",
|
||
|
"input": "<a href=\"http://www.ragingplatypus.com/\" style=\"display:block; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1; background-color:black; background-image:url(http://www.ragingplatypus.com/i/cam-full.jpg); background-x:center; background-y:center; background-repeat:repeat;\">never trust your upstream platypus</a>",
|
||
|
"output": "<a href='http://www.ragingplatypus.com/' style='display: block; width: 100%; height: 100%; background-color: black; background-x: center; background-y: center;'>never trust your upstream platypus</a>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "protocol_resolution_in_script_tag",
|
||
|
"input": "<script src=//ha.ckers.org/.j></script>",
|
||
|
"output": "<script src=\"//ha.ckers.org/.j\"></script>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_allow_anchors",
|
||
|
"input": "<a href='foo' onclick='bar'><script>baz</script></a>",
|
||
|
"output": "<a href='foo'><script>baz</script></a>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_allow_image_alt_attribute",
|
||
|
"input": "<img alt='foo' onclick='bar' />",
|
||
|
"output": "<img alt='foo'/>",
|
||
|
"rexml": "<img alt='foo' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_allow_image_height_attribute",
|
||
|
"input": "<img height='foo' onclick='bar' />",
|
||
|
"output": "<img height='foo'/>",
|
||
|
"rexml": "<img height='foo' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_allow_image_src_attribute",
|
||
|
"input": "<img src='foo' onclick='bar' />",
|
||
|
"output": "<img src='foo'/>",
|
||
|
"rexml": "<img src='foo' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_allow_image_width_attribute",
|
||
|
"input": "<img width='foo' onclick='bar' />",
|
||
|
"output": "<img width='foo'/>",
|
||
|
"rexml": "<img width='foo' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_handle_blank_text",
|
||
|
"input": "",
|
||
|
"output": ""
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_handle_malformed_image_tags",
|
||
|
"input": "<img \"\"\"><script>alert(\"XSS\")</script>\">",
|
||
|
"output": "<img/><script>alert(\"XSS\")</script>\">",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_handle_non_html",
|
||
|
"input": "abc",
|
||
|
"output": "abc"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_ridiculous_hack",
|
||
|
"input": "<img\nsrc\n=\n\"\nj\na\nv\na\ns\nc\nr\ni\np\nt\n:\na\nl\ne\nr\nt\n(\n'\nX\nS\nS\n'\n)\n\"\n />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_0",
|
||
|
"input": "<img src=\"javascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_1",
|
||
|
"input": "<img src=javascript:alert('XSS') />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_10",
|
||
|
"input": "<img src=\"jav
ascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_11",
|
||
|
"input": "<img src=\"jav
ascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_12",
|
||
|
"input": "<img src=\"  javascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_13",
|
||
|
"input": "<img src=\" javascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_14",
|
||
|
"input": "<img src=\" javascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_2",
|
||
|
"input": "<img src=\"JaVaScRiPt:alert('XSS')\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_3",
|
||
|
"input": "<img src='javascript:alert("XSS")' />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_4",
|
||
|
"input": "<img src='javascript:alert(String.fromCharCode(88,83,83))' />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_5",
|
||
|
"input": "<img src='javascript:alert('XSS')' />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_6",
|
||
|
"input": "<img src='javascript:alert('XSS')' />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_7",
|
||
|
"input": "<img src='javascript:alert('XSS')' />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_8",
|
||
|
"input": "<img src=\"jav\tascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_not_fall_for_xss_image_hack_9",
|
||
|
"input": "<img src=\"jav	ascript:alert('XSS');\" />",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "<img />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_sanitize_half_open_scripts",
|
||
|
"input": "<img src=\"javascript:alert('XSS')\"",
|
||
|
"output": "<img/>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_sanitize_invalid_script_tag",
|
||
|
"input": "<script/XSS SRC=\"http://ha.ckers.org/xss.js\"></script>",
|
||
|
"output": "<script XSS=\"\" SRC=\"http://ha.ckers.org/xss.js\"></script>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_sanitize_script_tag_with_multiple_open_brackets",
|
||
|
"input": "<<script>alert(\"XSS\");//<</script>",
|
||
|
"output": "<<script>alert(\"XSS\");//<</script>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_sanitize_script_tag_with_multiple_open_brackets_2",
|
||
|
"input": "<iframe src=http://ha.ckers.org/scriptlet.html\n<",
|
||
|
"output": "<iframe src=\"http://ha.ckers.org/scriptlet.html\"><",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_sanitize_tag_broken_up_by_null",
|
||
|
"input": "<scr\u0000ipt>alert(\"XSS\")</scr\u0000ipt>",
|
||
|
"output": "<scr\ufffdipt>alert(\"XSS\")</scr\ufffdipt>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_sanitize_unclosed_script",
|
||
|
"input": "<script src=http://ha.ckers.org/xss.js?<b>",
|
||
|
"output": "<script src=\"http://ha.ckers.org/xss.js?\"><b/>",
|
||
|
"rexml": "Ill-formed XHTML!"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_strip_href_attribute_in_a_with_bad_protocols",
|
||
|
"input": "<a href=\"javascript:XSS\" title=\"1\">boo</a>",
|
||
|
"output": "<a title='1'>boo</a>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_strip_href_attribute_in_a_with_bad_protocols_and_whitespace",
|
||
|
"input": "<a href=\" javascript:XSS\" title=\"1\">boo</a>",
|
||
|
"output": "<a title='1'>boo</a>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_strip_src_attribute_in_img_with_bad_protocols",
|
||
|
"input": "<img src=\"javascript:XSS\" title=\"1\">boo</img>",
|
||
|
"output": "<img title='1'/>boo",
|
||
|
"rexml": "<img title='1' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "should_strip_src_attribute_in_img_with_bad_protocols_and_whitespace",
|
||
|
"input": "<img src=\" javascript:XSS\" title=\"1\">boo</img>",
|
||
|
"output": "<img title='1'/>boo",
|
||
|
"rexml": "<img title='1' />"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "xml_base",
|
||
|
"input": "<div xml:base=\"javascript:alert('XSS');//\">foo</div>",
|
||
|
"output": "<div>foo</div>"
|
||
|
},
|
||
|
|
||
|
{
|
||
|
"name": "xul",
|
||
|
"input": "<p style=\"-moz-binding:url('http://ha.ckers.org/xssmoz.xml#xss')\">fubar</p>",
|
||
|
"output": "<p style=''>fubar</p>"
|
||
|
}
|
||
|
]
|