Summary
A high-severity SQL injection vulnerability in the Class and Exam Timetabling System 1.0 may allow attackers to influence database queries through the id argument accepted by /delete_subject.php.
Because the endpoint is remotely reachable, an attacker who can access it may read, alter, or delete database records depending on database permissions and application behavior.
Affected context
The vulnerability occurs in deployments of SourceCodester Class and Exam Timetabling System 1.0 where the /delete_subject.php endpoint is reachable and incorporates the id parameter into a database operation without sufficient query separation or validation. Risk depends on endpoint exposure, authentication controls, database privileges, and the data handled by the application.
Exploit preconditions
- Attack surface: HTTP request to
/delete_subject.php - Required access: Network access to the application; authentication requirements depend on deployment configuration
- Trigger point: Processing the user-controlled
idargument - Why exploitation is possible: Input may reach a database query in an unsafe form, allowing SQL syntax to alter the intended operation
Why this happens
The underlying bug is the failure to keep untrusted request data separate from SQL command structure. When the id parameter is concatenated into a query or otherwise handled without parameterization, specially formed input may change the meaning of the database statement. This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). CWE-74 is also relevant as a broader classification for improper neutralization of special elements in output used by another component.
Potential impact
- An attacker may retrieve unauthorized application or database information
- Database records could be modified or deleted
- The application may experience data integrity loss or service disruption
- Exposed database credentials or privileged data could enable further compromise
- Auditability and trust in scheduling data could be reduced
General mitigation guidance
Mitigation generally centers on ensuring that database commands do not interpret user input as SQL syntax.
Common defensive patterns include:
- Using parameterized queries or prepared statements for all database operations
- Applying allowlisted validation for identifiers, including expected type and range checks
- Enforcing authentication and authorization before destructive actions
- Applying least-privilege permissions to the application database account
- Returning generic error messages that do not disclose query or database details
- Restricting direct exposure of administrative endpoints where operationally feasible
How teams detect issues like this
Detection approaches may include:
- Static analysis for SQL string concatenation or interpolation involving request parameters
- Code review checks for unparameterized queries in delete, update, and lookup handlers
- Dynamic testing of endpoint parameters using safe, authorized SQL injection test cases
- Web-application firewall or API gateway policies that identify suspicious database syntax
- Database monitoring for anomalous query patterns, unexpected access, or destructive activity
- Automated security scanning and code-review tools configured to flag CWE-89 patterns

