Tower of Origins
Take a moment to relax. No need to rush, no big-brain plays required—just keep a sharp eye on the auras and skillfully fuse the elements.
ZeroD is standing alone against the 12 floors of monsters guarding the Tower of Origin. Lead the way: block the right moves, unleash the right combos, and guide ZeroD all the way to the summit of the Tower—where the final secret awaits to be unlocked.
Clear all 12 stages, and the Tower itself will hand you the Flag.
Flag format: NVR{…}
Connections
- https://arab-judy-tribes-pacific.trycloudflare.com
Recon
A browser RPG that plays as a reflex test. The whole tower ships to the client: one HTML page, the CryptoJS library, and a single game.js of about 1,400 lines wrapped in an IIFE with no build step, so every game rule and the flag decryption itself are readable in the shipped code. Clearing the twelve floors of quick-time-event combat makes the page decrypt a constant that ships encrypted. There are two ways to the key: play all twelve floors, or reconstruct offline the exact string the page would hash. We reconstructed it offline, then confirmed by clearing the tower on the live instance.

The title screen offers Start and Continue. Progress persists in localStorage under the key tkn_save_v1 as {stageIdx, phaseIdx, history}, written after every recorded event and again on page unload, so a refresh does not lose progress.
Each round is two quick-time events in sequence. First the defense phase: the monster’s aura glows in the color of the incoming attack, five Aegis shields (D1 Diamond Aegis through D5 Shadow Void) sit on number keys 1 to 5, and a cursor sweeps a bar in 1.3 seconds at stage 1, quickening to 0.85 seconds at the bosses. Space parries, with the middle of the bar counting as a perfect parry worth a longer attack timer. The bar is less demanding than it looks, because the game itself displays the answer: setupDefenseTurn() writes the counter shield’s name and key into a dedicated HUD element and marks the matching card counter-recommended, and handleDefenseInput() awards a perfect parry whenever that key is pressed, at any point in the window.
Then the attack phase: the enemy drops its guard and the page asks for an elemental combo against a timer that starts at 2.6 seconds and shortens by 60ms per stage, which is roughly two seconds at the bosses, with 0.4s added after a perfect parry. Ten elements are numbered 0 to 9 (Gold, Wood, Water, Fire, Earth, Wind, Thunder, Ice, Light, Darkness) and fill two or three slots. Entry order does not matter, since evaluateAttackCombo() compares the sorted, comma-joined sets.

