Summary
A SQL injection vulnerability in the Simple Online Food Ordering System allows attacker-controlled input in the order ID parameter to influence database queries. Because the affected administrator endpoint may be reachable remotely, an attacker could potentially read, modify, or disrupt application data.
Affected context
The vulnerability occurs in the administrative order-viewing functionality of SourceCodester Simple Online Food Ordering System 1.0, specifically the view_order.php endpoint. It becomes risky when the endpoint is reachable by an attacker and the ID parameter is incorporated into database operations without sufficient validation, parameterization, or query separation.
Exploit preconditions
- Attack surface: The remotely reachable administrative order-viewing endpoint
- Required access: Network access to the endpoint; authentication requirements may depend on deployment configuration
- Trigger point: Processing of the user-controlled
IDargument - Why exploitation is possible: Input may affect SQL query structure rather than being handled solely as data
Why this happens
The underlying bug is an improperly separated database query and input handling path. When an application builds SQL statements using untrusted request parameters, attacker-controlled content may alter the intended query logic. This is a direct instance of CWE-89, SQL Injection; CWE-74 is a broader classification covering improper neutralization of special elements in output used by another component.
Potential impact
- An attacker may retrieve sensitive records from the application database.
- An attacker could alter or delete order and customer data.
- An attacker may bypass intended database query restrictions.
- The application could experience data integrity loss or service disruption.
General mitigation guidance
Mitigation generally centers on ensuring that database inputs remain data and cannot become query syntax. Common defensive patterns include parameterized queries or prepared statements, strict server-side validation of identifier values, and minimizing database account privileges. Administrative routes may also benefit from secure-by-default authentication and authorization controls, while database errors and query details should not be exposed to clients.
How teams detect issues like this
Detection can include static analysis for string concatenation or formatting used to construct SQL queries from request parameters, code review of all database calls receiving web input, and dynamic testing of identifier parameters using benign injection test cases. Runtime monitoring may flag anomalous query errors, unusual database reads, or unexpected changes to order records. Automated code-review and application-security tools can assist with identifying unsafe query construction patterns.

