{"id":58708,"date":"2024-08-08T19:39:58","date_gmt":"2024-08-08T16:39:58","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180004\/KL-001-2024-009.txt"},"modified":"2024-08-08T19:39:58","modified_gmt":"2024-08-08T16:39:58","slug":"journyx-11-5-4-cross-site-scripting","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/journyx-11-5-4-cross-site-scripting\/","title":{"rendered":"Journyx 11.5.4 Cross Site Scripting"},"content":{"rendered":"<p>KL-001-2024-009: Journyx Reflected Cross Site Scripting<\/p>\n<p>Title: Journyx Reflected Cross Site Scripting<br \/>Advisory ID: KL-001-2024-009<br \/>Publication Date: 2024.08.07<br \/>Publication URL: https:\/\/korelogic.com\/Resources\/Advisories\/KL-001-2024-009.txt<\/p>\n<p>1. Vulnerability Details<\/p>\n<p>Affected Vendor: Journyx<br \/>Affected Product: Journyx (jtime)<br \/>Affected Version: 11.5.4<br \/>Platform: GNU\/Linux<br \/>CWE Classification: CWE-81: Improper Neutralization of Script in an Error<br \/>Message Web Page<br \/>CVE ID: CVE-2024-6892<\/p>\n<p>2. Vulnerability Description<\/p>\n<p>Attackers can craft a malicious link that once clicked<br \/>will execute arbitrary JavaScript in the context of<br \/>the Journyx web application.<\/p>\n<p>3. Technical Description<\/p>\n<p>During the active directory login flow, if an error<br \/>occurs, the user is redirected to a page containing<br \/>an error message outlining the problem. The error<br \/>message shown in the page response is derived from<br \/>the &#8220;error_description&#8221; query parameter that appears<br \/>in the URL. This parameter is not sanitized or validated<br \/>prior to being reflected, allowing for an attacker to<br \/>insert malicious HTML\/JavaScript into the &#8220;error_description&#8221;<br \/>parameter.<\/p>\n<p>This vulnerability can be exploited regardless of whether<br \/>active directory authentication has been configured for the<br \/>Journyx instance.<\/p>\n<p>4. Mitigation and Remediation Recommendation<\/p>\n<p>The vendor reports that this issue was remediated in Journyx<br \/>v13.0.0.<\/p>\n<p>For self-hosted instances of JournyX, additional security<br \/>measures (such as input sanitization) can be added by monkey<br \/>patching the PYC file responsible for handling request<br \/>parameters (mycgi.pyc).<\/p>\n<p>1) Rename &#8220;mycgi.pyc&#8221; to an alternative name, e.g. mycgi_original.pyc.<br \/>$ mv wt_tar\/pi\/pylib\/wtlib\/mycgi.py wt_tar\/pi\/pylib\/wtlib\/mycgi_original.py<\/p>\n<p>2) Create a file named &#8220;mycgi.py&#8221; in the same directory.<br \/>$ touch wt_tar\/pi\/pylib\/wtlib\/mycgi.py<\/p>\n<p>3) Insert the following code into the newly created &#8220;mycgi.py&#8221;<\/p>\n<p>from mycgi_original import *<br \/>from html import escape<\/p>\n<p>def patch():<br \/>pdata = _parse()<\/p>\n<p># force the value of &#8220;end_URL&#8221; to always be &#8220;wte&#8221;<br \/>if pdata.get(&#8216;end_URL&#8217;): pdata[&#8216;end_URL&#8217;] = [&#8216;wte&#8217;]\n<p># sanitize user-controlled error messages<br \/>for parameter in [&#8216;error&#8217;, &#8216;error_description&#8217;]:<br \/>if not pdata.get(parameter): continue<br \/>pdata[parameter] = [escape(value) for value in pdata[parameter]]\n<p>return pdata<\/p>\n<p>_parse = parse<br \/>parse = patch<\/p>\n<p>Once these changes have been made, the JournyX native &#8220;mycgi.parse()&#8221;<br \/>function will be overwritten with the &#8220;patch()&#8221; function located in the<br \/>&#8220;mycgi.py&#8221; file. Relevant to this advisory, the patch provided above<br \/>will replace special characters with their respective HTML entity<br \/>representation for the &#8220;error&#8221; and &#8220;error_description&#8221; parameters. This<br \/>list of parameters can be extended as needed.<\/p>\n<p>Additionally, if SSO is not required, requests to \/jtcgi\/r\/adlogin\/sso<br \/>could be dropped without forwarding invoking FastCGI via a ModSecurity<br \/>rule like the one below:<\/p>\n<p>SecRule REQUEST_URI &#8220;@contains adlogin\/sso&#8221; &#8220;id:4,phase:2,deny,log,auditlog&#8221;<\/p>\n<p>5. Credit<\/p>\n<p>This vulnerability was discovered by Jaggar Henry of KoreLogic, Inc.<\/p>\n<p>6. Disclosure Timeline<\/p>\n<p>2024.01.31 &#8211; KoreLogic notifies Journyx support of the intention to<br \/>report vulnerabilities discovered in the licensed,<br \/>on-premises version of the product.<br \/>2024.01.31 &#8211; Journyx acknowledges receipt.<br \/>2024.02.02 &#8211; KoreLogic requests a meeting with Journyx support to share<br \/>vulnerability details.<br \/>2024.02.07 &#8211; KoreLogic reports vulnerability details to Journyx.<br \/>2024.02.09 &#8211; Journyx responds that this vulnerability has been remediated<br \/>in the cloud-hosted version of the product.<br \/>2024.02.21 &#8211; KoreLogic offers to test the cloud version to confirm<br \/>the fix; no response.<br \/>2024.07.01 &#8211; KoreLogic notifies Journyx of impending public disclosure.<br \/>2024.07.09 &#8211; Journyx confirms version number of the remediation.<br \/>2024.08.07 &#8211; KoreLogic public disclosure.<\/p>\n<p>7. Proof of Concept<\/p>\n<p>The following URL contains the &#8220;error_description&#8221;<br \/>parameter with a value of &#8220;%3Csvg%2fonload%3dprompt(%27KoreLogic%27)%3E&#8221;:<\/p>\n<p>http:\/\/redacted.com:8080\/jtcgi\/r\/adlogin\/sso?code=1337&#038;state=foobar&#038;id_token=zoinks&#038;error_description=%3Csvg%2fonload%3dprompt(%27KoreLogic%27)%3E&#038;error=error<\/p>\n<p>This value is automatically URL decoded to &#8220;&lt;svg\/onload=prompt(&#8216;KoreLogic&#8217;)&gt;&#8221;<br \/>and reflected into the page response:<\/p>\n<p>&lt;div class=&#8221;errorMessage&#8221;&gt;<br \/>Unable to complete sign-on attempt. This is possibly a configuration error in the application registration <br \/>on the Identity Provider (IdP) side. The IdP server said:<br \/>&lt;p&gt;error &lt;b&gt;&lt;svg onload=&#8221;prompt(&#8216;KoreLogic&#8217;)&#8221;&gt;&lt;\/svg&gt;&lt;\/b&gt;&lt;\/p&gt;<br \/>&lt;\/div&gt;<\/p>\n<p>Once this link is clicked or visited in a browser, the<br \/>javascript function &#8220;prompt()&#8221; is executed, and a display<br \/>box is presented, thereby validating the execution of<br \/>arbitrary JavaScript.<\/p>\n<p>The contents of this advisory are copyright(c) 2024<br \/>KoreLogic, Inc. and are licensed under a Creative Commons<br \/>Attribution Share-Alike 4.0 (United States) License:<br \/>http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/<\/p>\n<p>KoreLogic, Inc. is a founder-owned and operated company with a<br \/>proven track record of providing security services to entities<br \/>ranging from Fortune 500 to small and mid-sized companies. We<br \/>are a highly skilled team of senior security consultants doing<br \/>by-hand security assessments for the most important networks in<br \/>the U.S. and around the world. We are also developers of various<br \/>tools and resources aimed at helping the security community.<br \/>https:\/\/www.korelogic.com\/about-korelogic.html<\/p>\n<p>Our public vulnerability disclosure policy is available at:<br \/>https:\/\/korelogic.com\/KoreLogic-Public-Vulnerability-Disclosure-Policy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>KL-001-2024-009: Journyx Reflected Cross Site Scripting Title: Journyx Reflected Cross Site ScriptingAdvisory ID: KL-001-2024-009Publication Date: 2024.08.07Publication URL: https:\/\/korelogic.com\/Resources\/Advisories\/KL-001-2024-009.txt 1. Vulnerability Details Affected Vendor: JournyxAffected Product: Journyx (jtime)Affected Version: 11.5.4Platform: GNU\/LinuxCWE Classification: CWE-81: Improper Neutralization of Script in an ErrorMessage Web PageCVE ID: CVE-2024-6892 2. Vulnerability Description Attackers can craft a malicious link that once clickedwill &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-58708","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=58708"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58708\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=58708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=58708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=58708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}