Summary
A SQL injection vulnerability in the Class and Exam Timetabling System allows attacker-controlled input in the ID argument of /delete_teacher.php to influence database queries. Because the endpoint is remotely accessible, an unauthenticated or otherwise unauthorized attacker may be able to manipulate database operations if access controls do not prevent requests.
Affected context
The vulnerability occurs in deployments of SourceCodester Class and Exam Timetabling System 1.0 where the /delete_teacher.php endpoint accepts an ID parameter and incorporates it into a database query without adequate query parameterization. Risk depends on the endpoint being reachable over the network and on the application failing to enforce sufficient authorization and input-handling controls.
Exploit preconditions
- Attack surface: The remotely accessible
/delete_teacher.phpendpoint - Required access: Network access to the application; authentication requirements depend on the deployment
- Trigger point: Processing the
IDargument in a teacher-deletion request - Why exploitation is possible: Attacker-controlled input may reach a database query without reliable separation between data and SQL syntax
Why this happens
The underlying bug is an injection flaw in which external input is incorporated into a SQL statement as executable query syntax rather than being handled strictly as data. This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection. The broader CWE-74 classification reflects the failure to neutralize special elements within an interpreted command language.
Potential impact
- Unauthorized reading of application or database records
- Modification or deletion of stored timetable and teacher data
- Bypass of intended database query restrictions
- Exposure of sensitive information held by the application
- Further compromise could occur if the database account has excessive privileges
General mitigation guidance
Mitigation generally focuses on ensuring that database commands treat request values as data rather than executable SQL.
Common defensive patterns include:
- Using parameterized queries or prepared statements for every database operation
- Applying allowlisted type and range validation to identifier parameters
- Enforcing authorization checks before destructive actions
- Using database accounts with only the permissions required by the application
- Avoiding detailed database errors in responses and logs exposed to users
- Maintaining centralized input-handling and database-access policies
How teams detect issues like this
Organizations commonly detect SQL injection risks through:
- Static analysis rules identifying string concatenation or interpolation in SQL construction
- Code review checks for unparameterized query calls and missing authorization around delete operations
- Dynamic application testing that supplies unexpected input types and observes database error behavior
- Web application firewall or API policy rules monitoring anomalous request patterns
- Database monitoring for unusual query structures, deletion volume, or access to unrelated tables
Automated security review tools may help identify unsafe query construction, but findings should be validated against application behavior and authorization requirements.

