Lesson 6 of 6

The final challenge

Goal

A chain of steps that ends at the flag

01

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:

  1. Extract the printable strings that are four or more characters long.
  2. 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.
  3. The string that starts with DATA= carries a base64-encoded payload after it. Base64 writes bytes as printable characters, and base64.b64decode(text) turns them back into bytes. Then undo the XOR with the key.
  4. 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.
02

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
  1. Solves a hidden block
  2. Solves a block with a different seed and flag
  3. Doesn't depend on the order of the strings
  4. Cuts the flag by its length, not by its closing character
  5. flag holds the flag of BLOB
03

Hints

0/3
Track lessons0 of 6 done

Six challenges of rising difficulty where you reverse a check function or bytecode and extract the key with your own code, not by copying it.

Advanced level, 6 lessons, 2 hours in total.

main.py
OutputPython (Pyodide)

Loading Python. This only happens once. Your browser keeps it after that.

–/5

Checks start once the environment is ready.

5 checks listed under “Your task”.

Track lessons0 of 6 done

Six challenges of rising difficulty where you reverse a check function or bytecode and extract the key with your own code, not by copying it.

Advanced level, 6 lessons, 2 hours in total.