HTB Cyber Apocalypse 2023 Writeups
Pwn
Initialise Connection
Summary
This challenge simply wants us to connect to the socket and send 1
Solution
|
|
Flag
HTB{g3t_r34dy_f0r_s0m3_pwn}
Getting Started
Summary
For this challenge we are given a binary and a template for an exploit script.
The binary gives us an explanation of the stack in a buffer overflow and wants us to overwrite some variable on the stack.
Solution
We can fill the buffer with:
|
|
This command runs a python line to print 100 A characters and pipes the output to the socket connection.
Flag
HTB{b0f_s33m5_3z_r1ght?}
Labyrinth
Summary
This challenge is a ret2win buffer overflow. Meaning we have a function that will print the flag but it is never called in the main function, so we have to overwrite the return pointer with the address of the win function to get the flag.
Solution
Opening the binary in ghidra we can see that the correct door is 69
|
|
Then it takes another input using fgets()
but does not do any checks and prints [-] YOU FAILED TO ESCAPE
and exists. So obviously we are going to need to supply a payload to jumo to the escape_plan()
function.
To find the offset I used a GDB with GEF to create a pattern of 100 bytes:
|
|
Then I set a breakpoint at the return instruction of main:
|
|
Then I run the program and enter 69
to pass the first door, then enter the pattern and the program stops at our breakpoint. At the top of the stack we see the 8 bytes that are going to be loaded into rip
when the return instruction is executed.
|
|
We use GEF to find the offset:
|
|
The offset is 56
. Now we can write an exploit to point the return to the address of escape_plan
|
|
Flag
HTB{3sc4p3_fr0m_4b0v3}
Web
Trapped Source
Summary
Web challenge that is just locked keypad that needs a code to open.
Solution
All we had to do here is hit ctrl+u
to inspect the html source and there we find
|
|
We enter that code and we get the flag
Flag
HTB{V13w_50urc3_c4n_b3_u53ful!!!}
Gunhead
Summary
For this challenge we have a web interface for a robot along with the php source code used to build it. We find a command injection vulnerability in the ping
command in the robots console.
Solution
We are given the source code for this php application, and if we inspect the code for the console tab for the robot, more specifically the ping function, we find that it calls shell_exec()
without any sanitization which allows us to inject commands.
|
|
Flag
HTB{4lw4y5_54n1t1z3_u53r_1nput!!!}
Passman
Summary
We are given a password manager app with the source code. The app uses graphql to handle data and we find a mutation UpdatePassword
that does not check the session cookie to authenticate user and we can use it change the password of the admin user.
Solution
I actually forgot I have the source code for this challenge and I was inspecting the network requests with Burpsuite and I saw that it sends post requests to /graphql
to fetch data. I then found out that you can dump the graphql schema using introspection. I know that graphql leaves authentication up to the developer to implement so I tried to change the admin password with my current user and it was successful. Here is the curl command to change the admin password:
|
|
It just sends a mutation query of type UpdatePassword
and the user is admin
and password is b
.
And now we can login as admin and get the flag
Flag
HTB{1d0r5_4r3_s1mpl3_4nd_1mp4ctful!!}