TCP 3306: MySQL

MySQL is an open-source relational database management system. Its name is a combination of "My", the name of co-founder Michael Widenius's daughter, and "SQL", the abbreviation for Structured Query Language.

-- Wikipedia

Connection

sudo mysql -u <user>
use <db>;
select * from mysql_func;

Remote

mysql -u <user> -p <password> -h <ip> -P <port>

Enumeration

Check permissions

show Grants;

Show "env"

select @@hostname, @@tmpdir, @@version, @@version_compile_machine, @@plugin_dir;

Misc

Read file from file system

User defined functions (UDF)

Run C code and allows basically everything (system calls, etc.)

Compile exploit

Create function in MySQL

  1. Access the database service and select the database to use.

  1. Copy/create the raptor_udf2.so in the directory specified in the plugin_dir variable.

  1. Create the User Defined Function.

  1. Test that the UDF works correctly.

Get root shell (using setuid)

Last updated