Mysql Hacktricks Verified
Extract password hashes for offline cracking:
By default, MySQL listens on TCP port 3306. Rogue or hardened instances might use alternative ports like 33060 (MySQL X Protocol). Use Nmap to verify the service and its exact version banner: nmap -sV -sC -p 3306 Use code with caution. Banner Grabbing via Netcat
: Vulnerabilities like LOAD_FILE() can be used to read local files or initiate network requests (SSRF), provided the secure_file_priv global variable is properly configured. Security Recommendations mysql hacktricks verified
Start with a network sweep:
In some scenarios, manipulating DNS or host entries can redirect a victim's mysql-connector-j Extract password hashes for offline cracking: By default,
: Files can only be read from or written to this specific directory.
If the database user has the FILE privilege, you can read files straight from the underlying operating system infrastructure: UNION SELECT 1, LOAD_FILE('/etc/passwd'), 3, 4 -- - Use code with caution. Writing Web Shells Writing Web Shells | Goal | Best Method
| Goal | Best Method | Preconditions | |------|-------------|----------------| | Execute OS command | UDF sys_eval | FILE , write to plugin_dir, MySQL < 8.0 or custom compile | | Write shell | general_log file write | SUPER or file write perms | | Read files | LOAD_FILE() | FILE , file path within secure_file_priv or set to empty | | Dump hashes | SELECT authentication_string FROM mysql.user | SELECT on mysql.user | | Steal client files | Rogue MySQL server | Network access to victim's MySQL client | | Persistence | Hidden user + trigger | CREATE USER + TRIGGER |
/var/www/html/wp-config.php , config.php , db.php
for i in 1..500; do mysql -u root -p"wrong_password" -h -e "status" 2>/dev/null && break; done Use code with caution. 4. Privilege Escalation and System Commands
For a quick connection test: