{"id":641,"date":"2012-09-17T10:00:04","date_gmt":"2012-09-17T08:00:04","guid":{"rendered":"https:\/\/d-mueller.de\/blog\/?p=641"},"modified":"2012-09-24T11:19:17","modified_gmt":"2012-09-24T09:19:17","slug":"ie-und-chrome-mit-standard-xss-filter-x-xss-protection","status":"publish","type":"post","link":"https:\/\/d-mueller.de\/blog\/ie-und-chrome-mit-standard-xss-filter-x-xss-protection\/","title":{"rendered":"IE und Chrome mit Standard-XSS-Filter (X-XSS-Protection)"},"content":{"rendered":"<p>Ich war gerade sehr \u00fcberrascht, als ich im Zuge des Herumexperimentierens mit der <a href=\"http:\/\/de.wikipedia.org\/wiki\/Content_Security_Policy\">Content Security Policy<\/a> (kommt auch bald noch ein Artikel dazu &#8211; <b>Update:<\/b> <a href=\"https:\/\/d-mueller.de\/blog\/content-security-policy-tutorial\/\">Content Security Policy \u2013 Tutorial<\/a>) folgendes Standard-Beispiel aufgebaut habe &#8230;<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">\r\n&lt;input type=&quot;text&quot; value=&quot;&lt;?php echo $_GET[&#039;value&#039;]; ?&gt;&quot; \/&gt;\r\n<\/pre>\n<p>&#8230; und dann das Standard-XSS-Pattern <i>?value=&#8220;&gt;&lt;script&gt;alert(1234)&lt;\/script&gt;<\/i> \u00fcbermittelt habe. Resultat im Chrome:<\/p>\n<div id=\"attachment_642\" style=\"width: 625px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome-with-filter.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-642\" src=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome-with-filter.png\" alt=\"Chrome Filter\" title=\"Chrome Filter\" width=\"615\" height=\"198\" class=\"size-full wp-image-642\" srcset=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome-with-filter.png 615w, https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome-with-filter-300x96.png 300w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/a><p id=\"caption-attachment-642\" class=\"wp-caption-text\">Chrome Filter<\/p><\/div>\n<p>Bezieht sich \u00fcbrigens nur auf die Injection von <i>&lt;script&gt;<\/i>-Tags, ein &lt;b&gt; &#8211; Tag geht also durch. Soweit ganz sinnvoll, kann mir jedenfalls keinen legitimen Fall vorstellen, wo ein script-Tag per URL-Parameter ben\u00f6tigt werden k\u00f6nnte. Im IE (ab Version 8) dasselbe Spiel:<\/p>\n<div id=\"attachment_643\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-filter.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-643\" src=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-filter-300x64.png\" alt=\"IE XSS Filter\" title=\"IE XSS Filter\" width=\"300\" height=\"64\" class=\"size-medium wp-image-643\" srcset=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-filter-300x64.png 300w, https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-filter.png 797w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-643\" class=\"wp-caption-text\">IE XSS Filter<\/p><\/div>\n<p>Firefox ist das \u00fcbrigens egal. <\/p>\n<p>Wie ich nach etwas Recherche herausgefunden habe, nennt sich dieser Mechanismus <i>XSS-Protection<\/i> und ist in Webkit-basierenden Browsern bzw. eben dem IE standardm\u00e4\u00dfig aktiviert. Per Header l\u00e4sst sich der Filter allerdings abschalten:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">\r\n&lt;?php\r\nheader(&quot;X-XSS-Protection: 0&quot;);\r\n?&gt;\r\n<\/pre>\n<p>So dann im Chrome:<\/p>\n<div id=\"attachment_644\" style=\"width: 457px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-644\" src=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome.png\" alt=\"Chrome ohne Filter\" title=\"Chrome ohne Filter\" width=\"447\" height=\"257\" class=\"size-full wp-image-644\" srcset=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome.png 447w, https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/chrome-300x172.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/a><p id=\"caption-attachment-644\" class=\"wp-caption-text\">Chrome ohne Filter<\/p><\/div>\n<p>Entsprechend im IE, ich spare mir und euch den Screenshot. Alternativ l\u00e4sst sich das Verhalten noch konfigurieren:<\/p>\n<pre data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">\r\nheader(&quot;X-XSS-Protection: 1; mode=block&quot;);\r\n<\/pre>\n<p>Dann wird die komplette Seite geblockt, sodass uns im IE folgendes erwartet:<\/p>\n<div id=\"attachment_645\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-block.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-645\" src=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-block-300x56.png\" alt=\"IE mit Blockfilter\" title=\"IE mit Blockfilter\" width=\"300\" height=\"56\" class=\"size-medium wp-image-645\" srcset=\"https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-block-300x56.png 300w, https:\/\/d-mueller.de\/blog\/wp-content\/uploads\/2012\/09\/ie-with-block.png 709w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-645\" class=\"wp-caption-text\">IE mit Blockfilter<\/p><\/div>\n<p>Chrome zeigt einfach eine komplett leere Seite und gibt auch keinen Hinweis, etwa in Form einer Fehlermeldung. Prinzipiell eine sinnvolle Angelegenheit, das Verhalten vom IE gef\u00e4llt mir hier sehr gut.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ich war gerade sehr \u00fcberrascht, als ich im Zuge des Herumexperimentierens mit der Content Security Policy (kommt auch bald noch ein Artikel dazu &#8211; Update: Content Security Policy \u2013 Tutorial) folgendes Standard-Beispiel aufgebaut habe &#8230; &lt;input type=&quot;text&quot; value=&quot;&lt;?php echo $_GET[&#039;value&#039;]; &hellip; <a href=\"https:\/\/d-mueller.de\/blog\/ie-und-chrome-mit-standard-xss-filter-x-xss-protection\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6,8,3],"tags":[],"class_list":["post-641","post","type-post","status-publish","format-standard","hentry","category-php","category-security","category-quicktips","category-webdev"],"_links":{"self":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/posts\/641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/comments?post=641"}],"version-history":[{"count":0,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/posts\/641\/revisions"}],"wp:attachment":[{"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/media?parent=641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/categories?post=641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/d-mueller.de\/blog\/wp-json\/wp\/v2\/tags?post=641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}