MSSQL (Microsoft SQL Server) - Port 1433
Master pentesting MSSQL on port 1433 with VeryLazyTech’s guide—exploits, tips, and more!
Become VeryLazyTech member! 🎁
Follow us on:
✖ Twitter @VeryLazyTech.
👾 Github @VeryLazyTech.
📜 Medium @VeryLazyTech.
📺 YouTube @VeryLazyTech.
📩 Telegram @VeryLazyTech.
🕵️♂️ My Site @VeryLazyTech.
Visit our shop for e-books and courses. 📚
Basic info
MSSQL is designed to store and retrieve data as requested by applications. Its features include:
Default Port: TCP/1433 for standard communication.
Authentication Modes:
Windows Authentication
Mixed Mode (Windows and SQL Server Authentication)
Common Uses:
Data storage for web applications, enterprise systems, and reporting services.
While MSSQL provides robust security features, misconfigurations, weak authentication, and unpatched vulnerabilities can expose it to attacks.
Banner Grabbing
Banner grabbing helps identify the MSSQL server version, authentication modes, and potential vulnerabilities.
Tools and Commands:
Telnet (basic connection test):
Nmap:
Example Output:
Metasploit Framework:
Authentication Bypass Techniques
Null Authentication
If SQL Server is misconfigured, it may allow unauthenticated access:
Testing Null Authentication:
MSSQL Brute Force Attacks
Brute force attacks can help identify weak or default credentials.
Hydra:
Medusa:
Metasploit Auxiliary Module:
MSSQL Enumeration
Key Enumeration Techniques:
Identify Databases:
List Users:
Server Information:
Extract Privileges:
Automated Enumeration:
Metasploit:
Exploitation Techniques
Command Execution via xp_cmdshell
xp_cmdshell allows executing OS commands from SQL Server.
Enable xp_cmdshell:
Execute Commands:
Privilege Escalation
Use known vulnerabilities or misconfigurations to escalate privileges:
CVE-2020-0618 (SQL Reporting Services RCE): Exploit unpatched SQL Reporting Services.
Metasploit Module for Privilege Escalation:
Execute OS Commands
Note that in order to be able to execute commands it's not only necessary to have xp_cmdshell enabled, but also have the EXECUTE permission on the xp_cmdshell stored procedure. You can get who (except sysadmins) can use xp_cmdshell with:
Learn & practice For the Bug Bounty
Last updated
Was this helpful?