Summary
The Online Examination System 1.0 contains an SQL injection vulnerability in the login page (/index.php) where the User parameter is incorporated into database queries without proper sanitization.
A remote attacker can manipulate this parameter to alter SQL queries, potentially bypassing authentication, extracting sensitive data, or modifying exam-related records.
Affected context
This vulnerability appears in the login functionality of the Online Examination System 1.0, specifically within /index.php when handling the User input field.
It is relevant in deployments where the application connects to a relational database and constructs SQL statements dynamically using raw request parameters.
The risk is higher when the database account used by the application has broad privileges over user, exam, or grading tables and when no web application firewall or query-level protections are in place.
Exploit preconditions
- Attack surface: Public-facing login page at
/index.php. - Required access: Network access to the web application; no prior authentication is required.
- Trigger point: Submission of a crafted
Userparameter value during the login process (e.g., via an HTTP POST or GET to/index.php). - Why exploitation is possible: The
Userparameter is inserted into SQL queries without adequate input validation, parameterization, or escaping, allowing attacker-controlled input to influence the query structure.
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
The login page likely builds SQL statements by concatenating user-provided User values directly into query strings, rather than using prepared statements or bound parameters.
Additionally, the presence of CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component indicates that untrusted data is passed into the database layer—a downstream component—without proper neutralization, enabling the input to be interpreted as part of the SQL syntax instead of as data.
This insecure pattern arises when application logic trusts form fields to be well-formed and does not enforce strict validation or use of safe database APIs.
Potential impact
- Bypass of authentication, allowing unauthorized access to student or administrator accounts.
- Extraction of sensitive information such as user credentials (if stored insecurely), exam questions, or grades.
- Modification or deletion of exam records, answers, or user profiles.
- Creation of new privileged accounts within the application data store.
- Potential full database compromise if the application's database user has extensive privileges.
- Use of the compromised application as a pivot point to further attack the underlying infrastructure.
General mitigation guidance
Mitigation focuses on eliminating direct concatenation of user input into SQL queries and tightening trust boundaries around login data.
Recommended defensive patterns include:
- Using parameterized queries or prepared statements for all database interactions involving user input.
- Implementing strict server-side validation on login fields (e.g., expected character sets and length limits for usernames).
- Centralizing database access through a data-access layer that enforces safe query construction patterns.
- Assigning least-privilege roles to the database account used by the application so that, even if a query is manipulated, the scope of damage is reduced.
- Applying generic input-handling safeguards, such as rejecting unexpected or malformed input, and normalizing data before it reaches the database layer.
- Considering defense-in-depth controls such as web application firewalls configured with SQL injection rules to help detect and block obvious injection attempts.
How teams detect issues like this
Detection can combine code-level analysis with runtime monitoring:
- Static analysis: Scan the codebase for dynamic SQL construction that concatenates request parameters (particularly the
Userparameter) into query strings. - Code review signals: Look for login logic in
/index.phpwhere user-supplied values are embedded directly into SQL statements without prepared statements or binding. - Policy enforcement: Enforce development policies that mandate parameterized queries and forbid raw string concatenation for database access, backed by CI checks.
- Runtime monitoring: Use database activity monitoring or application logs to detect anomalous query patterns, such as unexpected operators, comment sequences, or always-true conditions originating from login requests.
- Automated security testing tools (e.g., DAST scanners) can be integrated to probe for SQL injection behaviors on the login endpoint during QA.

