AAAAA- I'm not screaming, I'm just buffer overflowing my emotions!
screaming
Category
Points
Author
Reverse engineering
40
qvipin
Solves (259)
| 1 | 12/02 3:01 pm | |
| 2 | 12/02 3:03 pm | |
| 3 | 12/02 3:10 pm | |
| 4 | 12/02 3:45 pm | |
| 5 | 12/02 3:59 pm | |
| 6 | 12/02 4:22 pm | |
| 7 | 12/02 4:31 pm | |
| 8 | 12/02 4:53 pm | |
| 9 | 12/02 5:31 pm | |
| 10 | 12/02 5:40 pm | |
| 11 | 12/02 5:49 pm | |
| 12 | 12/02 6:20 pm | |
| 13 | 12/02 6:41 pm | |
| 14 | 12/02 7:46 pm | |
| 15 | 12/02 7:49 pm | |
| 16 | 12/02 9:36 pm | |
| 17 | 12/02 9:47 pm | |
| 18 | 12/02 9:50 pm | |
| 19 | 12/03 12:14 am | |
| 20 | 12/03 1:52 am | |
| 21 | 12/03 1:55 am | |
| 22 | 12/03 2:25 am | |
| 23 | 12/03 3:19 am | |
| 24 | 12/03 4:15 am | |
| 25 | 12/03 5:17 am | |
| 26 | 12/03 7:40 am | |
| 27 | 12/03 7:52 am | |
| 28 | 12/03 8:07 am | |
| 29 | 12/03 9:45 am | |
| 30 | 12/03 4:07 pm | |
| 31 | 12/03 4:09 pm | |
| 32 | 12/03 7:29 pm | |
| 33 | 12/03 8:37 pm | |
| 34 | 12/03 9:16 pm | |
| 35 | 12/03 11:07 pm | |
| 36 | 12/04 4:57 am | |
| 37 | 12/04 8:33 am | |
| 38 | 12/04 9:13 am | |
| 39 | 12/04 9:16 am | |
| 40 | 12/04 10:00 am | |
| 41 | 12/04 10:34 am | |
| 42 | 12/04 11:34 am | |
| 43 | 12/04 11:54 am | |
| 44 | 12/04 12:29 pm | |
| 45 | 12/04 3:11 pm | |
| 46 | 12/04 5:40 pm | |
| 47 | 12/04 6:22 pm | |
| 48 | 12/04 9:48 pm | |
| 49 | 12/05 5:15 am | |
| 50 | 12/05 5:29 am | |
| 51 | 12/05 7:09 am | |
| 52 | 12/05 8:39 am | |
| 53 | 12/05 9:26 am | |
| 54 | 12/05 10:42 am | |
| 55 | 12/05 12:46 pm | |
| 56 | 12/05 2:11 pm | |
| 57 | 12/05 10:48 pm | |
| 58 | 12/06 9:41 am | |
| 59 | 12/06 9:46 am | |
| 60 | 12/06 9:56 am | |
| 61 | 12/06 10:08 am | |
| 62 | 12/06 10:10 am | |
| 63 | 12/06 10:23 am | |
| 64 | 12/07 6:26 am | |
| 65 | 12/09 12:52 am | |
| 66 | 12/09 7:19 pm | |
| 67 | 12/10 4:52 am | |
| 68 | 12/10 10:53 am | |
| 69 | 12/10 12:06 pm | |
| 70 | 12/11 4:00 am | |
| 71 | 12/12 1:43 am | |
| 72 | 12/13 12:19 pm | |
| 73 | 12/13 1:39 pm | |
| 74 | 12/14 3:33 pm | |
| 75 | 12/14 3:38 pm | |
| 76 | 12/15 5:15 am | |
| 77 | 12/15 8:30 am | |
| 78 | 12/15 9:59 am | |
| 79 | 12/15 11:58 am | |
| 80 | 12/15 2:15 pm | |
| 81 | 12/15 4:21 pm | |
| 82 | 12/15 5:51 pm | |
| 83 | 12/15 6:55 pm | |
| 84 | 12/15 7:28 pm | |
| 85 | 12/15 7:33 pm | |
| 86 | 12/15 8:24 pm | |
| 87 | 12/15 8:44 pm | |
| 88 | 12/15 11:57 pm | |
| 89 | 12/16 12:01 am | |
| 90 | 12/16 1:01 am | |
| 91 | 12/16 1:03 am | |
| 92 | 12/16 1:27 am | |
| 93 | 12/16 1:53 am | |
| 94 | 12/16 3:09 am | |
| 95 | 12/16 5:19 am | |
| 96 | 12/16 6:57 am | |
| 97 | 12/16 7:02 am | |
| 98 | 12/16 7:22 am | |
| 99 | 12/16 7:46 am | |
| 100 | 12/16 8:50 am | |
| 101 | 12/16 8:57 am | |
| 102 | 12/16 8:57 am | |
| 103 | 12/16 11:30 am | |
| 104 | 12/16 11:41 am | |
| 105 | 12/16 11:51 am | |
| 106 | 12/16 12:02 pm | |
| 107 | 12/16 12:03 pm | |
| 108 | 12/16 12:07 pm | |
| 109 | 12/16 4:57 pm | |
| 110 | 12/16 6:17 pm | |
| 111 | 12/16 8:06 pm | |
| 112 | 12/17 9:19 am | |
| 113 | 12/17 2:32 pm | |
| 114 | 12/17 3:14 pm | |
| 115 | 12/17 4:57 pm | |
| 116 | 12/17 5:45 pm | |
| 117 | 12/17 7:12 pm | |
| 118 | 12/17 7:19 pm | |
| 119 | 12/17 10:28 pm | |
| 120 | 12/17 10:42 pm | |
| 121 | 12/17 11:26 pm | |
| 122 | 12/18 1:38 am | |
| 123 | 12/18 2:15 am | |
| 124 | 12/18 2:39 am | |
| 125 | 12/18 4:30 am | |
| 126 | 12/18 5:30 am | |
| 127 | 12/18 5:48 am | |
| 128 | 12/18 9:33 am | |
| 129 | 12/18 10:09 am | |
| 130 | 12/18 10:34 am | |
| 131 | 12/18 10:51 am | |
| 132 | 12/18 12:38 pm | |
| 133 | 12/18 2:17 pm | |
| 134 | 12/18 2:17 pm | |
| 135 | 12/18 2:24 pm | |
| 136 | 12/18 8:43 pm | |
| 137 | 12/18 9:29 pm | |
| 138 | 12/18 10:52 pm | |
| 139 | 12/18 11:44 pm | |
| 140 | 12/19 12:05 am | |
| 141 | 12/19 1:38 am | |
| 142 | 12/19 2:23 am | |
| 143 | 12/19 3:18 am | |
| 144 | 12/19 4:12 am | |
| 145 | 12/19 7:10 am | |
| 146 | 12/19 7:53 am | |
| 147 | 12/19 10:20 am | |
| 148 | 12/19 1:47 pm | |
| 149 | 12/19 3:43 pm | |
| 150 | 12/19 5:20 pm | |
| 151 | 12/20 1:33 am | |
| 152 | 12/20 2:16 am | |
| 153 | 12/20 3:14 am | |
| 154 | 12/20 3:48 am | |
| 155 | 12/20 4:17 am | |
| 156 | 12/20 6:14 am | |
| 157 | 12/20 6:49 am | |
| 158 | 12/20 8:34 am | |
| 159 | 12/20 9:09 am | |
| 160 | 12/20 10:32 am | |
| 161 | 12/20 10:54 am | |
| 162 | 12/20 12:32 pm | |
| 163 | 12/20 3:37 pm | |
| 164 | 12/20 4:58 pm | |
| 165 | 12/20 9:36 pm | |
| 166 | 12/21 12:07 am | |
| 167 | 12/21 6:22 am | |
| 168 | 12/21 7:42 am | |
| 169 | 12/21 11:42 am | |
| 170 | 12/21 4:18 pm | |
| 171 | 12/21 7:34 pm | |
| 172 | 12/21 9:44 pm | |
| 173 | 12/22 12:43 am | |
| 174 | 12/22 3:23 am | |
| 175 | 12/22 5:13 am | |
| 176 | 12/22 5:21 am | |
| 177 | 12/22 10:22 am | |
| 178 | 12/22 12:22 pm | |
| 179 | 12/22 7:19 pm | |
| 180 | 12/22 8:08 pm | |
| 181 | 12/22 9:00 pm | |
| 182 | 12/23 2:24 am | |
| 183 | 12/23 5:52 am | |
| 184 | 12/23 10:00 am | |
| 185 | 12/23 11:15 am | |
| 186 | 12/23 1:29 pm | |
| 187 | 12/23 3:06 pm | |
| 188 | 12/23 4:09 pm | |
| 189 | 12/23 4:29 pm | |
| 190 | 12/23 5:49 pm | |
| 191 | 12/23 6:53 pm | |
| 192 | 12/24 1:48 am | |
| 193 | 12/24 2:57 am | |
| 194 | 12/24 3:17 am | |
| 195 | 12/24 5:49 am | |
| 196 | 12/24 9:44 am | |
| 197 | 12/24 10:10 am | |
| 198 | 12/24 1:43 pm | |
| 199 | 12/24 3:19 pm | |
| 200 | 12/24 4:54 pm | |
| 201 | 12/24 9:16 pm | |
| 202 | 12/25 12:15 am | |
| 203 | 12/25 1:11 am | |
| 204 | 12/25 1:56 am | |
| 205 | 12/25 3:31 am | |
| 206 | 12/25 6:51 am | |
| 207 | 12/25 7:34 am | |
| 208 | 12/25 7:51 am | |
| 209 | 12/25 8:03 am | |
| 210 | 12/25 8:33 am | |
| 211 | 12/25 9:10 am | |
| 212 | 12/25 10:20 am | |
| 213 | 12/25 10:53 am | |
| 214 | 12/25 12:46 pm | |
| 215 | 12/25 1:10 pm | |
| 216 | 12/25 1:15 pm | |
| 217 | 12/25 1:37 pm | |
| 218 | 12/25 4:51 pm | |
| 219 | 12/25 5:50 pm | |
| 220 | 12/25 5:54 pm | |
| 221 | 12/25 11:17 pm | |
| 222 | 12/26 1:45 am | |
| 223 | 12/26 1:47 am | |
| 224 | 12/26 3:17 am | |
| 225 | 12/26 4:01 am | |
| 226 | 12/26 4:25 am | |
| 227 | 12/26 4:53 am | |
| 228 | 12/26 5:02 am | |
| 229 | 12/26 6:07 am | |
| 230 | 12/26 7:37 pm | |
| 231 | 12/27 1:12 am | |
| 232 | 12/27 1:40 am | |
| 233 | 12/27 2:54 am | |
| 234 | 12/27 3:45 am | |
| 235 | 12/27 5:24 am | |
| 236 | 12/27 1:05 pm | |
| 237 | 12/28 2:22 am | |
| 238 | 12/28 3:13 am | |
| 239 | 12/28 9:47 am | |
| 240 | 12/28 10:25 am | |
| 241 | 12/28 10:25 am | |
| 242 | 12/28 3:37 pm | |
| 243 | 12/28 5:21 pm | |
| 244 | 12/29 12:07 am | |
| 245 | 12/29 2:17 am | |
| 246 | 12/29 4:20 am | |
| 247 | 12/29 4:52 am | |
| 248 | 12/29 6:12 am | |
| 249 | 12/29 11:14 pm | |
| 250 | 12/30 4:00 am | |
| 251 | 12/30 7:10 am | |
| 252 | 12/30 7:53 am | |
| 253 | 12/30 12:52 pm | |
| 254 | 12/30 11:40 pm | |
| 255 | 12/31 1:21 am | |
| 256 | 12/31 3:45 am | |
| 257 | 12/31 5:28 am | |
| 258 | 12/31 7:27 am | |
| 259 | 12/31 10:02 am |
Submit flag
Write-up
zarnex's write-up was selected as the best write-up submitted for this challenge.
View this write-up on GitHub$ file chall chall: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=69603fa57a0c6db8d144004964ce8f86db96f1f8, for GNU/Linux 3.2.0, not stripped
It seems as we are working with an ELF file, which is short for Executable and Linkable Format. Think of it as Linux's version of a .exe. Lets run the program.
$ ./chall give me flag! not that easy pal :|
Well, that didn't help much but a decompilation could! A decompilation is the output of a decompiler which tries to make sense of the machine readable code and represents it a higher-level, human readable language. A good free tool to get a decompilation is dogbolt.org. Let's analyze our file with it.

