Emdee five for life
The site serves a random string inside an
and demands its MD5 back before it expires, tied to the same session cookie. Solving it by hand is impossible — the real skill being tested is turning the whole read → hash → resend cycle into one reliable curl script.
Challenge overview
| Field | Value |
|---|---|
| Platform | Hack The Box · Challenge |
| Category | Misc |
| Difficulty | Very Easy |
| State | Retired |
Attack map
[Web] random string in <h3>
│
▼
[curl -c] read string + cookie
│
▼
[grep+sed] isolate the exact value
│
▼
[md5sum -n] hash without newline
│
▼
[cut -d' '] clean the output
│
▼
[curl -b POST hash] same session
│
▼
[FLAG]
1. Understand the objective
The app plainly asks to "MD5 encrypt this string" and enforces a timeout: read the displayed string, compute its MD5, and POST it back before it expires, all inside the correct session. The real difficulty isn't the algorithm — MD5 is trivial — it's automating the whole read → hash → send cycle inside the window the server allows.
2. Observe the changing value
Opening the page by hand shows a different string on every load, embedded inside an
. Trying to solve it manually — read it, compute the MD5 in another terminal, copy-paste the answer back — always arrives too late: the server has already rotated the value and the session has expired.
<h3 align='center'>RlH5U3VxEdOk7QUH2t9L</h3>That fragment is exactly what needs to be isolated from the page's full HTML — no forms, headers or styling, just the content between the
tags.
3. Enumerate the page with curl
Before writing any automation we need to confirm precisely what the server returns and expects: the exact name of the form field, and the exact tag the string travels in. A script that guesses the parameter name will fail every single request.
curl -s http://TARGETThe response is a small HTML page: a POST form with a single field named hash, and the random string sitting inside an
. Both details feed the rest of the script — the parameter name for the final submission, and the tag to extract the value from.
4. Extract the string and keep the session
The server validates the answer against the same session that served the string, so we save the cookie on the first request with-cand resend it on the final POST with-b.grepisolates the line containing theh3tag;sedextracts just the content between the tags with a capture group, using-nplus thepflag to print only the substituted line.
curl -s -c cookies.txt http://TARGET | grep h3sed -n "s:.*<h3 align='center'>\(.*\)</h3>.*:\1:p"Using : instead of / as the sed delimiter avoids escaping any slashes that might show up in the HTML; \1 references the captured group in parentheses — the string itself.
5. The newline trap
Here's the point that breaks most attempts:echoappends a newline that changes the resulting hash. Useecho -nso it isn't included.
# wrong: echo TEXT | md5sum
# right: echo -n TEXT | md5sumMD5 operates byte for byte: one extra character — the \n that echo appends by default — produces a completely different hash than the one the server expects. -n suppresses that trailing newline.
6. Clean up md5sum's output and submit
md5sumdoesn't return just the hash: it prints<hash> -when reading from stdin (the dash marks standard input as the "file"). We need to keep only the first field before sending it, or the server will receive garbage alongside the hash.
echo -n "$HASH" | md5sum | cut -d' ' -f1curl -s -X POST -b cookies.txt -d "hash=$MD5" http://TARGETcut -d' ' -f1 splits on the first space and keeps field 1: the clean hash, ready to travel as the value of the hash parameter in the POST.
7. Assemble the full script
IP="http://TARGET"
HASH=$(curl -s -c cookies.txt $IP | grep h3 | sed -n "s:.*<h3 align='center'>\(.*\)</h3>.*:\1:p")
MD5=$(echo -n "$HASH" | md5sum | cut -d' ' -f1)
curl -s -X POST -b cookies.txt -d "hash=$MD5" $IPEvery line reuses exactly what was validated in the previous steps: the saved cookie, the string extracted with grep+sed, the hash computed without a newline and trimmed with cut, and the resend using the same cookie. Nothing runs by hand, so there's no dead time for the session to expire in.
8. Run it and read the flag
Running the full script takes well under a second, so the session is still valid when the POST arrives: the server compares the received hash against the real MD5 of the string it served and, on a match, returns the flag straight in the response.
bash solve.shHTB{...}Chain summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Recon | HTML response (form + <h3>) | Predictable, time-boxed value | Confirms full automation is required |
| Extraction | curl -c + grep + sed | Session-bound random string | Exact value captured under the right cookie |
| Hashing | echo -n + md5sum | Trailing newline changes the hash | Correct MD5 of the exact string |
| Output parsing | cut -d' ' -f1 | md5sum's "hash -" format | Clean hash value for the POST body |
| Submission | curl -b -X POST | Answer tied to the session cookie | Valid hash accepted → flag returned |
Defender's view
This challenge is really an anti-automation control, and the lesson for defenders is that a time limit plus a hash is not one. Here is how the solve looks from the server and what would actually slow a bot down.
A time-boxed MD5 "puzzle" as bot protection
How it shows up in logs / telemetry
- Web logs show a
GETand aPOSTfrom the same session cookie a few milliseconds apart, with a defaultcurlUser-Agentand no requests for CSS, scripts or images: a human with a browser never looks like that. - Timing between serving the string and receiving the correct hash is consistently far below human reaction time; the server already knows both timestamps and can record them.
How to fix it
- Do not rely on any challenge a machine can compute faster than a person. If the goal is to stop automation, use rate limiting, proof-of-work sized to make bulk requests expensive, or a real CAPTCHA/bot-management service.
- If the check protects something valuable, bind it to an authenticated account and limit successful submissions per account and per IP.
Secrets returned on a single correct answer
How it shows up in logs / telemetry
- Each successful submission returns the flag directly in the response; logging every success with session, IP and timing makes abuse obvious after the fact.
How to fix it
- Treat the protected resource as sensitive: log access, alert on bursts, and never assume that obscurity or speed is a security boundary.
- Rotate the secret if the endpoint has been solved by a script, since anything returned once should be considered public.