Elf Glaki went rouge! At 2:56 PM EST, he locked up all our flags! Luckily you're not an idiot and you can fix this in 3 minutes. Stop this Angry Elf ASAP!
nc ctf.csd.lol 1147
(uhh kinda broken but works, will fix soon)
Category
Points
Author
Reverse engineering
50
qvipin
1 | ![]() | 12/14 3:20 pm |
2 | ![]() | 12/14 3:21 pm |
3 | ![]() | 12/14 3:25 pm |
4 | ![]() | 12/14 3:28 pm |
5 | ![]() | 12/14 3:29 pm |
6 | ![]() | 12/14 3:42 pm |
7 | ![]() | 12/14 3:49 pm |
8 | ![]() | 12/14 4:13 pm |
9 | ![]() | 12/14 5:16 pm |
10 | ![]() | 12/14 6:00 pm |
11 | ![]() | 12/14 7:58 pm |
12 | ![]() | 12/15 6:11 am |
13 | ![]() | 12/15 7:32 am |
14 | ![]() | 12/15 7:53 am |
15 | ![]() | 12/15 12:39 pm |
16 | ![]() | 12/15 1:23 pm |
17 | ![]() | 12/15 1:23 pm |
18 | ![]() | 12/15 3:03 pm |
19 | 12/15 8:55 pm | |
20 | ![]() | 12/16 4:36 am |
21 | ![]() | 12/16 6:38 am |
22 | ![]() | 12/16 3:40 pm |
23 | ![]() | 12/16 5:16 pm |
24 | ![]() | 12/16 10:14 pm |
25 | ![]() | 12/17 4:00 am |
26 | ![]() | 12/17 4:08 am |
27 | ![]() | 12/17 4:50 am |
28 | ![]() | 12/17 10:53 am |
29 | ![]() | 12/17 12:17 pm |
30 | ![]() | 12/17 4:09 pm |
31 | ![]() | 12/17 11:03 pm |
32 | ![]() | 12/17 11:49 pm |
33 | ![]() | 12/18 1:16 am |
34 | ![]() | 12/18 4:24 am |
35 | ![]() | 12/18 5:10 am |
36 | ![]() | 12/18 9:40 am |
37 | ![]() | 12/18 10:29 am |
38 | ![]() | 12/18 12:01 pm |
39 | ![]() | 12/18 2:15 pm |
40 | ![]() | 12/18 8:04 pm |
41 | ![]() | 12/18 9:14 pm |
42 | ![]() | 12/18 9:58 pm |
43 | ![]() | 12/18 10:00 pm |
44 | ![]() | 12/19 3:27 am |
45 | ![]() | 12/19 5:30 am |
46 | ![]() | 12/19 10:20 am |
47 | ![]() | 12/19 10:59 am |
48 | ![]() | 12/19 9:48 pm |
49 | ![]() | 12/20 10:05 am |
50 | ![]() | 12/20 11:24 am |
51 | ![]() | 12/21 3:49 am |
52 | ![]() | 12/21 7:10 am |
53 | ![]() | 12/21 11:36 pm |
54 | ![]() | 12/22 11:44 am |
55 | ![]() | 12/22 3:59 pm |
56 | ![]() | 12/22 5:20 pm |
57 | ![]() | 12/23 6:02 am |
58 | ![]() | 12/23 7:50 am |
59 | ![]() | 12/23 7:59 am |
60 | ![]() | 12/23 8:19 am |
61 | ![]() | 12/24 11:49 am |
62 | ![]() | 12/25 12:24 pm |
63 | ![]() | 12/25 3:03 pm |
64 | ![]() | 12/25 3:33 pm |
65 | ![]() | 12/25 3:41 pm |
66 | ![]() | 12/25 6:16 pm |
67 | ![]() | 12/26 4:45 am |
68 | ![]() | 12/26 12:14 pm |
69 | ![]() | 12/26 11:41 pm |
70 | ![]() | 12/27 3:38 am |
71 | ![]() | 12/27 4:05 am |
72 | ![]() | 12/28 8:18 am |
73 | ![]() | 12/28 11:05 am |
74 | ![]() | 12/29 6:48 am |
75 | ![]() | 12/29 8:20 am |
76 | ![]() | 12/30 8:39 am |
Elf Glaki went rouge! At 2:56 PM EST, he locked up all our flags! Luckily you're not an idiot and you can fix this in 3 minutes. Stop this Angry Elf ASAP!
nc ctf.csd.lol 1147
(uhh kinda broken but works, will fix soon)
There are no penalties for viewing hints. Hints are released 12 hours and 24 hours after the challenge releases.
.jstr_ (Jester)'s write-up was selected as the best write-up submitted for this challenge.
View this write-up on GitHubThe first thing we do is to run it through dogbolt to see the source code of the program.
The main part of the program is:
__int64 __fastcall validate_passcode(__int64 a1) { int j; // [rsp+14h] [rbp-1Ch] int i; // [rsp+14h] [rbp-1Ch] int v4; // [rsp+18h] [rbp-18h] char v5[11]; // [rsp+1Dh] [rbp-13h] unsigned __int64 v6; // [rsp+28h] [rbp-8h] v6 = __readfsqword(0x28u); v4 = 0; while ( v4 != 2 ) { if ( v4 ) { for ( i = 0; i <= 10; ++i ) { if ( v5[i] != obfuscated_key[i] ) return 0LL; } v4 = 2; } else { for ( j = 0; j <= 10; ++j ) v5[j] = *(_BYTE *)(j + a1) ^ 0x7F; v4 = 1; } } return 1LL; } // 1253: conditional instruction was optimized away because %var_18.4<3u // 125D: conditional instruction was optimized away because %var_18.4<3u // 126D: conditional instruction was optimized away because %var_18.4<2u // 1279: conditional instruction was optimized away because %var_18.4==1 // 4010: using guessed type _BYTE obfuscated_key[11]; // 1229: using guessed type char var_13[11]; //----- (0000000000001321) ---------------------------------------------------- int __fastcall main(int argc, const char **argv, const char **envp) { FILE *stream; // [rsp+8h] [rbp-A8h] char s[16]; // [rsp+10h] [rbp-A0h] BYREF char v6[136]; // [rsp+20h] [rbp-90h] BYREF unsigned __int64 v7; // [rsp+A8h] [rbp-8h] v7 = __readfsqword(0x28u); printf("Enter passcode: "); __isoc99_scanf("%15s", s); if ( strlen(s) == 11 ) { if ( (unsigned int)validate_passcode((__int64)s) ) { puts("Access Granted!"); stream = fopen("flag.txt", "r"); if ( stream ) { if ( fgets(v6, 128, stream) ) printf("Here is your flag: %s\n", v6); fclose(stream); } else { puts("Error: Could not read flag file."); } } else { puts("Access Denied!"); } return 0; } else { puts("Invalid passcode length!"); return 1; } }
So, to find a key to the app, we need a key that is 11 characters long. Since the code Obfuscates the input passcode using a bitwise XOR operation with 0x7F and compares the result to a the obfuscated key. So, to find the key, we have to reverse the obfuscation.
To do this, we can:
Go on CyberChef. Input the numbers that are separated with commas. (15,13,22,17,24,19,26,12,79,70,92)
Add From Decimal and put Comma as the delimeter. Add XOR and put 0x7F
aa the key.
The output we get is pringles09#
. Now input the decrypted text into the NetCat to get the answer:
jstr$ nc ctf.csd.lol 1147 pringles09# Enter passcode: Access Granted! Here is your flag: csd{4N9ry_3lf5_5h0uLdNT_83_M3553D_w1tH}
Flag: csd{4N9ry_3lf5_5h0uLdNT_83_M3553D_w1tH}