Interesting, it seems as that there isn't a direct path to the flag. This could be a Buffer Overflow where we overflow it by 1 more than the buffer (in this case it's 4080) and when it overflows it sets the value to True. Let's try to overflow it!
$ python3 -c 'print("A" * 4081)' | ./chall # I used Python here to print out a large sum of characters. -c to run a command from the terminal
not that easy pal :|
$ python3 -c 'print("A" * 10000)' | ./chall
Day 2 gotta keep it simple :) Here is the flag: csd{d4y_2_H0w_r_u?}
*** stack smashing detected ***: terminated
[1] 1371982 done python3 -c 'print("A" * 10000)' |
1371983 IOT instruction (core dumped) ./chall
Wow, so it seems as our decompilation had failed us and showed us an incorrect buffer so I put a random buffer of 10 KB and it seemed to have been enough. However with my testing, I had found another method to solve this which leads me to believe why they made an annoucement on changing the category.
Solution 2
(gdb) disas main
Dump of assembler code for function main:
0x000055555555527a <+0>: endbr64
0x000055555555527e <+4>: push %rbp
0x000055555555527f <+5>: mov %rsp,%rbp
0x0000555555555282 <+8>: sub $0x1000,%rsp
0x0000555555555289 <+15>: orq $0x0,(%rsp)
0x000055555555528e <+20>: sub $0xff0,%rsp
0x0000555555555295 <+27>: mov %fs:0x28,%rax
0x000055555555529e <+36>: mov %rax,-0x8(%rbp)
0x00005555555552a2 <+40>: xor %eax,%eax
0x00005555555552a4 <+42>: movb $0x0,-0xa(%rbp)
0x00005555555552a8 <+46>: lea -0x1ff0(%rbp),%rax
0x00005555555552af <+53>: mov %rax,%rdi
0x00005555555552b2 <+56>: mov $0x0,%eax
0x00005555555552b7 <+61>: call 0x5555555550d0 <gets@plt>
0x00005555555552bc <+66>: movzbl -0xa(%rbp),%eax
0x00005555555552c0 <+70>: test %al,%al
0x00005555555552c2 <+72>: je 0x5555555552d0 <main+86>
0x00005555555552c4 <+74>: mov $0x0,%eax
0x00005555555552c9 <+79>: call 0x5555555551c9 <win>
0x00005555555552ce <+84>: jmp 0x5555555552df <main+101>
0x00005555555552d0 <+86>: lea 0xd65(%rip),%rax # 0x55555555603c
0x00005555555552d7 <+93>: mov %rax,%rdi
0x00005555555552da <+96>: call 0x555555555090 <puts@plt>
0x00005555555552df <+101>: mov $0x0,%eax
0x00005555555552e4 <+106>: mov -0x8(%rbp),%rdx
0x00005555555552e8 <+110>: sub %fs:0x28,%rdx
0x00005555555552f1 <+119>: je 0x5555555552f8 <main+126>
0x00005555555552f3 <+121>: call 0x5555555550b0 <__stack_chk_fail@plt>
0x00005555555552f8 <+126>: leave
0x00005555555552f9 <+127>: ret
End of assembler dump.
(gdb) b* 0x5555555552d0
Breakpoint 1 at 0x5555555552d0
(gdb) run
Starting program: /home/zarnex/advent_of_ctf/chall
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x00005555555552d0 in main ()
(gdb) jump win
Continuing at 0x5555555551d1.
Day 2 gotta keep it simple :) Here is the flag: csd{d4y_2_H0w_r_u?}
[Inferior 1 (process 1374232) exited normally]
(gdb)
Zarnex, what the hell is this? What i'm doing here is I am using a tool called a debugger which allows us to analyze the binary more dynamically. What I did was I first ran the program because of Address Space Layout Randomization (ASLR) which randomizes the memory addresses that the binary uses. If I didn't run it, the addresses would be completely different and I couldn't jump to win(). After I ran the program, I set a breakpoint at a random part of main before the check and then jumped to the win function which just printed out the flag.
Bonus: Solution 3
Looking at the win function we find this.

Now what is going on? It takes the hex string stored in &var_38 and XOR's it by 0xAA, so in theory we could just reverse that as seen in this Cyberchef Recipe.
Flag: csd{d4y_2_H0w_r_u?}