Summary
SourceCodester Class and Exam Timetabling System 1.0 contains a SQL injection vulnerability in the course-handling functionality. A remote attacker may manipulate the course input so that database queries are altered, potentially exposing, modifying, or deleting application data.
Affected context
The vulnerability occurs in the administrative course-management workflow, specifically where the course argument is used by admin/modal_add_course2.php and passed to mysqli_query. Risk is present when the affected endpoint is remotely reachable and user-controlled input is incorporated into a SQL statement without adequate parameterization or equivalent query isolation.
Exploit preconditions
- Attack surface: A remotely accessible web endpoint used by the course-management functionality
- Required access: Access sufficient to reach the affected request; the exact authentication requirement depends on deployment configuration
- Trigger point: Processing of the
courseargument inadmin/modal_add_course2.php - Why exploitation is possible: Input influences a database query without reliably separating data from SQL commands
Why this happens
The underlying flaw is the construction or execution of a database query using externally influenced input without a safe parameter-binding boundary. This behavior maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection) and is also related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because untrusted input is interpreted by a downstream SQL processor as command structure rather than only as data.
Potential impact
- An attacker may read sensitive records from the application database.
- An attacker could alter or delete timetable, course, user, or administrative data.
- The application may disclose database errors or other internal information.
- Compromised data could affect scheduling integrity and administrative operations.
- Database access could provide a path to broader compromise depending on account privileges and deployment design.
General mitigation guidance
Mitigation generally centers on preventing user-controlled values from becoming SQL syntax.
Common defensive patterns include:
- Using parameterized queries or prepared statements for all externally influenced values
- Applying allowlist validation for identifiers and enumerated course-related values where appropriate
- Avoiding string concatenation when building SQL statements
- Restricting database accounts to the minimum permissions required by the application
- Returning generic database errors while keeping detailed diagnostics in protected logs
- Separating administrative endpoints from untrusted public access through authentication and authorization controls
- Treating validation as complementary to, rather than a replacement for, parameterized queries
How teams detect issues like this
Organizations can look for this issue through:
- Static analysis rules identifying SQL strings assembled with request parameters
- Code review checks for direct interpolation or concatenation of web input into
mysqli_querycalls - Dynamic testing that monitors database behavior and error responses for unexpected query interpretation
- Web application firewall or gateway policies that detect suspicious database command patterns, recognizing that filtering is only a defense-in-depth measure
- Database audit logs showing unusual query structures, access patterns, or privilege use
- Automated security review tools that flag missing prepared statements and unsafe input flows

