Severity:

HIGH RISK

(7.3)

SQL Injection in StudentManagementSystem confirm_logged_in

CVE-2026-9470

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Authentication Bypass and Data Compromise via SQL Injection

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A SQL injection vulnerability in the confirm_logged_in function of student_trans.php allows attacker-controlled values in the FIRST_NAME, Last_Name, and EMAIL parameters to be included directly in database queries.

When these fields are not properly sanitized or parameterized, a remote attacker can manipulate the underlying SQL logic, potentially bypassing authentication and accessing or modifying sensitive student data.

Affected context

This issue appears in the authentication or session validation logic of the StudentManagementSystem, specifically within the confirm_logged_in function in student_trans.php.

It is most relevant when:

  • User identity or session checks depend on database queries using FIRST_NAME, Last_Name, or EMAIL,
  • These values originate from HTTP requests (e.g., query parameters, POST data, or cookies),
  • The application constructs SQL statements by concatenating these values directly into query strings without consistent use of prepared statements.

In such deployments, the login or session confirmation process becomes a point where untrusted input influences database operations.

Exploit preconditions

  • Attack surface: Web interface endpoints that invoke student_trans.php and rely on confirm_logged_in.
  • Required access: Remote network access to the application and the ability to supply or control the FIRST_NAME, Last_Name, or EMAIL parameters (for example via login forms, profile data, or crafted requests).
  • Trigger point: Execution of SQL queries during login/session confirmation where these parameters are interpolated directly into the query text.
  • Why exploitation is possible: The application combines user-supplied data with SQL command text without strict parameterization or escaping, enabling attackers to inject additional SQL syntax that alters the intended query.

Why this happens

The underlying flaw is an improper neutralization of special elements used in SQL commands, mapped to CWE-89 (Improper Neutralization of Special Elements used in an SQL Command).

The confirm_logged_in routine appears to:

  • Accept identity attributes (first name, last name, email) as input for validating logged-in users,
  • Construct SQL statements by concatenating these values into WHERE clauses or similar conditions,
  • Fail to consistently use prepared statements, bound parameters, or robust escaping routines.

This pattern allows untrusted data to be treated as part of the SQL grammar rather than as purely data.

The reference to CWE-74 (Improper Neutralization of Data within Output Used by a Downstream Component) reflects the broader problem of passing tainted data directly into a downstream SQL interpreter without sanitization.

Potential impact

  • Bypass of login or session checks, allowing unauthorized access to student accounts or administrative areas.
  • Exposure of sensitive information such as student records, grades, and contact details.
  • Unauthorized modification or deletion of data within the underlying database.
  • Creation of new privileged accounts or manipulation of existing user roles.
  • Potential pivoting to other systems or services if shared credentials or database access paths exist.

General mitigation guidance

Effective mitigation focuses on removing direct string concatenation and minimizing trust in user-controlled data across authentication and session logic:

  • Adopt parameterized queries or prepared statements for all database interactions, especially those involving authentication or identity checks.
  • Apply centralized input handling for identity attributes (e.g., first name, last name, email) with clear type and length constraints before they reach any data-access layer.
  • Introduce an abstraction layer (e.g., ORM or query builder) that discourages constructing raw SQL strings and enforces binding of parameters.
  • Separate application logic and identity checks from raw query construction; ensure that higher-level functions never embed raw input into conditions.
  • Limit database privileges of the application user (least privilege) so that even if SQL behavior is influenced, the scope of damage is constrained.
  • Normalize and validate data used as identifiers or lookup keys (e.g., emails) and reject unexpected characters or patterns not required by the domain.

How teams detect issues like this

Detection typically involves both code-centric and behavior-centric approaches:

  • Static analysis: Configure rules to detect dynamic SQL construction patterns, such as string concatenation with request variables, particularly in authentication-related functions like confirm_logged_in.
  • Code review checklists: Require reviewers to examine login and session-related code for any non-parameterized queries and ensure all paths through student_trans.php use prepared statements.
  • Security-focused linters: Integrate tools that specifically flag known sink functions (e.g., raw query execution APIs) when they receive tainted input.
  • Database monitoring: Use database logs or monitoring tools to detect anomalous queries, including those with unexpected comment markers, stacked statements, or tautological WHERE clauses, which can indicate SQL injection attempts.
  • Policy enforcement in CI/CD: Enforce policies that block merges when high-risk patterns (raw SQL concatenation, missing binding parameters) are detected in critical components.

Sources

SourceLink
github.comgithub.com/yashpokharna2555/StudentManagementSystem/
github.comgithub.com/yashpokharna2555/StudentManagementSystem/issues/3
vuldb.comvuldb.com/submit/814001
vuldb.comvuldb.com/vuln/365451
vuldb.comvuldb.com/vuln/365451/cti

Frequently asked

questions

It can be exploited remotely by anyone who can reach the web interface and control the FIRST_NAME, Last_Name, or EMAIL parameters, assuming those values feed into the vulnerable login or session verification query.

Not necessarily. If unauthenticated endpoints accept or influence these parameters before authentication is enforced, an attacker may craft requests that trigger SQL injection without possessing a valid account.

Refactor all queries in confirm_logged_in (and related authentication functions) to use parameterized statements or an ORM, ensure that user attributes are never concatenated into SQL strings, and centralize validation of identity-related input.

Establish a standard data access layer that mandates prepared statements, enforce secure coding guidelines around SQL access in code reviews, and integrate static analysis or linters to automatically flag any direct string-based query construction using request data.

Find out what's already
exploitable in your codebase.