Stages need one, then two, then three clean hits on higher floors (the extra hits are warm-up rounds), and stages 11 and 12 are three-phase bosses needing up to five hits within a single phase. A missed parry costs 12 to 26 percent of the 100 HP pool depending on the floor, and a wrong or expired combo costs a smaller recoil on top. Below stage 9 a knockout revives the player in place; from stage 9 up it sends the player back to stage 8. Clearing stage 12 calls triggerEnding(), which shows either the victory overlay with the flag, or HACKER DETECTED.
The flag itself never appears in plaintext. Near the top of game.js it sits encrypted in a single constant:
const ENCRYPTED_FLAG =
"U2FsdGVkX1+15wuYxUNL6gkIXkaGn9i4EnwEkc2hgmo6UKWqpaABg5DmKNwyZ5yp";
U2FsdGVkX1+ is the base64 encoding of the eight ASCII bytes Salted__, the header OpenSSL writes when a random salt is prepended to a ciphertext. Base64-decoding the whole constant gives exactly 48 bytes: the Salted__ marker, an 8-byte salt, and 32 bytes of ciphertext, two AES blocks. That layout is the OpenSSL salted envelope, and it is what CryptoJS emits in its passphrase mode. The key and the IV are stored nowhere; both get derived from a passphrase plus that embedded salt. The whole challenge reduces to finding the passphrase.
The ending function says where it comes from:
function triggerEnding() {
DOM.overlay.classList.remove("hidden");
const hashInput = _actionHistory.join("|");
const keyHex = CryptoJS.SHA256(hashInput).toString(CryptoJS.enc.Hex);
try {
const bytes = CryptoJS.AES.decrypt(ENCRYPTED_FLAG, keyHex);
const decryptedFlag = bytes.toString(CryptoJS.enc.Utf8);
if (decryptedFlag && decryptedFlag.startsWith("NVR{")) {
DOM.oTitle.innerText = "TOWER CONQUERED!";
DOM.oTitle.style.color = "#FFD700";
DOM.oMsg.innerText = `The ancient seal of Genesis is broken!\n\nYour Flag:\n${decryptedFlag}`;
DOM.oMsg.style.color = "#00e676";
playSfx("kill", 0.8);
} else {
throw new Error("Invalid Key");
}
} catch (e) {
DOM.oTitle.innerText = "HACKER DETECTED";
DOM.oMsg.innerText =
"State tampering detected. The Genesis cryptographic seal has shattered irreversibly.";
playSfx("hacker", 0.8);
DOM.oMsg.style.color = "#888";
}
}
The game keeps a global list _actionHistory, joins it with |, hashes that string with SHA-256, and gets keyHex, a 64-character lowercase hex digest. The next line decides all the crypto. CryptoJS.AES.decrypt behaves according to the type of its second argument: given a WordArray (CryptoJS’s byte-container type) it uses those bytes directly as the key, but given a plain string, as here, it switches to passphrase mode. The string becomes a password, and CryptoJS runs OpenSSL’s EVP_BytesToKey (MD5, one iteration) over the password and the blob’s embedded salt to stretch them into a 32-byte AES-256 key and a 16-byte IV, then decrypts AES-256-CBC. The SHA-256 digest is therefore never the AES key; its 64-character hex text is the password. Any offline replication has to reproduce that exact chain, and the startsWith("NVR{") check doubles as a free oracle, because a wrong passphrase yields garbage that fails both the PKCS#7 padding and the prefix test. This also explains the anti-tamper design: editing the saved history in localStorage changes the password, and only the canonical history decrypts.
Exploitation
Only the final blow is recorded
_actionHistory looks gameplay-dependent at first, because the warm-up rounds of multi-hit stages roll their requirements from random pools (DEF_POOL and two attack pools) through getRoundData(). But the history is written at exactly two sites, both guarded by the same condition. In handleParrySuccess, after a successful defense:
// Record history only on final blow of round
if (_hitsRemaining <= 1) {
_actionHistory.push(data.turnD.req);
saveProgress();
}
and in handleAttackSuccess, after a combo lands:
const isFinalBlow = _hitsRemaining <= 1;
// ...
if (isFinalBlow) {
// Record into history for CTF key derivation
_actionHistory.push(comboString);
saveProgress();
// ...
}
with comboString built in evaluateAttackCombo() as [..._enteredElements].sort().join(','). The same _hitsRemaining <= 1 condition appears inside getRoundData() itself:
function getRoundData() {
const realData = getCurrentStageData();
if (_hitsRemaining <= 1) {
_prevRoundDef = null;
_prevRoundAtk = null;
return realData;
}
if (!_currentRoundReq) _currentRoundReq = rollRandomRoundReq(realData);
return _currentRoundReq;
}
So the recording sites and getRoundData() agree, and the determinism is derived rather than assumed: entries are pushed only on the final hit of a stage or boss phase, and on precisely those rounds getRoundData() returns the fixed STAGES data instead of a random roll. The random warm-up rounds never touch the history. Every pushed value comes from the shipped stage table, two per final round in a fixed order: data.turnD.req for the defense entry, then the stage’s turnA.req array sorted and comma-joined for the attack entry. A helper function confirms the arithmetic:
function actionHistoryCountBeforeStage(stageIdx) {
let count = 0;
for (let i = 0; i < stageIdx; i++) {
count += STAGES[i].isBoss ? 6 : 2;
}
return count;
}
Two entries per regular stage, six per three-phase boss, and the same helper truncates the history when a knockout sends the player back to stage 8, which keeps a resumed save consistent with its position. Ten stages plus two bosses gives 20 + 12 = 32 entries, identical for every perfect run.
The canonical 32-entry history
Reading turnD.req and turnA.req off the frozen STAGES table in order gives all 32 entries. Boss stages carry three phases, each with its own turnD and turnA:
| Stage / phase | Defense entry | Attack entry |
|---|---|---|
| 1 Gatekeeper | D2 |
3,5 |
| 2 Silent Woods | D3 |
1,4 |
| 3 Phantom Realm | D5 |
8,9 |
| 4 Weeping Creek | D4 |
6,7 |
| 5 Golden Gate | D1 |
0,3 |
| 6 Dimensional Rift | D2 |
5,8,9 |
| 7 Astral Spire | D3 |
0,1,2 |
| 8 Purgatory | D5 |
2,4,7 |
| 9 Fallen Domain | D4 |
3,6,9 |
| 10 Primordial Chaos | D1 |
1,4,5 |
| 11 Harbinger, phase 1 | D2 |
5,8,9 |
| 11 Harbinger, phase 2 | D5 |
0,1,2 |
| 11 Harbinger, phase 3 | D4 |
2,4,7 |
| 12 Lord of Genesis, phase 1 | D3 |
3,6,9 |
| 12 Lord of Genesis, phase 2 | D1 |
1,4,5 |
| 12 Lord of Genesis, phase 3 | D2 |
3,5 |
Joined with |, those 32 entries are the exact string a perfect player’s browser holds when stage 12 is cleared, and the SHA-256 hex of that string is the passphrase.
Decrypting offline
We did not play the tower out to earn the key: the live instance answered repeated requests with HTTP 429s, the attack timer near the top is down to about two seconds, and one knockout from stage 9 sends the run back to stage 8 with the history truncated, which changes the passphrase. We mirrored game.js once and replicated the crypto instead. The passphrase-mode chain decomposes into four documented primitives:
- Base64-decode the blob into marker, salt and ciphertext.
- Take the passphrase as the UTF-8 bytes of the 64-character hex string, the text rather than the digest.
- Derive key and IV with
EVP_BytesToKey, which repeatedly computesMD5(previous || password || salt)until 48 bytes are available; the first 32 are the key, the next 16 the IV. - Decrypt AES-256-CBC and strip the PKCS#7 padding.
The solver, with the stage table mirrored in push order:
import base64
import hashlib
from Crypto.Cipher import AES
ENCRYPTED_FLAG = "U2FsdGVkX1+15wuYxUNL6gkIXkaGn9i4EnwEkc2hgmo6UKWqpaABg5DmKNwyZ5yp"
# (turnD.req, turnA.req) per stage/phase, in exact push order - mirrored from STAGES in game.js
STAGES = [
("D2", ["3", "5"]), ("D3", ["1", "4"]), ("D5", ["8", "9"]), ("D4", ["6", "7"]),
("D1", ["0", "3"]), ("D2", ["5", "8", "9"]), ("D3", ["0", "1", "2"]), ("D5", ["2", "4", "7"]),
("D4", ["3", "6", "9"]), ("D1", ["1", "4", "5"]),
("D2", ["5", "8", "9"]), ("D5", ["0", "1", "2"]), ("D4", ["2", "4", "7"]), # boss 11 phases
("D3", ["3", "6", "9"]), ("D1", ["1", "4", "5"]), ("D2", ["3", "5"]), # boss 12 phases
]
history = []
for turn_d_req, turn_a_req in STAGES:
history.append(turn_d_req) # push in handleParrySuccess (final hit)
history.append(",".join(sorted(turn_a_req))) # push in handleAttackSuccess (final blow)
key_hex = hashlib.sha256("|".join(history).encode()).hexdigest()
def evp_bytestokey_md5(password, salt, key_len, iv_len):
d = b""; prev = b""
while len(d) < key_len + iv_len:
prev = hashlib.md5(prev + password + salt).digest()
d += prev
return d[:key_len], d[key_len:key_len + iv_len]
blob = base64.b64decode(ENCRYPTED_FLAG)
assert blob[:8] == b"Salted__"
salt, ct = blob[8:16], blob[16:]
key, iv = evp_bytestokey_md5(key_hex.encode(), salt, 32, 16)
pt = AES.new(key, AES.MODE_CBC, iv).decrypt(ct)
pad = pt[-1]
if 1 <= pad <= 16 and pt[-pad:] == bytes([pad]) * pad:
pt = pt[:-pad]
print(pt.decode())
assert pt.decode().startswith("NVR{")
Running the real solver (the version we used prints the intermediate values too):
$ python solve.py
history entries: 32
hash_input: D2|3,5|D3|1,4|D5|8,9|D4|6,7|D1|0,3|D2|5,8,9|D3|0,1,2|D5|2,4,7|D4|3,6,9|D1|1,4,5|D2|5,8,9|D5|0,1,2|D4|2,4,7|D3|3,6,9|D1|1,4,5|D2|3,5
key_hex (passphrase): 04a2ec902be76d1e039a9dee40a8f2a54885a344072b4455e2e091a96c73cddf
salt: b5e70b98c5434bea | ct len: 32
key: ac8e7af505f1a5f67e56f50fb5c4d42e2c47b313bff3c9bf395e4c5a66212e2f
iv: ddede5d24d81c97da8555b40eeb06d82
The remaining lines print the decrypted plaintext and assert the NVR{ prefix, the same acceptance check the game applies. The assertion passed on the first run, with valid padding and clean UTF-8, so the straightforward canonical reconstruction was the right history. The printed salt is the eight bytes between the Salted__ marker and the ciphertext inside the decoded constant, so the envelope was split exactly where CryptoJS splits it.
The live game confirms it: clearing all twelve stages ends the page on its victory screen, where triggerEnding() decrypts that same history and prints the flag:

Flag capture
As a final cross-check on the hand-rolled EVP_BytesToKey, we fed the same passphrase to OpenSSL’s own implementation of the same derivation. The deprecation warning is expected and is the point: modern OpenSSL discourages the MD5-based KDF, but that deprecated path is exactly what CryptoJS implements.
$ echo "U2FsdGVkX1+15wuYxUNL6gkIXkaGn9i4EnwEkc2hgmo6UKWqpaABg5DmKNwyZ5yp" | \
openssl enc -d -aes-256-cbc -md md5 -a \
-pass pass:04a2ec902be76d1e039a9dee40a8f2a54885a344072b4455e2e091a96c73cddf
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
NVR{Ckuc_mUng_hi4p_s1_duNg_c4m}