Last updated: 15 Apr 24 09:26:40 (UTC)

HackTheBox Apocalypse 2024

HackTheBox Apocalypse 2024

HTB Apocalypse 2024 was a open event with over 12000 players in 5600 total teams

for this event my team classed 146/5600, our team was composed of 2 other players.

- Lawcky
- Oblivios
- Thaysan (MVP)

Was a fun experience and a good introduction to HTB’s CTF challenges

4c93dca93fc6b20c6d9b4e271a75be3e.png

Here is all my write-ups for that event, i kept only the ones i flagged with one exeption.


Crypto - primary knowledge

difficulty : very easy

fbcfe7cfd27d8c17f70fd7d8b5a4e53d.png

given values :

n = 144595784022187052238125262458232959109987136704231245881870735843030914418780422519197073054193003090872912033596512666042758783502695953159051463566278382720140120749528617388336646147072604310690631290350467553484062369903150007357049541933018919332888376075574412714397536728967816658337874664379646535347

e = 65537

c = 15114190905253542247495696649766224943647565245575793033722173362381895081574269185793855569028304967185492350704248662115269163914175084627211079781200695659317523835901228170250632843476020488370822347715086086989906717932813405479321939826364601353394090531331666739056025477042690259429336665430591623215

with ‘c’ beeing the message to decrypt

after reading the python code we understand that using 2 integers (n & e) the string m has been encrypted using the pow() math function

solution

final code :

50bcb6883d96afbea56b5637c63515b8.png

70810169710870607138579841519067639407045943514923980034716372388149402958694556292813866757327463621571327781524875159250427298200470290349260098816979513961424877205916891032682169108584143589722447303744878213639281455359132608063067801151889933261971455431441482052704077974781781967066974095696154090883

i checked and this value is false

next try :

8089419dd88bbb09ea863837131888a2.png

154494104126246428636989946273736411011334723383700225366857664731705373903436582850185452949938557

is the result

now we need to reverse the bytes_to_long() function to understand the output and get the FLAG

final code :

48ba41ba1bf0b1f0463ae3c6b65189b5.png

it worked !

4dd30828af3a901d7dda2129897170b7.png


Crypto - Dynastic

difficulty: very easy

f99adfe583244e646f3f261422682fa0.png

given message

DJF_CTA_SWYH_NPDKK_MBZ_QPHTIGPMZY_KRZSQE?!_ZL_CN_PGLIMCU_YU_KJODME_RYGZXL

the code basically switches each character,

- If the character is not alphabetic, it remains unchanged
- If the character is alphabetic, it maps the character to an index using to_identity_map, adds the index i to it, and then maps it back to a character using from_identity_map

it is pretty easy to reverse using the source code :

final code :

5b450303fcaa584165470feaefb0af46.png

it worked !

ac04ff2d31bb7175c8bdf50e083cddaf.png


Crypto - Makeshift

difficulty : Very Easy

bff50d0d0d518d77c50156142bc75478.png

Obfuscated Flag

