CVE-2022-21643
📋 TL;DR
CVE-2022-21643 is a critical SQL injection vulnerability in USOC CMS that allows attackers to execute arbitrary SQL commands through the registration form. This affects all USOC installations with vulnerable versions, potentially compromising the entire database. Attackers can steal sensitive data, modify content, or gain administrative access.
💻 Affected Systems
- USOC CMS
📦 What is this software?
Useful Simple Open Source Cms by Useful Simple Open Source Cms Project
⚠️ Risk & Real-World Impact
Worst Case
Complete database compromise leading to data theft, privilege escalation to admin, website defacement, or full system takeover if database permissions allow.
Likely Case
Attackers extract user credentials and personal data, modify website content, or create backdoor admin accounts.
If Mitigated
Limited to registration page only; proper input validation and parameterized queries prevent exploitation.
🎯 Exploit Status
SQL injection via username, email, and password fields in register.php requires no authentication.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Commit 21e8bfd7a9ab0b7f9344a7a3a7c32a7cdd5a0b69
Vendor Advisory: https://github.com/Aaron-Junker/USOC/security/advisories/GHSA-fjp4-phjh-jgmc
Restart Required: No
Instructions:
1. Backup your USOC installation and database. 2. Update to the latest USOC version or apply commit 21e8bfd7a9ab0b7f9344a7a3a7c32a7cdd5a0b69. 3. Verify the fix by checking that parameterized queries are used in register.php.
🔧 Temporary Workarounds
Disable User Registration
allTemporarily disable the registration functionality to prevent exploitation.
Modify USOC configuration to disable new user registration or comment out registration form in templates.
Web Application Firewall (WAF)
allDeploy WAF rules to block SQL injection patterns targeting register.php.
Configure WAF to block SQL injection patterns on /register.php endpoint.
🧯 If You Can't Patch
- Implement strict input validation and sanitization for username, email, and password fields in register.php
- Deploy a web application firewall with SQL injection protection rules
🔍 How to Verify
Check if Vulnerable:
Check if your USOC version is before commit 21e8bfd7a9ab0b7f9344a7a3a7c32a7cdd5a0b69 by examining the code or version files.
Check Version:
Check USOC version files or git log for commit history
Verify Fix Applied:
Verify that register.php uses parameterized queries or prepared statements instead of direct string concatenation for SQL queries.
📡 Detection & Monitoring
Log Indicators:
- Unusual SQL errors in application logs
- Multiple failed registration attempts with SQL syntax in parameters
- Successful registrations with suspicious usernames containing SQL keywords
Network Indicators:
- HTTP POST requests to /register.php containing SQL injection patterns in parameters
SIEM Query:
source="web_logs" AND uri="/register.php" AND (username="*' OR *" OR email="*' OR *" OR password="*' OR *")
🔗 References
- https://github.com/Aaron-Junker/USOC/commit/21e8bfd7a9ab0b7f9344a7a3a7c32a7cdd5a0b69
- https://github.com/Aaron-Junker/USOC/security/advisories/GHSA-fjp4-phjh-jgmc
- https://github.com/Aaron-Junker/USOC/commit/21e8bfd7a9ab0b7f9344a7a3a7c32a7cdd5a0b69
- https://github.com/Aaron-Junker/USOC/security/advisories/GHSA-fjp4-phjh-jgmc