Menu

THM Crypto Failures — Full Walkthrough
📰

THM Crypto Failures — Full Walkthrough

DEV Community: cybersecurity·Muhammad Saad·3 days ago
#XhdzXk4D
#devtocybersecurity#devto#dev#block#salt
Reading 0:00
15s threshold

Q1 (web flag): THM{ok_you_f0und_w3b_fl4g_6cbe2bc}

Q2 (encryption key): THM{Traditional_Own_Crypto_is_Always_Surprising!_and_this_hopefully_is_not_easy_to_crack_e41d20b5b0989cac65ed4a090cace944bf30e6d3ab88f9d447f52fd2140525b9}

A PHP app rolls its own "military-grade" cookie encryption: each 8-byte block of

user:User-Agent:ENC_SECRET_KEY is run through crypt() with a single 2-character salt, and the

results are concatenated. That is an ECB-style construction made of hashes, which gives us two

bugs:

Cut-and-paste auth bypass — guest: and admin: are the same length, so only the first block differs and we can compute it locally.

Byte-at-a-time key recovery — by changing the User-Agent length we can place each unknown key byte in a block where the other 7 bytes are known, then brute-force one character.

No SSH, no privesc — both answers come from port 80.

1.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.