Summary
A SQL injection vulnerability in the SourceCodester Class and Exam Timetabling System allows attacker-controlled input in the ID argument of /delete_user.php to influence database queries. Because the endpoint is remotely accessible, an unauthenticated or otherwise unauthorized attacker may be able to manipulate database operations when input is not safely handled.
Affected context
The vulnerability occurs in deployments of SourceCodester Class and Exam Timetabling System 1.0 where the /delete_user.php endpoint accepts an ID parameter and incorporates it into a database query without adequate separation between data and SQL syntax. Risk is higher when the endpoint is internet-accessible and does not require effective authentication or authorization.
Exploit preconditions
- Attack surface: Remotely accessible HTTP endpoint at
/delete_user.php - Required access: The ability to send requests to the endpoint; additional authentication requirements depend on deployment configuration
- Trigger point: Processing of the
IDargument - Why exploitation is possible: User-controlled input may reach SQL query construction without sufficient parameterization or validation
Why this happens
The underlying bug is an injection flaw in which externally supplied input is treated as part of a database command rather than strictly as a value. This behavior maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component describing the broader injection class. The insecure pattern generally involves dynamically building SQL statements from request parameters instead of using parameterized queries and constrained input handling.
Potential impact
- An attacker could read unauthorized database records
- An attacker may modify or delete application data
- Database integrity and availability could be affected
- Account, scheduling, or other application information could be exposed
- SQL-level privileges could enable broader compromise depending on database permissions
General mitigation guidance
Mitigation generally centers on removing direct concatenation of request data into SQL statements.
Common defensive patterns include:
- Use parameterized queries or prepared statements for every database operation
- Apply allowlist validation and strict type handling for identifier values
- Enforce authorization checks before performing deletion or other state-changing actions
- Use database accounts with only the permissions required by the application
- Avoid exposing administrative endpoints without strong authentication and authorization
- Return generic error messages that do not disclose database details
- Treat client-side validation as supplementary rather than a security boundary
How teams detect issues like this
Organizations can look for SQL injection risks through:
- Static analysis rules identifying SQL statements built through string concatenation
- Code review checks for request parameters passed directly to database APIs
- Dynamic testing of identifier and filter parameters using controlled security test cases
- Web application firewall or gateway policies that detect suspicious database-oriented input patterns
- Monitoring for abnormal requests to deletion endpoints, repeated database errors, or unexpected query behavior
- Automated security review tools that flag unsafe query construction and missing parameterization

