Severity:

HIGH RISK

(7.3)

SQL Injection in login.php of Simple Doctors Appointment

CVE-2026-5179

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Authentication Bypass and Data Compromise

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 flaw in the admin login functionality of SourceCodester Simple Doctors Appointment System 1.0 allows untrusted user input in the Username field to be embedded directly into backend SQL queries.

When reachable over the network, this can let a remote attacker bypass authentication and potentially access or modify application data.

Affected context

This vulnerability occurs in the administrative login interface at /admin/login.php within the Simple Doctors Appointment System 1.0 application.

It is relevant in deployments where the admin panel is exposed over a network and the login code constructs SQL queries using raw Username input without proper parameterization or robust query sanitization.

The risk increases when the application connects to a database account with broad privileges or when the admin panel is directly internet-facing.

Exploit preconditions

  • Attack surface: HTTP(S) endpoint /admin/login.php of the Simple Doctors Appointment System.
  • Required access: Network access to the web interface; no prior authentication is required to reach the login form.
  • Trigger point: Submission of crafted values in the Username (and potentially Password) fields of the admin login request.
  • Why exploitation is possible: The backend embeds user-supplied Username data directly into SQL statements without using prepared statements or proper escaping, enabling attackers to modify the structure of the query.

Why this happens

The issue stems from constructing SQL queries by concatenating or interpolating user-controlled data into query strings, rather than treating it as data-only parameters.

This corresponds to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), and is related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.

In this pattern, characters like quotes, comment markers, or operators in the Username field are not safely neutralized, allowing an attacker to prematurely terminate or extend SQL clauses and influence authentication logic or data retrieval.

Potential impact

  • Bypass of administrative authentication, allowing an attacker to log in as an admin without valid credentials.
  • Unauthorized viewing of sensitive data stored in the database (e.g., patient information, appointments, user accounts).
  • Modification or deletion of application data, impacting integrity and availability of appointment records.
  • Creation of new administrative accounts or elevation of privileges for existing accounts.
  • Potential pivot to further attacks if database credentials or system information are exposed.

General mitigation guidance

Effective mitigation focuses on eliminating direct string-based query construction and reducing the trust placed in login inputs:

  • Use parameterized queries or prepared statements for all database access so that input is always treated as data, not executable SQL.
  • Apply strict server-side validation and normalization for login fields, limiting the accepted character set for usernames and rejecting unexpected patterns.
  • Centralize database access through a data access layer that prohibits ad-hoc raw SQL concatenation.
  • Configure database accounts with least privilege, ensuring the application user has only the minimal rights necessary.
  • Place administrative interfaces behind additional access controls (e.g., VPN, IP allowlists) to narrow the exposure of sensitive endpoints.

How teams detect issues like this

Detection typically combines code-centric and behavior-centric approaches:

  • Static analysis: Scan PHP code for SQL construction that concatenates $_POST, $_GET, or other user inputs into query strings, especially in authentication routines.
  • Code review: Look for mysql_*, mysqli_query, or PDO-style calls where variables appear directly inside SQL strings instead of bound parameters; pay particular attention to login, search, and reporting features.
  • Dynamic testing: Use automated or manual security testing tools (DAST) to probe the login endpoint with SQL metacharacters and observe for errors, anomalies, or authentication bypass.
  • Policy enforcement: Adopt coding standards that require prepared statements for all database interactions and enforce them via pre-commit hooks or CI checks with linters and SAST tools.

Sources

SourceLink
github.comgithub.com/dyh1213-wq/cve/issues/3
vuldb.comvuldb.com/submit/780353
vuldb.comvuldb.com/vuln/354247
vuldb.comvuldb.com/vuln/354247/cti
sourcecodester.comsourcecodester.com/

Frequently asked

questions

Yes. As long as the /admin/login.php endpoint is reachable over the network, a remote attacker can attempt to exploit the SQL injection through crafted login requests.

No. The vulnerable parameter is in the public-facing admin login form, so no prior authentication is required to send malicious Username values.

Refactor all affected login queries to use prepared statements with bound parameters and remove any direct concatenation of user-supplied data into SQL strings, while also tightening input validation on authentication fields.

Standardize on secure database access patterns (parameterized queries only), enforce them through code reviews and automated scanners, and adopt a secure coding guideline that treats all external input as untrusted and subject to strict validation before it reaches query-building code.

Find out what's already
exploitable in your codebase.