{"id":78,"date":"2010-06-10T08:13:53","date_gmt":"2010-06-10T07:13:53","guid":{"rendered":"http:\/\/www.floyd.ch\/?p=78"},"modified":"2023-05-31T08:52:26","modified_gmt":"2023-05-31T07:52:26","slug":"apache-http-0-9-compatible","status":"publish","type":"post","link":"https:\/\/www.floyd.ch\/?p=78","title":{"rendered":"Apache HTTP 0.9 compatible"},"content":{"rendered":"<p>When sending the ASCII control character null (hexadecimal 00) in the query string of an URI, IIS returns a 400 (Bad Request). Tomcat passes the null to the web application. But Apache returns a HTTP entity (the HTML code), but no HTTP headers. Additionally the URI is truncated (the null and everything after it is missing).<\/p>\n<p>If you have a local apache running, try this python script (you need to have a index.html or index.php in your root directory):<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport urllib2\r\nprint 'Valid request:'\r\nprint urllib2.urlopen('http:\/\/localhost\/?abc=123&amp;def=456_VALID').read()\r\nprint ''\r\nprint 'Invalid request:'\r\nprint urllib2.urlopen('http:\/\/localhost\/?abc=123'+chr(0)+'&amp;def=456_INVALID').read()\r\n<\/pre>\n<p>If you watch it with wireshark you will see that the answer to the second request has no HTTP headers. The apache access.log will look like this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n::1 - - &#x5B;09\/Jun\/2010:16:44:41 +0200] &quot;GET \/?abc=123&amp;def=456_VALID HTTP\/1.1&quot; 200 321 &quot;-&quot; &quot;Python-urllib\/2.6&quot;\r\n::1 - - &#x5B;09\/Jun\/2010:16:44:41 +0200] &quot;GET \/?abc=123&quot; 200 94 &quot;-&quot; &quot;-&quot;\r\n<\/pre>\n<p>Eric Covener of the apache project:<\/p>\n<blockquote><p>The null in the invalid URL causes the request line to be terminated before the rest of the URL or the protocol.  The response (no headers) is &#8220;HTTP 0.9&#8221; described here: <\/p>\n<p>http:\/\/www.w3.org\/Protocols\/HTTP\/AsImplemented.html<\/p><\/blockquote>\n<p>You can find my (invalid) bug report <a href=\"https:\/\/bz.apache.org\/bugzilla\/show_bug.cgi?id=49416#attach_25569\">here<\/a>. I think this can only be used for web server fingerprinting. Or if there is a client (e.g. a browser) that sends the null character as well, there might be some changes for header injection.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When sending the ASCII control character null (hexadecimal 00) in the query string of an URI, IIS returns a 400 (Bad Request). Tomcat passes the null to the web application. But Apache returns a HTTP entity (the HTML code), but &hellip; <a href=\"https:\/\/www.floyd.ch\/?p=78\">Continue reading <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],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-web-application-fuzzing"],"_links":{"self":[{"href":"https:\/\/www.floyd.ch\/index.php?rest_route=\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.floyd.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.floyd.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.floyd.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.floyd.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":23,"href":"https:\/\/www.floyd.ch\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":1374,"href":"https:\/\/www.floyd.ch\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/1374"}],"wp:attachment":[{"href":"https:\/\/www.floyd.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.floyd.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.floyd.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}