GateKeeper

Date: 22, July, 2021

Author: Dhilip Sanjay S


Click Herearrow-up-right to go to the TryHackMe room.

Enumeration

Nmap

  • Initial Scan

$ nmap 10.10.138.153
Starting Nmap 7.91 ( https://nmap.org ) at 2021-07-22 11:21 IST
Nmap scan report for 10.10.138.153
Host is up (0.22s latency).
Not shown: 990 closed ports
PORT      STATE SERVICE
135/tcp   open  msrpc
139/tcp   open  netbios-ssn
445/tcp   open  microsoft-ds
3389/tcp  open  ms-wbt-server
31337/tcp open  Elite
49152/tcp open  unknown
49153/tcp open  unknown
49154/tcp open  unknown
49155/tcp open  unknown
49161/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 24.35 seconds
  • Services Scan

SMB Enumeration


Download gatekeeper.exe

  • Download gatekeeper.exe from the SMB share:


Buffer Overflow

Fuzzing

  • By fuzzing we find that the crash occurs at around 200 bytes:

Finding the offset

  • Create pattern of 500 bytes using pattern_create.rb

  • EIP value: 39654138

  • Find the exact offset using pattern_offset.rb:

Overwriting EIP

  • We can successfully control the EIP value:

EIP

Finding Bad chars

  • The bad chars are \x00\x0a.

  • Use mona or find it manually!

Finding Right Module

  • Use !mona modules to find the right module (no memory protection)

  • Find the JMP ESP address using the command !mona jmp -r esp -m gatekeeper.exe -cpb '\x00\x0a'

EIP

Generating shell code

  • Generate shell code using msfvenom:

Final exploit


User Flag

  • Run the exploit to get reverse shell:

  • User Flag


Privilege Escalation

Dump Firefox credentials

  • Dumping Firefox credentials using post/multi/gather/firefox_creds

Firefox Decrypt

  • Rename the dumped files

  • Run the firefox_decrypt.py to obtain the password


Root Flag

  • Login using the credentials found (use psexec):


References

Last updated