HTB Santa CTF 2022

Toy Workshop [ Web ]

image

Homepage

image
  • The homepage had nothing intresting

Source Code

  • /web_toy_workshop/challenge/routes/index.js

  • So we have to send our query ( json data ) in /api/submit

  • It's a XSS

Solution

  • I used python3 http server with ngrok ( appended the link in )

Flag

  • After you sent the the POST request to the website, It will use the query and store it in it's database, and retrive the flag ( cookie ) for us

  • Start the python3 server , use ngrok , update the query

image

Common Mistake [ Crypto ]

image

Challenge files

  • Hex values

  • Integer values

Solution

  • The encryption flag has 2 modulus with same flag ( message )

  • The attack used to get the flag is Common Modulus Attack

  • Learn more about this attack : https://infosecwriteups.com/rsa-attacks-common-modulus-7bdb34f331a5

Solve.py

Giftwrap [ Reversing ]

image

This is day 2 challenge

Binary Info

  • by using strings we get to know the binary is compressed by UPX

  • What is UPX ?

UPX achieves an excellent compression ratio and offers very fast decompression. Your executables suffer no memory overhead or other drawbacks for most of the formats supported, because of in-place decompression

Decompressing the binary

Analyzing Binary

  • The binary is a typical crackme challenge

  • Let's boot up the binary in ghidra

Main function

  • Each character of the user input is xored with 0xf3

  • After xoring the value ( xored input ) is compared with CHECK variable

Solution

  • Let's the data stored in CHECK variable

  • Let's store the CHECK values locally and xor it with 0xf3 to get flag

solve.py

Flag

Mr Snowy [ Pwn ]

image

Solution

Checksec

image
  • The NX is enabled which makes the stack unexecutabble

  • THe PIE is disabled so we dont have to find the address

  • The binary is just a simple bufferoverflow

Functions of the binary has

image

Main function

image
  • The main funciton after executing calls 3 functions , let's checkout the snowman function

It's quiet difficult to do the task only with asm , I've used Ghidra which has a feature of converting ( almost same ) asm back to the original C code

Snowman Function

  • This code is basically the first part image

  • When option 1 is selected it calls antoher funtion : investigate()

Inverstigate Function

There's another function named deactivate camera

Overflow

  • So we basically have to find the offset in investigation function, overflow it and set the $rip ( Instruction pointter ) to deactivate_camera function

  • Find OFFSET

  • Set breakpoint at exit in investigate() [ address of exit : 0x00000000004013ea ] and create a pattern to find offset

image
  • Run the program , give option 1 to go in investigate function

image
  • This is how stack will look when we hit our breakpoint

image
image
  • So the OFFSET is 72

Exploit

  • Send buffer of 72 characters

  • Add the addresss of deactivate camera function

  • Send the payload and get the flag

Solve.py

Flag

image

baby APT [ Forensics ]

image

Note

  • This is unintended way to do the challenge

Solution

  • Strings command showed some HTTP requets

image
  • URL encoded

  • URL decoded

Flag

Last updated