Summary
A SQL injection vulnerability in the Hotel Management System allows an attacker to manipulate the ID parameter in /admin/roomdelete.php, causing untrusted input to be embedded directly into database queries.
When reachable over the network, this flaw can enable remote attackers to exfiltrate or modify data and potentially compromise the underlying application or database.
Affected context
This vulnerability occurs in the administrative room deletion functionality exposed at /admin/roomdelete.php in the Hotel Management System.
It manifests when user-controlled data from the ID parameter is passed into database queries without robust validation, sanitization, or parameterization.
Installations where the admin interface is reachable over a network and not adequately access-controlled are especially exposed, but the risk level depends on how the admin panel is deployed and protected.
Exploit preconditions
- Attack surface: HTTP(S) endpoint
/admin/roomdelete.php - Required access: Ability to send crafted requests to the admin endpoint (with or without authentication, depending on deployment and access controls)
- Trigger point: The
IDrequest parameter is consumed by server-side code to construct and execute a SQL query - Why exploitation is possible: The
IDvalue is incorporated into SQL statements without proper parameterization or escaping, enabling attackers to alter the structure of the executed query
Why this happens
The underlying issue is the direct concatenation or interpolation of untrusted input into SQL queries, instead of using prepared statements or safe query builders.
This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), and overlaps with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, because unsafe data is passed from the web layer into the database engine.
Abstractly, the pattern is: taking a request parameter (ID) at face value, assuming it is benign, and embedding it into a query string where SQL metacharacters are interpreted as part of the command rather than as data.
Potential impact
- Attackers may read, enumerate, or exfiltrate sensitive data from the database
- Attackers may modify or delete records (e.g., room records, bookings, or user data)
- Attackers may create or escalate application user accounts, depending on schema
- Attackers could tamper with hotel operational data, impacting availability and integrity
- In certain environments, attackers might leverage database features to execute system-level commands or pivot further into the infrastructure
General mitigation guidance
Effective mitigation centers on treating all incoming parameters as untrusted and decoupling them from query structure:
- Use parameterized queries or prepared statements for all database access, including simple lookups and delete operations
- Employ a safe database abstraction layer or ORM that separates SQL logic from user data
- Constrain and validate the
IDparameter according to strict expectations (e.g., numeric-only, length bounds) before it reaches the data-access layer - Apply least-privilege principles to the database account used by the application, limiting its ability to perform destructive or administrative operations
- Consolidate data-access logic in well-reviewed modules rather than building ad-hoc SQL strings in UI-facing scripts
How teams detect issues like this
Organizations can detect this and similar SQL injection risks through multiple layers:
- Static analysis: Scan the codebase for dynamic SQL string construction that includes request parameters (e.g.,
$_GET['ID'],$_POST['ID']) without parameter binding - Code review: Flag any database calls that rely on string concatenation, interpolation, or unsanitized variables in WHERE, DELETE, or UPDATE clauses
- Runtime testing: Use security testing tools (DAST) or targeted penetration tests to send crafted payloads in the
IDparameter and monitor for SQL errors or anomalous responses - Policy enforcement: Establish coding standards that mandate prepared statements and centralize database access, and enforce them via CI-integrated linters or security scanners

