πŸ‘¨β€πŸ’» Challenge provided by: Kevin McFarland
πŸ—ΊοΈ Location: Retro Emporium - Area: retroshop. Coordinates: 12, 4
Challenge File: login.bas
GitHub URL (if HHC2025 is no longer available): login.bas

Challenge Description

Kevin in the Retro Store needs help rewinding tech and going in reverse. Extract the flag and enter it here.

Helpful References

C64 BASIC wiki - Check the end of the page for links to specific commands.
FreeBASIC

Solution

login.bas contains the following code written in Commodore 64 BASIC:

10 REM *** COMMODORE 64 SECURITY SYSTEM ***
20 ENC_PASS$ = "D13URKBT"
30 ENC_FLAG$ = "DSA|auhts*wkfi=dhjwubtthut+dhhkfis+hnkz" ' old "DSA|qnisf`bX_huXariz"
40 INPUT "ENTER PASSWORD: "; PASS$
50 IF LEN(PASS$) <> LEN(ENC_PASS$) THEN GOTO 90
60 FOR I = 1 TO LEN(PASS$)
70 IF CHR$(ASC(MID$(PASS$,I,1)) XOR 7) <> MID$(ENC_PASS$,I,1) THEN GOTO 90
80 NEXT I
85 FLAG$ = "" : FOR I = 1 TO LEN(ENC_FLAG$) : FLAG$ = FLAG$ + CHR$(ASC(MID$(ENC_FLAG$,I,1)) XOR 7) : NEXT I : PRINT FLAG$
90 PRINT "ACCESS DENIED"
100 END

Looking at the code, there are a few key aspects worth highlighting:

ENC_PASS$ = "D13URKBT"
ENC_FLAG$ = "DSA|auhts*wkfi=dhjwubtthut+dhhkfis+hnkz" ' old "DSA|qnisf`bX_huXariz"
FLAG$ = "" : FOR I = 1 TO LEN(ENC_FLAG$) : FLAG$ = FLAG$ + CHR$(ASC(MID$(ENC_FLAG$,I,1)) XOR 7) : NEXT I : PRINT FLAG$

From this, we can see that the program stores an encrypted password in the ENC_PASS$ variable, an encrypted flag in ENC_FLAG$, and performs an XOR operation using the decimal value 7 as the key. I tried in CyberChef and indeed that was the solution:

CyberChef recipe with the solution

Solution: CTF{frost-plan:compressors,coolant,oil}

Extras

Check Retro Fun in the Extras section to learn how to compile and execute the program, as well as for a detailed line-by-line explanation of login.bas.