CVE-2020-23830

7.1 HIGH

📋 TL;DR

This CSRF vulnerability in SourceCodester Stock Management System v1.0 allows attackers to change authenticated users' usernames without their consent when they visit malicious third-party sites. This can deny legitimate users future logins by changing their credentials. All users of the vulnerable system are affected.

💻 Affected Systems

Products:
  • SourceCodester Stock Management System
Versions: v1.0
Operating Systems: Any OS running PHP web server
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all installations of v1.0 regardless of configuration. The changeUsername.php endpoint lacks CSRF protection.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Administrator accounts could be locked out, causing complete system unavailability and requiring database-level intervention to restore access.

🟠

Likely Case

Regular users lose access to their accounts, requiring administrator intervention to reset usernames and restore functionality.

🟢

If Mitigated

With proper CSRF protections, no unauthorized username changes occur, maintaining normal system operations.

🌐 Internet-Facing: HIGH - The vulnerability is exploitable via web browsers when users visit malicious sites, making internet-facing instances particularly vulnerable.
🏢 Internal Only: MEDIUM - Internal users could still be tricked into visiting malicious internal sites or phishing pages, though attack surface is reduced.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires the victim to be authenticated and visit a malicious site. The exploit is simple HTML/JavaScript that submits a form to changeUsername.php.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Not available

Vendor Advisory: Not available

Restart Required: No

Instructions:

No official patch exists. Consider implementing CSRF tokens in changeUsername.php or upgrading if a newer version becomes available.

🔧 Temporary Workarounds

Add CSRF Protection to changeUsername.php

all

Implement CSRF tokens in the changeUsername.php endpoint to validate legitimate requests.

Edit changeUsername.php to include CSRF token generation and validation. Add token generation in form: <?php $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); ?> and validation before processing: if(!hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) { die('CSRF validation failed'); }

Disable changeUsername.php Endpoint

all

Temporarily disable the vulnerable endpoint until proper fixes can be implemented.

Rename changeUsername.php to changeUsername.php.disabled or add exit(); at the beginning of the file.

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block unauthorized POST requests to changeUsername.php
  • Educate users about phishing risks and implement strict access controls to limit who can change usernames

🔍 How to Verify

Check if Vulnerable:

Check if changeUsername.php exists in the web root and lacks CSRF token validation in its source code.

Check Version:

Check the system's version in its configuration files or about page, or examine file headers for version 1.0 references.

Verify Fix Applied:

Test that changeUsername.php now requires a valid CSRF token and rejects requests without proper tokens.

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed login attempts from legitimate users
  • Username change requests without corresponding user actions in logs

Network Indicators:

  • POST requests to changeUsername.php from unexpected referrers or without proper session tokens

SIEM Query:

source="web_logs" AND uri="/changeUsername.php" AND method="POST" AND NOT referrer CONTAINS "your-domain.com"

🔗 References

📤 Share & Export