Post

LACTF 2025 Write Up

LACTF 2025 Write Up

LACTF 2025

rev/javascryption

Challenge description: You wake up alone in a dark cabin, held captive by a bushy-haired man demanding you submit a “flag” to leave. Can you escape?

And here is the JavaScript code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const msg = document.getElementById("msg");
const flagInp = document.getElementById("flag");
const checmBtn = document.getElementById("check");

function checkFlag(flag) {
    const step1 = btoa(flag);
    const step2 = step1.split("").reverse().join("");
    const step3 = step2.replaceAll("Z", "[OLD_DATA]");
    const step4 = encodeURIComponent(step3);
    const step5 = btoa(step4);
    return step5 === "JTNEJTNEUWZsSlglNUJPTERfREFUQSU1RG85MWNzeFdZMzlWZXNwbmVwSjMlNUJPTERfREFUQSU1RGY5bWI3JTVCT0xEX0RBVEElNURHZGpGR2I=";
}

checkBtn.addEventListener("click", () => {
    const flag = flagInp.value.toLowerCase();
    if (checkFlag(flag)) {
        flagInp.remove();
        checkBtn.remove();
        msg.innerText = flag;
        msg.classList.add("correct");
    } else {
        checkBtn.classList.remove("shake");
        checkBtn.offsetHeight;
        checkBtn.classList.add("shake");
    }
});

From this, we can see that the function checkFlag() performs transformation to our input and checking if it’s equal to the string "JTNEJTNEUWZsSlglNUJPTERfREFUQSU1RG85MWNzeFdZMzlWZXNwbmVwSjMlNUJPTERfREFUQSU1RGY5bWI3JTVCT0xEX0RBVEElNURHZGpGR2I=". So, to solve this challenge we need to reverse the transformation on the target string and then we can get the flag. Here is my script to solve it:

1
2
3
4
5
6
from base64 import b64decode
from urllib.parse import unquote

encrypted = 'JTNEJTNEUWZsSlglNUJPTERfREFUQSU1RG85MWNzeFdZMzlWZXNwbmVwSjMlNUJPTERfREFUQSU1RGY5bWI3JTVCT0xEX0RBVEElNURHZGpGR2I='
flag = b64decode(unquote(b64decode(encrypted).decode()).replace('[OLD_DATA]', 'Z')[::-1]).decode()
print(flag)

And here is the flag lactf{no_grizzly_walls_here}

rev/patricks-paraflag

Challenge Descripption: I was going to give you the flag, but I dropped it into my parabox, and when I pulled it back out, it got all scrambled up!

Can you recover the flag?

This post is licensed under CC BY 4.0 by the author.

Trending Tags