2023 Cyber Apocalypse: Persistence
Challenge Information
| Attribute | Details |
|---|---|
| Event | 2023 Cyber Apocalypse |
| Category | Misc |
| Challenge | Persistence |
Summary
This challenge requires executing an HTTP GET request more than 1000 times to extract a flag. The flag likely appears randomly or requires persistence to be revealed. Automation is essential to complete this task efficiently.
Analysis
Challenge objective: Make more than 1000 GET requests to a specified endpoint to retrieve a flag.
Approaches:
- Using Burp Suite Intruder with number payload
- Using custom bash script with curl
- Using any programming language loop with HTTP client
The solution involves:
- Creating a loop that executes N times
- Making an HTTP GET request each iteration
- Capturing and storing responses
- Searching for the flag in the output
Solution
The bash script approach:
#!/bin/bash
# Check argumentsif [ "$#" -ne 2 ]; then echo "Usage: $0 <url> <number_of_requests>" exit 1fi
url="$1"num_requests="$2"output_file="responses.txt"
# Validate argumentif ! [[ "$num_requests" =~ ^[0-9]+$ ]]; then echo "Error: number_of_requests must be a positive integer." exit 2fi
# Clear output fileecho "" > "$output_file"
# Send X GET requests and save responsesfor i in $(seq 1 $num_requests); do echo "Iteration: $i" | tee -a "$output_file" echo | tee -a "$output_file" curl -s "$url" | tee -a "$output_file" echo | tee -a "$output_file" echo "-------------------------------------" | tee -a "$output_file"doneExecution:
chmod +x get_x_times.sh./get_x_times.sh http://target.ip/flag 1001Extract the flag:
grep -E 'HTB\{[a-zA-Z0-9_!]+\}' responses.txtKey Takeaways
- Some challenges require persistence and repetition
- Automation is essential for large-scale tasks
- Bash scripting enables efficient HTTP request automation
- Regular expressions help extract specific patterns from output
- Logging responses facilitates post-processing
- curl is a versatile tool for HTTP requests
- Loop-based automation is more efficient than manual requests