Severity:

HIGH RISK

(7.3)

SQL Injection in SourceCodester Online Catering Reservation

CVE-2026-4615

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

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

SourceCodester Online Catering Reservation 1.0 contains a SQL injection vulnerability in /search.php via the rcode parameter, where user-controlled input is incorporated into database queries without proper safeguards.

A remote attacker can manipulate this parameter to alter the underlying SQL query, potentially accessing, modifying, or deleting reservation-related data and other sensitive information stored in the application database.

Affected context

The vulnerability occurs in the web-facing search functionality implemented in /search.php, where the rcode argument is used to drive database lookups.

It is typically present when application code directly interpolates HTTP parameters into SQL statements without consistent input validation, parameterization, or output encoding.

Any deployment that exposes this script over a network and uses it to query a backend database is at risk when user input from the rcode parameter is trusted as-is.

Exploit preconditions

  • Attack surface: Public web interface of the Online Catering Reservation application (HTTP request to /search.php).
  • Required access: Network access to the web application; no prior authentication may be required if the search feature is publicly accessible.
  • Trigger point: Supplying crafted values in the rcode parameter of a request to /search.php so that they are incorporated into a SQL query.
  • Why exploitation is possible: The application constructs SQL queries using untrusted input from rcode without employing parameterized queries or robust validation, allowing attackers to inject additional SQL fragments.

Why this happens

This issue stems from building SQL statements by concatenating or interpolating raw request parameters into query strings, which is the core pattern underlying CWE-89: SQL Injection.

Instead of binding user input as typed, non-executable parameters, the application appears to treat the rcode value as part of the query logic itself, allowing attackers to modify the structure and semantics of the executed SQL.

The associated CWE-74: Injection reflects the broader class of vulnerabilities where untrusted data is injected into interpreters (in this case, an SQL engine) without proper neutralization.

Potential impact

  • May allow disclosure of reservation records and associated customer details.
  • Could enable modification or deletion of data, including reservations, menus, or user accounts.
  • Can be used to bypass application-level authorization and access data belonging to other users.
  • Might permit creation of new privileged accounts or alteration of authentication data if the user table is exposed.
  • In some configurations, could lead to further compromise of the underlying system via database-specific features (e.g., writing files, invoking extended procedures).

General mitigation guidance

Effective mitigation focuses on removing the application's ability to treat user input as executable SQL:

  • Use parameterized queries or prepared statements for all database interactions involving user-supplied data, including the rcode parameter.
  • Centralize and enforce strict input validation for search and lookup parameters, reducing input to expected formats (e.g., specific codes or identifiers).
  • Apply least-privilege to database accounts so that the application can only perform the minimal set of operations required (e.g., read-only where feasible).
  • Introduce a data access layer or ORM that defaults to safe query construction patterns, minimizing the need to build raw SQL strings.
  • Establish defensive coding guidelines that explicitly prohibit dynamic query construction with direct string concatenation.

How teams detect issues like this

Organizations can identify and monitor for SQL injection risks in similar applications by:

  • Running static application security testing (SAST) tools configured to flag dynamic SQL construction that includes HTTP parameters without parameterization.
  • Performing targeted code reviews of database access layers, focusing on search-related functionality and any direct uses of request variables in SQL.
  • Employing dynamic application security testing (DAST) or web vulnerability scanners that attempt SQL injection payloads on query parameters such as rcode.
  • Logging and analyzing database and web server activity for signs of anomalous query patterns, such as unexpected syntax, always-true conditions, or abrupt increases in query errors.

Sources

SourceLink
github.comgithub.com/WHOAMI-xiaoyu/CVE/blob/main/CVE_5.md
vuldb.comvuldb.com/?ctiid.352479
vuldb.comvuldb.com/?id.352479
vuldb.comvuldb.com/?submit.775735
sourcecodester.comsourcecodester.com/

Frequently asked

questions

Yes. Because the vulnerable functionality is exposed via HTTP requests to /search.php, a remote attacker with network access to the application can attempt exploitation by manipulating the rcode parameter.

It depends on how the application is deployed. If the search functionality is publicly accessible, no authentication is required; if it is behind a login, an attacker would first need valid credentials or another way to reach the endpoint.

Refactor the affected code so that all SQL queries use parameterized statements or prepared queries, ensuring that user-supplied values (such as rcode) are always treated as data rather than executable query fragments, supplemented by strict input validation.

Adopt a secure coding standard that mandates parameterized queries, introduce automated checks (SAST/CI rules) for dynamic SQL construction, and perform regular security-focused code reviews and testing on all user-input-driven database operations.

Find out what's already
exploitable in your codebase.