MSSqlPwner
MSSqlPwner is an advanced pentesting tool for interacting with and compromising MSSQL servers. It supports authentication via clear-text passwords, NTLM hashes, and Kerberos tickets, enabling execution of custom commands through methods like custom assembly, xp_cmdshell, and sp_oacreate.
Description
MSSqlPwner is designed to seamlessly interact and pwn MSSQL servers, providing pentesters with versatile capabilities for database assessment and exploitation. It leverages impacket for authentication using clear-text passwords, NTLM hashes, and Kerberos tickets, allowing attackers to gain access to databases in various environments.
Use cases include executing custom commands via xp_cmdshell, Ole Automation Procedures (sp_oacreate), custom assembly injection, and more. The tool supports modules for enumeration, linked server manipulation, NTLM relay, direct queries, password retrieval, and interactive sessions, making it suitable for advanced post-authentication exploitation scenarios.
It is particularly useful in Windows domain environments where MSSQL servers are linked or chained, enabling recursive depth in impersonation and link traversal for broader network compromise.
How It Works
MSSqlPwner uses a TDS client implementation (SSL supported) based on impacket to connect to MSSQL servers on port 1433 by default. It authenticates with credentials, hashes (-hashes LMHASH:NTHASH), Kerberos (-k, -aesKey), or Windows auth (-windows-auth). Once connected, it executes modules like enumerate for server discovery, exec for command execution via xp_cmdshell or sp_oacreate, custom-asm and inject-custom-asm for assembly-based payloads, ntlm-relay for relay attacks, and linked server operations (get-link-server-list, set-link-server) with configurable max-link-depth and max-impersonation-depth for chaining exploits across servers.
Installation
sudo apt install mssqlpwnerFlags
Examples
mssqlpwner -hmssqlpwner target enumeratemssqlpwner target get-link-server-listmssqlpwner target execmssqlpwner target custom-asmmssqlpwner target ntlm-relaymssqlpwner target interactivemssqlpwner target -hashes LMHASH:NTHASH@target