Library - MySQL UDF
Last updated
Last updated
If the mysql server is running as root (or a different more privileged user) you can make it execute commands. For that, you need to use user defined functions. And to create a user defined you will need a library for the OS that is running mysql.
The malicious library to use can be found inside sqlmap and inside metasploit by doing locate "*lib_mysqludf_sys*"
. The .so
files are linux libraries and the .dll
are the Windows ones, choose the one you need.
If the following steps do not work, check the link above!
Run the script. You will see a dll (lib_mysqludf_sys_win_64.dll) created in local directory.
Connect to the Database
Wtih snap, run the following command.
Run dbeaver-ce and supply 'IP address' and a credential to connect.
Check the plugin directory. Run the following SQL script.
Check or/and create a directory to the plugin (C:\xampp\mysql\lib\plugin\)
Store lib_mysqludf_sys_win_64.dll there (C:\xampp\mysql\lib\plugin\lib_mysqludf_sys_win_64.dll)
Run the following SQL query to create a function.
Set up a listener.
Run the following SQL query to run a reverse shell.
Connected. This time, this user has a SeImpersonatePrivilege.