Skip to main content
Challenges Bytecode VM with unchecked bounds
PWN Expert Out-of-bounds VM Solves: 8

Bytecode VM with unchecked bounds

Author: CyberSamSU
Points
170

This is a REAL, runnable Python program (attached vm.py): a very small, stack-based bytecode virtual machine. There is a "working memory" of size WORKAREA_SIZE inside the program, but in reality it is only the BEGINNING part of a larger MEMORY list — immediately after it is the system's secret zone (encrypted flag), INSIDE THE EXACT SAME list!

OpcodeCodeDefinition
HALT0Dasturni to'xtatadi.
PUSH n1n sonini stekka qo'yadi.
OUT2Stek tepasini belgi (chr) sifatida chiqaradi.
LOAD idx3MEMORY[idx] ni stekka qo'yadi (chegarasi TEKSHIRILMAYDI).
STORE idx4Stek tepasini MEMORY[idx] ga yozadi.
ADD5Ikkita qiymatni qo'shadi (mod 256).
XOR n6Stek tepasini n bilan XOR qiladi.

Read the source code carefully: WORKAREA_SIZE = 14. The LOAD/STORE operations apply idx directly to MEMORY[idx] WITHOUT ANY bounds checking — meaning if idx ≥ 14, you step outside the WORKAREA, straight into the secret zone.

The values in the secret zone are stored XORed with _XOR_KALIT (which is clearly visible in the source code) — using the VM's own XOR n instruction, it is also possible to decode and output them directly INSIDE the VM!

Task: Run vm.py (or import it and call the bajar() function) and provide such a bytecode that it reads EVERY byte in the secret zone in sequence, decodes it with XOR, and outputs it.

Sequence for each secret byte: LOAD idx; XOR _XOR_KALIT; OUT — increment idx one by one starting from 14.

Attached files
vm.py Log in to download
SHA-256 checksums
vm.py: b4dc202a130cc7df77aa07b7379051d84b7ba83f47c347a31e2e2719889aa243
Hints 3
Opening a hint reduces the points you get for solving this challenge.
Hint 1 −17 pts Log in
Hint 2 −34 pts Log in
Hint 3 −51 pts Log in
To submit a flag, log in.

First solvers

1. W.o.X 11.09.2026
2. Абдул 15.09.2026
3. Лазиз 01.10.2026
4. Raumdeuter 09.10.2026
5. testrejim 09.10.2026
6. Mirjaxon Qaxxarov 26.10.2026
7. Odam 04.11.2026
8. Furqat Turayev 08.11.2026