Severity:

HIGH RISK

(7.3)

SQL Injection in Online Doctor Appointment System

CVE-2026-3980

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Data Exposure and Modification 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

The Online Doctor Appointment System 1.0 contains a SQL injection vulnerability in the /admin/patient_action.php endpoint via the patient_id parameter.

A remote attacker can manipulate this parameter to inject arbitrary SQL, potentially accessing or modifying patient and administrative data without authorization.

Affected context

This vulnerability occurs in the administrative portion of the Online Doctor Appointment System 1.0, specifically within the /admin/patient_action.php script.

It manifests when the patient_id parameter is taken from HTTP requests and interpolated into database queries without robust input validation or parameterization.

The issue is present in deployments where the application directly constructs SQL statements using request parameters and where the database account has broad access to patient or administrative tables.

Exploit preconditions

  • Attack surface: HTTP interface of the admin module, reachable over the network.
  • Required access: Ability to send crafted requests to /admin/patient_action.php (with whatever level of access is needed to reach that endpoint in a given deployment).
  • Trigger point: Handling of the patient_id parameter when building SQL queries in patient_action.php.
  • Why exploitation is possible: The application appears to concatenate the patient_id value directly into SQL statements without using prepared statements or adequate escaping, allowing attacker-controlled input to alter the structure of the query.

Why this happens

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

Instead of using parameterized queries, the code likely interpolates the patient_id parameter directly into a SQL statement string, treating external input as trusted and allowing it to influence the command structure.

CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component) is also relevant because the untrusted input is propagated into a downstream SQL interpreter without appropriate sanitization or context-aware encoding.

Potential impact

  • Access to sensitive patient records and associated personal or medical information.
  • Unauthorized modification or deletion of patient or appointment data.
  • Creation of arbitrary administrative entries or manipulation of user accounts, depending on schema and privileges.
  • Extraction of application configuration data stored in the database, which could aid further compromise.
  • Potential full compromise of the underlying database if the connected account has extensive privileges.

General mitigation guidance

Mitigation efforts typically focus on eliminating direct string concatenation in SQL and reducing trust in externally supplied data:

  • Adopt parameterized queries or prepared statements for all database interactions involving user-controlled input, including patient_id.
  • Apply strict server-side validation and normalization for identifier fields, enforcing expected formats (e.g., numeric-only IDs) before they reach the database layer.
  • Implement least-privilege database accounts so that the application can only access the specific tables and operations it requires.
  • Introduce centralized data access layers that encapsulate query construction and enforce safe query building patterns by default.
  • Consider defense-in-depth measures such as query allowlists or ORM frameworks that generate SQL in a controlled manner.

How teams detect issues like this

Effective detection typically combines code-centric and behavior-centric approaches:

  • Use static application security testing (SAST) tools or linters configured to flag dynamic SQL construction and unparameterized queries, especially around request parameters like patient_id.
  • Incorporate manual code review checklists that highlight high-risk patterns such as string concatenation in SQL and direct use of $_GET/$_POST variables in query strings.
  • Enable application and database logging to capture anomalous query patterns (e.g., unexpected operators, UNION clauses, or comment markers) that may indicate injection attempts.
  • Apply web application firewalls (WAF) or API gateways with rules tuned to detect and block common SQL injection payload patterns, while treating them as a supplement, not a primary control.

Sources

SourceLink
github.comgithub.com/vasable/automatic-parakeet/issues/2
itsourcecode.comitsourcecode.com/
vuldb.comvuldb.com/?ctiid.350415
vuldb.comvuldb.com/?id.350415
vuldb.comvuldb.com/?submit.769612

Frequently asked

questions

Yes. The vulnerable endpoint is reachable over the network, and an attacker can send crafted HTTP requests that manipulate the patient_id parameter to inject SQL, subject to whatever access controls are in place for the admin area.

The attacker must be able to reach /admin/patient_action.php. In some deployments this may require authenticated admin or staff access, while in others misconfiguration might expose the endpoint more broadly. The vulnerability itself does not inherently require local access.

The most robust approach is to replace any dynamically constructed SQL involving patient_id with parameterized queries or prepared statements, combined with strict server-side validation of ID fields. This removes the ability of user-controlled input to alter the SQL structure.

Standardize on secure data access patterns across the application—such as using an ORM or a vetted data access layer that enforces parameterization—add automated static analysis checks for unsafe query construction, and enforce code review guidelines that prohibit direct concatenation of untrusted input into SQL.

Find out what's already
exploitable in your codebase.