!?}De!e3d_5n_nipaOw_3eTR3bt4{_THB

this basically switches characters’ places based on this part of the code’s sequence :

for i in range(0, len(flag), 3):
new_flag += flag[i+1]
new_flag += flag[i+2]
new_flag += flag[i]

reversing this is very easy we just have to reverse that same sequence

final code :

2518397a84ad6b2f94fde9f3623829c8.png

it worked !

db49c8cde300ef6de20123dfe7b6c9d7.png


Crypto - Iced Tea

difficulty: Easy

4f603ee32099d1bcd79d41f8b5cd6c2c.png

Given Values

Key : 850c1413787c389e0b34437a6828a1b2

Ciphertext : b36c62d96d9daaa90634242e1e6c76556d020de35f7a3b248ed71351cc3f3da97d4d8fd0ebc5c06a655eb57f2b250dcb2b39c8b2000297f635ce4a44110ec66596c50624d6ab582b2fd92228a21ad9eece4729e589aba644393f57736a0b870308ff00d778214f238056b8cf5721a843

final code :

ef0adc878f247ca322d92c1aa26e8b1b.png

it worked !

01f8beb617f26c377cf51e765b60740b.png


Crypto - Blunt #notflagged

difficulty: Easy

e3283c674c25347101361313f366c2c9.png

Given Values

p = 0xdd6cc28d
g = 0x83e21c05
A = 0xcfabb6dd
B = 0xc4a21ba9
ciphertext = b'\x94\x99\x01\xd1\xad\x95\xe0\x13\xb3\xacZj{\x97|z\x1a(&\xe8\x01\xe4Y\x08\xc4\xbeN\xcd\xb2*\xe6{'

it is AES CBC encryption method

in order to decrypt this we first need to get the encryption key

using the same code that was given to us with the data :

key code :

4048399bb59af9787171199d3cd4556a.png

5a2ae09e277f522ce67c80d874d1c3c1.png

the key was not right (my bad i could-have just extracted it directly inside the given code)

actual key : b'6\xa7\xe4N$\x13[x$\xf0\xf3\x16\x94\x18\x0c\x9c'

data :
AES Key: b'6\xa7\xe4N$\x13[x$\xf0\xf3\x16\x94\x18\x0c\x9c'

iv = b'\xc1V2\xe7\xed\xc7@8\xf9\\\xef\x80\xd7\x80L*'

ciphertext = b'\x94\x99\x01\xd1\xad\x95\xe0\x13\xb3\xacZj{\x97|z\x1a(&\xe8\x01\xe4Y\x08\xc4\xbeN\xcd\xb2*\xe6{'

someone else flagged it


Web - KORP Terminal

difficulty: Very Easy

bd9c6fb7c9aa6a8ecabe7e04aa6c25cf.png

It is a web login page, when incorrect it returns a 401 in a JSON format.

using this login bypass wordlist and the hydra tool:

dc3a63d46e46abf572e40cc9f706b547.png

the form returns 401 error message which makes hydra return this error:

16c4c00116bb432a6f8585b64ed0f7f4.png

i still fuzzed it with the errors and managed to get this error message from the site:

a4df4339dda8edeb9a7609713ce3e5d8.png

we now know its a mariaDB server

lets run sqlmap

sqlmap -r request --dbs --batch --ignore-code 401

f04f305964e5f6ffd335723b4e30e2ec.png

c95acefb43a3dd6adb4eb7628ad5680d.png

it worked !

8d589dfe718627c070db6a972f8503f6.png


Pwn - Writing on the walls

difficulty: easy

f2d5993414241137a597f147774a910a.png

we also got the executable.

after decompiling the binary we find :

19d60f506fc13c4191083344c578d2c2.png

the password is w3tpass  (space is a character), is read fully (8 char)
but the user input is read up to 7 char

 

after using ltrace tool on the local bin :

88a98fd30442b4866321ebbef98007fc.png

entered : w3tpas\n

compared : "w3tpas\3tpass ", "\3tpass "

we can overwrite the comparision we just need to find a perfect input that’ll make them match

when i entered a long string only of spaces :

552964eb563a65de8b2c76ddfd98f8e9.png

we need to remove the first inputed space while keeping the rest and it shall work

after sending a payload of only nullbytes \0 i was able to get the flag.

echo -e '\0\0\0\0\0\0\0\0\0\0\0' | nc 94.237.63.46 43527

74aafacecafc39988f2a081088abcf5d.png

forgot to screen the actual flag mb


Hardware - BunnyPass #annoying

difficulty : easy
This challenge was just a click everywhere type of challenge, no real goal nor path to folow just a admin:admin service login and searching for the flag

once logged in we needed to go to queues

8c45b40c61ccc3ee9cd919b7ee67c4e3.png

when we go to the queues, select the factory_idle status and check for message status, you need to select ACK messages and look for the last one.

a74fa180b53fcc3bf24dc1e658b3bc3b.png

HTB{th3_hunt3d_b3c0m3s_th3_hunt3r}


Hardware - Rids

c9072cafcf29878a803f2aea0ec8b0d3.png

source code :

87a480797a0ff6a7cd347f2050cd2279.png

we need to read the memory of the W25Q128 chip.

after some research i find that the command for that is 0x03

lets craft a JSON payload since the code reads JSON.

dd20f936e97f8729d2fd7178efddf5ae.png

1321ba0146d48a59ea15b9020a5f7ece.png

after decoding as ASCII characters : HTB{m3m02135_57023_53c2375_f02_3v32y0n3_70_533!@}