
MSDAT: Microsoft SQL Database Attacking Tool
| Quentin HARDY |
|---|
| [email protected] |
| [email protected] |
MSDAT (Microsoft SQL Database Attacking Tool) is an open source penetration testing tool that tests the security of Microsoft SQL Databases remotely.
Usage examples of MSDAT:
Tested on Microsof SQL database 2005, 2008, 2012, 2014, 2016 and 2019.
Thanks to MSDAT (Microsoft SQL Database Attacking Tool), you can (no exhaustive list):
Some dependancies must be installed in order to run MSDAT.
In ubuntu:
sudo apt-get install freetds-dev
or download freetds on http://www.freetds.org/
Install python dependencies:
sudo pip3 install -r requirements.txt
sudo activate-global-python-argcomplete
or
sudo pip3 install cython colorlog termcolor pymssql argparse python-libnmap
sudo pip3 install argcomplete && sudo activate-global-python-argcomplete
Add "use ntlmv2 = yes" in your freetds configuration file (ex: /etc/freetds/freetds.conf or /usr/local/etc/freetds.conf).
Example:
[global]
# TDS protocol version
tds version = 8.0
use ntlmv2 = yes
python3 msdat.py -h 2 ⨯
usage: msdat.py [-h] [--version]
{all,mssqlinfo,passwordguesser,passwordstealer,xpcmdshell,jobs,smbauthcapture,oleautomation,bulkopen,xpdirectory,trustworthype,userlikepwd,search,cleaner}
...
_ _ __ __ _ ___
| \_/ |/ _|| \ / \|_ _|
| \_/ |\_ \| o ) o || |
|_| |_||__/|__/|_n_||_|
------------------------------------------------------
_ _ __ __ _ ___
| \_/ |/ _| | \ / \ |_ _|
| \_/ |\_ \ | o ) o | | |
|_| |_||__/icrosoft |__/atabase |_n_|ttacking |_|ool
-------------------------------------------------------
By Quentin Hardy ([email protected])
positional arguments:
{all,mssqlinfo,passwordguesser,passwordstealer,xpcmdshell,jobs,smbauthcapture,oleautomation,bulkopen,xpdirectory,trustworthype,userlikepwd,search,cleaner}
Choose a main command
all to run all modules in order to know what it is possible to do
mssqlinfo to get information without authentication
passwordguesser to know valid credentials
passwordstealer to get hashed passowrds
xpcmdshell to get a shell
jobs to execute system commands
smbauthcapture to capture a SMB authentication
oleautomation to read/write file and execute system commands
bulkopen to read a file and scan ports
xpdirectory to list files/drives and to create directories
trustworthype to become sysadmin with the trustwothy database method
userlikepwd to try each MSSQL username stored in the DB like the corresponding pwd
search to search in column names
cleaner clean local traces
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
./msdat.py -h
./msdat.py all -h
You can know if a specific module can be used on a MSSQL server thanks to the --test-module option. This options is implemented in each mdat module.
The all module allows you to run all modules (depends on options that you have purchased).
python msdat.py all -s $SERVER