Skip to main content
Challenges Pickle: static opcode chain
Web Expert Statically simulating the stack and memo machine of a Python pickle protocol 4 file without loading it Solves: 4

Pickle: static opcode chain

Author: CyberSamSU
Points
150

A suspicious session_blob.pkl (Python pickle protocol 4) file was extracted from the web application cache. Inside the file, a gadget chain is hidden that executes a system command during deserialization.

Strict warning: NEVER call pickle.loads()! Analyze the file statically only (pickletools.dis / pickletools.genops).

In the opcode stream:

  • Using MEMOIZE and BINGET, hex and ROT13 string fragments are stored in memory slots (memo) in mixed order.
  • There is also a decoy base64.b64decode chain built onto the stack and immediately discarded with the POP opcode (only an analyst who properly tracks the stack can distinguish it from the real chain).
  • The real chain assembles the final string via operator.add, builtins.bytes.fromhex, zlib.decompress, codecs.decode(..., 'rot_13'), itertools.cycle, builtins.map(operator.xor, ...), and builtins.bytes.decode and passes it to posix.system.

Safely emulate the stack and memo machine to recover the flag inside the real command passed to posix.system. Flag format: BAYROQ{...} (the last 16 characters are lowercase hexadecimal digits).

Attached files
session_blob.pkl Log in to download
Theory: learn the topic
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −15 pts Log in
Hint 2 −30 pts Log in
Hint 3 −45 pts Log in
To submit a flag, log in.

First solvers

1. Mirjaxon Qaxxarov 25.11.2026
2. Odam 25.11.2026
3. Ulugʻbek 26.11.2026
4. FASTEST 27.11.2026