Summary
Online House Rental System 1.0 contains a SQL injection flaw in /manage_tenant.php where the ID parameter is processed unsafely.
A remote attacker can tamper with this parameter to inject arbitrary SQL, potentially accessing or modifying tenant and rental data without authorization.
Affected context
The vulnerability occurs in the Online House Rental System 1.0 within the /manage_tenant.php functionality when processing the ID argument.
It manifests in deployments where HTTP requests can reach this management endpoint and the application directly incorporates request parameters into SQL queries.
Typical at-risk contexts include shared hosting or internet-facing deployments where database credentials grant broad access to tenant, user, or rental records.
Exploit preconditions
- Attack surface: Web interface exposed via HTTP(S), specifically requests that reach /manage_tenant.php.
- Required access: Network access to the application; exploitation may not require authentication if the vulnerable code path is reachable anonymously.
- Trigger point: Submission of a crafted ID parameter in a GET or POST request that is concatenated into an SQL query.
- Why exploitation is possible: The application appears to interpolate the ID parameter into SQL without proper parameterization or robust input validation, allowing attacker-controlled input to alter query structure.
Why this happens
This issue is a classic instance of CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection).
The code likely builds SQL statements by string-concatenating the ID request parameter directly into query text, rather than using prepared statements or bound parameters.
In addition, inadequate neutralization of special characters and SQL metacharacters (related to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component) enables untrusted input to be interpreted as part of the SQL command, rather than as a data value.
At an abstract level, the design couples user-controlled data with query logic, trusting the client to provide syntactically safe input.
Potential impact
- May allow retrieval of sensitive tenant, user, and rental records from the database.
- Could enable modification or deletion of records, impacting integrity of rental contracts or payment data.
- May permit creation of new accounts or elevation of existing privileges if authentication or role data is stored in the same database.
- Could expose password hashes or other secrets stored in the database, facilitating further compromise.
- In some configurations, may allow execution of database-specific functions that impact availability or aid in lateral movement.
General mitigation guidance
Effective mitigation focuses on separating user input from query logic and reducing trust in client-supplied parameters:
- Prefer parameterized queries or prepared statements for all database interactions involving user input, including ID fields that may appear numeric.
- Introduce centralized data access layers that enforce binding of parameters and avoid ad-hoc query construction in page-level scripts.
- Apply strict server-side validation and normalization for identifier fields (e.g., enforcing integer types, ranges, and whitelists where applicable).
- Limit database accounts used by the application to the minimum privileges needed, avoiding schema-owner or superuser roles.
- Implement a secure coding standard for database access, discouraging dynamic SQL string concatenation and documenting approved patterns.
How teams detect issues like this
Detection typically combines code-centric and behavior-centric approaches:
- Static analysis: Configure scanners to flag dynamic SQL construction that includes HTTP parameters, especially in files like manage_tenant.php.
- Code review: Look for patterns where variables derived from $_GET, $_POST, or request objects are concatenated into SQL strings without binding; pay attention to ID-like parameters assumed to be "safe".
- Runtime monitoring: Use web application firewalls or logging middleware to identify suspicious query patterns or requests containing SQL metacharacters in the ID parameter.
- Database monitoring: Track anomalous queries, especially those with stacked commands or union-select patterns, and correlate them with incoming HTTP requests.

