Summary
A SQL injection vulnerability in the Online Examination 1.0 application allows crafted uname and password parameters sent to head.php to manipulate backend database queries.
When exploited remotely over the web interface, this flaw can expose or alter examination data and user accounts, especially where input is not properly sanitized.
Affected context
The vulnerability appears in the login-related logic of head.php within the Online Examination 1.0 application, where uname and password inputs are processed.
It typically exists when user-provided credentials are interpolated directly into SQL queries without robust validation, encoding, or parameterization.
Deployments that expose this login functionality over the internet and rely on a single shared database instance are more likely to see impactful exploitation.
Exploit preconditions
- Attack surface: Public or internal web interface handling uname/password parameters in head.php
- Required access: Network access to the application's login endpoint; no prior authentication is typically needed
- Trigger point: Submission of crafted uname and/or password values that are concatenated into SQL statements
- Why exploitation is possible: The backend constructs SQL queries using unsanitized user input rather than parameterized statements, enabling attackers to alter query structure
Why this happens
The core issue is the direct inclusion of user-controlled uname and password values into SQL query strings without proper separation between data and control.
This aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where meta-characters and fragments of SQL syntax are not safely handled.
The implementation likely relies on string concatenation or interpolation instead of prepared statements, and may lack input validation, making it trivial for an attacker to inject additional conditions or operations.
Potential impact
- Attackers may bypass authentication and log in as arbitrary users, including administrators.
- Sensitive examination data, such as questions, answers, and scores, could be read or exfiltrated.
- Database records may be modified, deleted, or corrupted, affecting exams and user accounts.
- The application's integrity could be undermined, enabling manipulation of results or cheating.
- In some environments, SQL injection could be chained with other flaws to gain broader system access.
General mitigation guidance
Effective mitigation focuses on treating all credential inputs as untrusted and strictly separating SQL command structure from user-supplied data.
Common defensive patterns include:
- Using parameterized queries or prepared statements for all database operations involving uname and password.
- Applying robust input validation to credential fields, restricting them to expected character sets and lengths.
- Centralizing data access logic in a well-reviewed abstraction layer to avoid ad hoc query construction.
- Enforcing least-privilege for the database user account so injected queries have limited impact if they occur.
- Adopting secure-by-default frameworks or ORM layers that minimize direct string-based SQL construction.
How teams detect issues like this
Detection typically involves a mix of code-level and runtime approaches:
- Static analysis rules that flag dynamic SQL construction using uname/password or other request parameters.
- Manual code review focused on authentication modules and any scripts (like head.php) performing direct query concatenation.
- Logging and monitoring of database activity for anomalous queries, such as those containing unexpected tautologies or UNION statements.
- Integration of web application security testing, including automated scanners and targeted penetration tests for SQL injection patterns.
- Policy-based enforcement that prohibits raw SQL string building in high-risk components and requires prepared statements.

