Summary
SourceCodester Online Admission System 1.0 contains a SQL injection vulnerability in /programmes.php via the program parameter.
A remote attacker can manipulate this input to interfere with backend SQL queries, which may lead to data exposure, modification, or account compromise when the application runs with elevated database privileges.
Affected context
The vulnerability occurs in the web-facing /programmes.php endpoint of the Online Admission System 1.0 when user-controlled input from the program parameter is incorporated into SQL statements without sufficient sanitization or parameterization.
It becomes relevant in deployments where this endpoint is reachable over the network and the application server can interact with a relational database using that untrusted value in query construction.
Exploit preconditions
- Attack surface: HTTP(S) requests to the /programmes.php endpoint of the Online Admission System.
- Required access: Network access to the application; no prior authentication may be necessary depending on how the page is exposed.
- Trigger point: Supplying crafted values in the program parameter (e.g., via query string or POST data) that are concatenated into SQL queries.
- Why exploitation is possible: The backend logic appears to directly embed the program parameter into SQL statements without using prepared statements, proper escaping, or server-side validation, allowing attackers to alter query structure instead of being treated purely as data.
Why this happens
This issue stems from dynamically constructing SQL queries using untrusted input from the program parameter in /programmes.php.
Instead of binding the value through parameterized queries, the application likely concatenates the raw input into the SQL string, mapping to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component) is also relevant because the application fails to neutralize special characters before passing them to the downstream database engine, which interprets them as part of the SQL command rather than as data.
Potential impact
- An attacker may read sensitive admission-related data stored in the database, including personal or academic information.
- An attacker could modify or delete records, impacting data integrity and system reliability.
- SQL logic manipulation can potentially bypass authentication or authorization checks if those depend on vulnerable queries.
- In some configurations, the attacker may be able to write data to additional tables, create new accounts, or escalate privileges in the application.
- If the database or environment is misconfigured, SQL injection could be chained with other weaknesses to reach file access or remote code execution.
General mitigation guidance
Effective mitigation focuses on treating all external input as untrusted and preventing it from altering SQL structure:
- Prefer parameterized queries or prepared statements for all database interactions that rely on user-supplied input, including the program parameter in /programmes.php.
- Introduce strict server-side validation for the program parameter, enforcing expected formats (e.g., numeric IDs or whitelisted identifiers) and rejecting unexpected characters or patterns.
- Apply robust input neutralization at the data access layer, ensuring that any special characters are treated as data, not SQL syntax, while still relying on parameterization as the primary defense.
- Enforce least-privilege database accounts so that even if a query is manipulated, the account lacks permissions to access or modify unrelated tables or perform dangerous operations.
- Centralize query construction patterns in a data access layer, making it easier to audit and enforce secure-by-default query APIs across the application.
How teams detect issues like this
Detection can combine code-centric and runtime approaches:
- Static analysis rules can flag direct string concatenation or interpolation of request parameters (such as program) into SQL statements, particularly in PHP scripts like /programmes.php.
- Manual code reviews should look for queries built with variables derived from $_GET, $_POST, or other superglobals without parameter binding or validation, and for any ad-hoc query construction patterns scattered across the codebase.
- Security testing (including automated DAST and manual penetration testing) can send crafted input through the program parameter to identify anomalous SQL responses, database error messages, or timing differences indicative of injectable queries.
- Implement application-level logging and monitoring for unusual query patterns, sudden spikes in error-generating requests, or repeated access to /programmes.php with suspicious parameter values to help detect active exploitation attempts.

