Back to Findings

SQL Injection in Search Endpoint

CriticalOpenCVSS 3.1: 9.8CWE-89
TWP-001Tamkeen Web Portal9 months ago
Description

The `/api/search` endpoint is vulnerable to SQL injection through the `q` parameter. An attacker can extract sensitive data from the database by injecting SQL queries through the search functionality.

The parameter is directly concatenated into the SQL query without parameterization or sanitization.

Proof of Concept
```
GET /api/search?q=' OR 1=1-- HTTP/1.1
Host: app.tamkeen.sa

Response: 200 OK (returns all records)
```
Remediation

Use parameterized queries or prepared statements. Never concatenate user input directly into SQL queries. Implement input validation and use an ORM where possible.

Comments (2)
AK
Ahmed K.9 months ago

Confirmed exploitable in production. The entire users table can be extracted.

AK
Ahmed K.9 months ago

Recommend immediate patching as this is actively exploitable without authentication.

Details
Affected Assethttps://app.tamkeen.sa/api/search
CVSS Score9.8
CVSS VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CWECWE-89