Lesson 6 of 6
The final challenge
- 25 min
- 5 checks
- 3 hints
- Go to task
Goal
A chain of steps that ends at the flag
Explanation
This is the last challenge, and it brings together everything you've learned in this area. BLOB is a piece of a made-up executable with printable strings among its bytes, and the flag is hidden behind four layers:
- Extract the printable strings that are four or more characters long.
- The string that starts with
KEYSEED=carries the key seed after it, and the key is the sum of the seed's bytes modulo 256. - The string that starts with
DATA=carries a base64-encoded payload after it. Base64 writes bytes as printable characters, andbase64.b64decode(text)turns them back into bytes. Then undo the XOR with the key. - Once decoded, the payload is a record that starts with the two-byte signature
RE, then the flag's length in two little-endian bytes, then the flag, followed by some extra bytes. So read the length and cut the flag out with it, and don't rely on the character the flag ends with.
Your task
Write a function solve(blob) that returns the flag as a string, and store the flag of BLOB in the variable flag. The checks build other blocks with different seeds and flags, and the strings may come in a different order.
Checks
5 checks- Solves a hidden block
- Solves a block with a different seed and flag
- Doesn't depend on the order of the strings
- Cuts the flag by its length, not by its closing character
- flag holds the flag of BLOB