Critical SQL Injection in Sourcecodester Complaint Management Sys
The complaint-details.php endpoint in Complaint Management System v1.0 accepted a cid GET parameter and inserted it directly into an SQL query without validation or parameterisation. An unauthenticated attacker could manipulate the query to enumerate and exfiltrate the full database contents, including PII and credentials.
How an unauthenticated cid parameter exposed complete databases — what went wrong, how it was fixed, and how to avoid it.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The application interpolated the cid GET parameter directly into an SQL query without input validation or parameterised queries.
Impact
Any deployment that reused this tutorial code without fixing the SQL injection risked full database compromise and exposure of PII and credentials.
What the attacker needed
No authentication required; network access to complaint-details.php
The fix
The issue should be fixed by using parameterised queries or prepared statements, validating and casting input, applying least privilege, and disabling verbose SQL errors in production.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
SQL injection is when user input is placed directly into a database query, letting an attacker change the query's meaning. Here, the cid value from the URL was dropped straight into the WHERE clause, so a crafted value could make the database return other tables or rows. Because no login was needed, anyone who could reach the page could try to read the whole database.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.