Summary
A SQL injection vulnerability in the Class and Exam Timetabling System allows attacker-controlled input in the ID parameter of /edit_subject1.php to influence database queries.
Because the affected endpoint is remotely reachable, an attacker may be able to access, alter, or interfere with database information without authorization.
Affected context
The issue appears in the subject-editing functionality of SourceCodester Class and Exam Timetabling System 1.0, specifically while processing the ID argument submitted to /edit_subject1.php. Risk exists where externally supplied values reach database query construction without sufficient parameterization or validation.
Exploit preconditions
- Attack surface: Remotely accessible web endpoint
- Required access: Ability to send requests to the subject-editing functionality; authentication requirements may depend on deployment configuration
- Trigger point: Processing of the
IDparameter by/edit_subject1.php - Why exploitation is possible: Input may be incorporated into a database query without being safely separated from SQL syntax
Why this happens
The underlying bug is an injection flaw in which application-controlled and user-controlled data are not reliably separated during SQL query construction. If the ID value is concatenated into a query or otherwise interpreted as SQL syntax, crafted input can change the query's intended meaning. This maps primarily to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection) and relates to the broader injection category represented by CWE-74.
Potential impact
- An attacker may retrieve unauthorized database records
- An attacker could modify or delete application data
- Database integrity and timetable information may be compromised
- The application may experience errors or service disruption
- Exposed database credentials or privileges could increase downstream impact
General mitigation guidance
Mitigation generally focuses on ensuring that database commands treat request values strictly as data.
Common defensive patterns include:
- Use parameterized queries or prepared statements for all database operations
- Apply allowlist-based validation and appropriate type handling for identifier fields
- Avoid dynamically concatenating request values into SQL statements
- Restrict database accounts to the minimum privileges required by the application
- Centralize query construction and enforce secure data-access conventions
- Add authorization checks around subject-editing operations and sensitive records
- Reduce trust in client-supplied identifiers by verifying resource ownership and scope server-side
How teams detect issues like this
Organizations can identify SQL injection risks through:
- Static analysis rules that flag string concatenation or formatting used to build SQL queries
- Code review checks for request parameters reaching database APIs without binding
- Dynamic testing of externally reachable parameters using controlled, non-destructive test inputs
- Web application firewall or API policy rules monitoring anomalous database-oriented input patterns
- Logging and alerting for unusual query errors, enumeration behavior, or unexpected access to records
Automated code review and software composition tools may help surface unsafe data-access patterns, but findings should be validated against application behavior.

