Summary
A SQL injection vulnerability in the SourceCodester Class and Exam Timetabling System allows attacker-controlled input in the course parameter to influence a database query. Because the affected functionality may be reachable remotely, an attacker could potentially read, alter, or otherwise interfere with application data.
Affected context
The vulnerability occurs in the administrative course-management functionality implemented by /admin/modal_add_coursea.php. It becomes risky when the course request parameter is incorporated into a mysqli_query operation without sufficiently separating data from SQL instructions. Exposure depends on whether the affected endpoint is reachable and what authorization controls protect it.
Exploit preconditions
- Attack surface: The web-accessible course-management endpoint
- Required access: Ability to send requests to the affected functionality; authentication requirements depend on deployment configuration
- Trigger point: Processing of the
courseparameter in/admin/modal_add_coursea.php - Why exploitation is possible: User-controlled input can influence SQL query construction rather than being handled strictly as data
Why this happens
The underlying bug is an injection flaw caused by combining untrusted request data with a dynamically constructed SQL statement. When input is not safely parameterized or otherwise constrained before reaching mysqli_query, database syntax may be interpreted as part of the query. This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection) and relates more broadly to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.
Potential impact
- An attacker may read information from application databases
- An attacker could modify or delete timetable, course, user, or related records
- The vulnerability may enable unauthorized administrative actions through database manipulation
- Database availability or application functionality could be disrupted
- Sensitive information may be exposed depending on database permissions
General mitigation guidance
Mitigation generally focuses on ensuring that database operations treat external input exclusively as data.
Common defensive patterns include:
- Using parameterized queries or prepared statements for all user-influenced database operations
- Applying allowlisted validation for course identifiers and other structured fields
- Avoiding SQL string concatenation with request parameters
- Restricting the database account to only the privileges required by the application
- Enforcing authentication and authorization checks at the affected administrative endpoint
- Separating database error details from responses shown to users
- Preserving secure defaults in shared database-access helpers and frameworks
How teams detect issues like this
Organizations can look for SQL injection risks through:
- Static analysis rules identifying string concatenation or interpolation passed to
mysqli_query - Code review checks for database calls that receive request parameters without parameter binding
- Dynamic testing of reachable endpoints using safe, non-destructive injection indicators
- Web application firewall or API policy rules monitoring anomalous database-oriented input
- Database audit logs showing unexpected query structures, access patterns, or privilege usage
- Automated security review tools that flag unparameterized SQL construction

