MySQL
1) Nmap scan
nmap -sV -p 3306 --script "mysql-audit,mysql-databases,mysql-dump-hashes,mysql-empty-password,mysql-enum,mysql-info,mysql-query,mysql-users,mysql-variables,mysql-vuln-cve2012-2122" IP2) Netexec
netexec mysql -d DATABASE -u USERNAME -p PASSWORD -x "SHOW DATABASES;" IP3) Brute force
hydra -l USER -P PASSWORD_LIST -s 3306 IP mysql4) Login
mysql -h IP -u USER -p DATABASEmysql -h IP -u USER -p --skip_ssl5) Database Usage
SHOW DATABASES;
USE <database_name>;
SHOW TABLES;
DESCRIBE <table_name>;
SELECT * FROM <table_name>;6) Exploitation
7) Check System permissions of the DB User
1. Copy an already existing file from Windows to another location
2. Check permissions of the new written file
3. An output like the one below indicates that the file was written with admin privileges, therefore the DB user has admin privilege (consider WerTrigger exploit for escalation).
8) Command execution via User-Defined Functions (UDFs)
1. Upload UDF library
2. Create the UDF to execute system commands
3. Execute commands
4. Reverse shell
8.1) Compile your own .so for UDF
Last updated