TCP: MSSQL - 1433

Initial Connection

Connect on local machine

sqsh -S <Target IP Address> -U .\\<Username> -P <Password> -D <Database Name>

OR

impacket-mssqlclient [<Domain Name>/]<Username>:<Password>@<Target IP Address> -local-auth

Connect to machine

sqsh -S <Target IP Address> -U <Username> -P "<Password>"

OR

impacket-mssqlclient [<Domain Name>/]<Username>:<Password>@<Target IP Address> -windows-auth

Reverse Shell

On Machine

  1. Initiate connection

If using sqsh, "GO" needs to be entered after every query to send it

  1. Use the master databse

  1. Get users that can run xp_cmdshell

  1. Check if xp_cmdshell is enabled

  1. Enable advanced options as it is needed for xp_cmdshell

  1. Apply changes

  1. Enable xp_cmdshell

  1. Apply changes

  1. Run command

On SQLi vulnerability

  1. Enable advanced options as it is needed for xp_cmdshell

  1. Apply changes

  1. Enable xp_cmdshell

  1. Apply changes

  1. Run commands

One Liner

Raw:

URL Encoded:

Bruteforce

Last updated