SQL injection vulnerability in post.php in XZero Community Classifieds 4.95.11 and earlier allows remote attackers to execute arbitrary SQL commands via the subcatid parameter to index.php.
XZero Community Classifieds 4.95.11 and earlier are vulnerable to a critical SQL injection flaw, allowing attackers to execute arbitrary SQL commands. This vulnerability, exploitable via the subcatid parameter, could lead to complete database compromise, including data theft and server takeover.
Step 1: Payload Delivery: The attacker crafts a malicious SQL injection payload, designed to manipulate the database query. This payload is embedded within the subcatid parameter of a request to index.php (which then calls post.php).
Step 2: Request Submission: The attacker submits the crafted request to the vulnerable web server.
Step 3: Parameter Processing: The index.php script receives the request and passes the subcatid parameter to post.php.
Step 4: Query Construction: The post.php script constructs an SQL query, incorporating the attacker-controlled subcatid parameter directly into the query string, without proper sanitization or escaping.
Step 5: Query Execution: The database server executes the maliciously crafted SQL query. The injected SQL code is interpreted and executed by the database.
Step 6: Data Retrieval/Manipulation: Depending on the injected payload, the attacker can retrieve sensitive data (e.g., usernames, passwords), modify database contents, or potentially gain remote code execution on the server.
The vulnerability stems from a lack of proper input validation and sanitization of the subcatid parameter within the post.php script. Specifically, the application fails to adequately filter user-supplied input before incorporating it into SQL queries. This allows an attacker to inject malicious SQL code, which is then executed by the database server. The root cause is the direct concatenation of user-controlled data into SQL statements without any form of escaping or parameterized queries, leading to a classic SQL injection vulnerability. The absence of prepared statements or input validation allows for the manipulation of SQL queries, enabling attackers to bypass authentication, retrieve sensitive data, modify database contents, or even execute arbitrary commands on the server.