summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-02-17 16:39:57 -0500
committerMalfurious <m@lfurio.us>2023-02-17 16:39:57 -0500
commit7032a5c974daf03925313f426ef3d058dbd5cd59 (patch)
tree783d681075207e24010bdb014677637e17f01a4d
parent593d6ede20e054279f3bcd7c52bffa05b1eeae04 (diff)
parent44e95dc49dc6b8afa4bb49c6dd1cb2002866b0ca (diff)
downloadlib-des-gnux-7032a5c974daf03925313f426ef3d058dbd5cd59.tar.gz
lib-des-gnux-7032a5c974daf03925313f426ef3d058dbd5cd59.zip
Merge branch 'malf-lactf-2023'
* malf-lactf-2023: Writeup LACTF 2023 / Switcheroo Writeup LACTF 2023 / CTFd plus Writeup LACTF 2023 / A hacker's notes Writeup LACTF 2023 / One more time pad lactf 2023 results
-rw-r--r--docs/writeups/2023/lactf/crypto/one-more-time-pad.txt55
-rw-r--r--docs/writeups/2023/lactf/misc/a-hackers-notes.txt104
-rw-r--r--docs/writeups/2023/lactf/rev/ctfd-plus.txt125
-rw-r--r--docs/writeups/2023/lactf/rev/switcheroo.txt296
-rw-r--r--scores.txt2
5 files changed, 582 insertions, 0 deletions
diff --git a/docs/writeups/2023/lactf/crypto/one-more-time-pad.txt b/docs/writeups/2023/lactf/crypto/one-more-time-pad.txt
new file mode 100644
index 0000000..5c190af
--- /dev/null
+++ b/docs/writeups/2023/lactf/crypto/one-more-time-pad.txt
@@ -0,0 +1,55 @@
+I heard the onetime pad is perfectly secure so I used it to send an important
+message to a friend, but now a UCLA competition is asking for the key? I threw
+that out a long time ago! Can you help me recover it?
+
+
+
+
+The problem description implies a weakness through key reuse, however we can
+easily recover the key because we are given both a plaintext and corresponding
+ciphertext for a simple XOR cipher.
+
+The key is made up of the flag data, which is shorter than the actual message,
+so it is repeated using Python itertools.cycle to pad it out.
+
+```
+from itertools import cycle
+pt = b"Long ago, the four nations lived together in harmony ..."
+
+key = cycle(b"lactf{??????????????}")
+
+ct = ""
+
+for i in range(len(pt)):
+ b = (pt[i] ^ next(key))
+ ct += f'{b:02x}'
+print("ct =", ct)
+
+#ct = 200e0d13461a055b4e592b0054543902462d1000042b045f1c407f18581b56194c150c13030f0a5110593606111c3e1f5e305e174571431e
+```
+
+To get the flag, we ran this algorithm in reverse:
+
+```
+#!/usr/bin/env python3
+
+ct = (
+ b"\x20\x0e\x0d\x13\x46\x1a\x05\x5b\x4e\x59\x2b\x00\x54\x54\x39\x02"
+ b"\x46\x2d\x10\x00\x04\x2b\x04\x5f\x1c\x40\x7f\x18\x58\x1b\x56\x19"
+ b"\x4c\x15\x0c\x13\x03\x0f\x0a\x51\x10\x59\x36\x06\x11\x1c\x3e\x1f"
+ b"\x5e\x30\x5e\x17\x45\x71\x43\x1e" )
+
+pt = b"Long ago, the four nations lived together in harmony ..."
+key = ""
+
+for i in range(len(pt)):
+ b = (pt[i] ^ ct[i])
+ key += chr(b)
+
+print(key)
+```
+
+Because the key was cycled, we see repeated characters in the output, but the
+full flag is there.
+
+lactf{b4by_h1t_m3_0ne_m0r3_t1m3}lactf{b4by_h1t_m3_0ne_m0
diff --git a/docs/writeups/2023/lactf/misc/a-hackers-notes.txt b/docs/writeups/2023/lactf/misc/a-hackers-notes.txt
new file mode 100644
index 0000000..37719da
--- /dev/null
+++ b/docs/writeups/2023/lactf/misc/a-hackers-notes.txt
@@ -0,0 +1,104 @@
+We managed to get ahold of a flash drive which we think contains the decryption
+keys for the ransomware that a hacker group tried to deploy on our computer
+network! However, it seems like the hacker encrypted the flash drive. We know
+that the organization uses passwords in the format hacker### (hacker + 3 digits)
+for their disks, but a much stronger encryption password once you login. Can
+you try to get access to their notes?
+
+
+
+
+LUKS decryption
+---------------
+We are given a zip file containing an image file of the flash drive. As stated
+in the problem description, it is a LUKS encrypted volume. Fortunately, the
+passphrase is of a known format and we only have a small search space to guess
+the three unknown digits at the end. We wrote a short shell script to
+brute force the password guessing.
+
+```
+#!/bin/bash
+
+for num in {0..1000}; do
+ echo "hacker${num}" | sudo cryptsetup open /dev/loop0 hackerdrive
+ if [ $? -eq 0 ]; then
+ echo "hacker${num}"
+ break
+ fi
+done
+```
+
+/dev/loop0 is a loop device backed by the unzipped image. When run, this script
+will eventually print the password 'hacker765' and a mapped device will be
+unlocked.
+
+
+
+
+Recon
+-----
+With the unlocked volume mounted, we performed a manual search for interesting
+files. Among these were:
+
+/note_to_self.txt
+```
+Note to self: delete notes and notes_normalized tables in
+.config/joplin/database.sqlite when not in use; allow encrypted sync to restore
+notes after
+```
+
+/.sqlite_history
+```
+[...]
+pragma secure_delete;
+select * from notes_normalized;
+delete from notes_normalized;
+select * from notes_normalized;
+vacuum;
+.exit
+```
+
+/.config/joplin/log.txt
+```
+[...]
+2023-01-16 01:06:52: "Initializing tables..."
+2023-01-16 01:06:52: "KeychainService: checking if keychain supported"
+2023-01-16 01:06:52: "KeychainService: could not set test password - keychain support will be disabled"
+2023-01-16 01:06:52: e2ee/utils: "Master password is not set - trying to get it from the active master key..."
+2023-01-16 01:06:52: handleSyncStartupOperation: "Processing operation:", "0"
+2023-01-16 01:06:52: App: "Client ID: 5250b22a001e444bbfc4b332e840dea3"
+2023-01-16 01:06:52: "First start: detected locale as en_GB"
+2023-01-16 01:06:52: models/Setting: "Skipping all default migrations..."
+2023-01-16 01:06:52: e2ee/utils: "Trying to load 0 master keys..."
+2023-01-16 01:06:52: e2ee/utils: "Loaded master keys: 0"
+[...]
+```
+
+/.config/joplin/settings.json
+```
+{
+ "$schema": "https://joplinapp.org/schema/settings.json",
+ "locale": "en_GB",
+ "api.token": "5c3c596604f44ea76007d85c35e97d3a3e7307079a3f9a68e91b62a4ab66b8a8ce0da3693d1e0226709e80887b9428f8a79d281fd468c81b0385000fc6f31052",
+ "markdown.plugin.softbreaks": false,
+ "markdown.plugin.typographer": false,
+ "editor": "emacs",
+ "sync.target": 2,
+ "sync.2.path": "/home/h4ck3r/encrypted-notes"
+}
+```
+
+
+
+
+Joplin
+------
+Joplin's website says: "Joplin is an open source note-taking app. Capture your
+thoughts and securely access them from any device." After a while of studying
+the files shown above, we conculded that the encrypted notes store was also
+included on the hacker's flash drive, at /encrypted-notes/. Futrhermore, that
+the Joplin app was configured to be capable of performing a sync automatically.
+
+We setup a Joplin instance and manually imported the hacker's config prompting
+the program to autonomously update with the content of the encrypted notes
+database tables. The flag was contained within them.
diff --git a/docs/writeups/2023/lactf/rev/ctfd-plus.txt b/docs/writeups/2023/lactf/rev/ctfd-plus.txt
new file mode 100644
index 0000000..cf8df62
--- /dev/null
+++ b/docs/writeups/2023/lactf/rev/ctfd-plus.txt
@@ -0,0 +1,125 @@
+CTFd is too insufferably slow. You know why? Because they use an SQL database
+that's bogged down by JOINs instead of a web scale database like MongoDB.
+MongoDB is web scale. You turn it on and it scales right up. You know what's
+more web scale though? Nothing. That's right, the throughput of /dev/null is
+off the charts. Behold, CTFd+, the first databaseless CTF platform. Can you
+get the flag for the only challenge?
+
+
+
+
+RE
+--
+We are given a binary that presents a welcome message along with a dummy PWN
+challenge, then asks for the flag for said challenge. As this is a mock CTF
+platform, it is a flag checker RE challenge. The content of the embedded PWN
+is not relevant: the program just calls `puts` then exits.
+
+Ghidra shows that the flag we supply is validated character by character
+against the result of some computation performed on a static array of data.
+(Some markup provided by me).
+
+```
+undefined8 main(void)
+{
+ int flag_check_char;
+ size_t flag_in_len;
+ long idx;
+ int *static_data;
+ char flag_in [256];
+
+ puts("Welcome to CTFd+!");
+ puts(
+ "So far, we only have one challenge, which is one more than the number of databases we have.\n "
+ );
+ puts("Very Doable Pwn - 500 points, 0 solves");
+ puts("Can you help me pwn this program?");
+ puts("#include <stdio.h>\nint main(void) {\n puts(\"Bye!\");\n return 0;\n}\n");
+ puts("Enter the flag:");
+ fgets(flag_in,0x100,stdin);
+ flag_in_len = strcspn(flag_in,"\n");
+ idx = 0;
+ static_data = INT_ARRAY_00104060;
+ flag_in[flag_in_len] = '\0';
+ do {
+ flag_check_char = flag_gen(static_data[idx]);
+ if ((char)flag_check_char != flag_in[idx]) {
+ puts("Incorrect flag.");
+ return 0;
+ }
+ idx = idx + 1;
+ } while (idx != 0x2f);
+ puts("You got the flag! Unfortunately we don\'t exactly have a database to store the solve in...")
+ ;
+ return 0;
+}
+```
+
+If at any point in the validation a character fails, the whole flag is
+considered incorrect.
+
+
+
+
+Solution
+--------
+To extract the expected flag, I ported the static data and the `flag_gen`
+computation logic to a standalone C program and simply print out the value of
+each character. We know the expected size of the flag string from the bounds
+of `main`'s while loop (`while (idx != 0x2f)`).
+
+```
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/types.h>
+
+typedef unsigned char byte;
+
+static const unsigned char DATA[] = {
+ 0x74, 0x92, 0x7f, 0x9c, 0xe9, 0x0c, 0xbb, 0xc2, 0x29, 0x19, 0x9b, 0x40,
+ 0xd7, 0x6e, 0x3d, 0xbe, 0x04, 0xe1, 0x83, 0x4f, 0x83, 0xd4, 0x85, 0x91,
+ 0xaf, 0x70, 0x5d, 0xfd, 0xf1, 0x7f, 0xc4, 0x88, 0x71, 0xfa, 0x78, 0xe6,
+ 0x0d, 0xdf, 0xcb, 0x72, 0xa7, 0x3d, 0xb6, 0xf4, 0x3d, 0x9e, 0x29, 0x54,
+ 0xf4, 0x7b, 0x05, 0xaa, 0xa3, 0x4d, 0x14, 0x14, 0x3c, 0x02, 0xc6, 0xe1,
+ 0x39, 0xb5, 0xb9, 0x74, 0x0f, 0xd8, 0x5f, 0x54, 0x29, 0x73, 0x7a, 0x04,
+ 0x3f, 0xd9, 0x41, 0xad, 0xd0, 0xbc, 0x16, 0x96, 0x50, 0x62, 0x59, 0x76,
+ 0x0f, 0xec, 0xa7, 0xaa, 0x2f, 0xf2, 0xb1, 0x21, 0x7e, 0xb3, 0x80, 0x87,
+ 0x15, 0x14, 0x8d, 0x76, 0x60, 0xad, 0xf3, 0x56, 0x4d, 0x6f, 0x84, 0x2c,
+ 0x3e, 0x57, 0x38, 0x15, 0x9e, 0x7b, 0x95, 0x6a, 0x70, 0x08, 0x03, 0xaa,
+ 0xbc, 0xbf, 0xc7, 0x27, 0x4d, 0x88, 0x2e, 0x47, 0x71, 0x09, 0x34, 0xbc,
+ 0x94, 0xc0, 0x70, 0x95, 0xea, 0x21, 0x55, 0xd6, 0xbe, 0x14, 0x84, 0x86,
+ 0x8d, 0xec, 0xf7, 0xff, 0xff, 0x65, 0x14, 0xaa, 0xa7, 0x6a, 0xd1, 0x21,
+ 0x0c, 0xc1, 0x97, 0x84, 0xf7, 0xd2, 0x3a, 0x51, 0xca, 0xbb, 0x11, 0x62,
+ 0xe5, 0xc8, 0x99, 0x87, 0xbd, 0xfc, 0x37, 0xb5, 0xed, 0x29, 0xcc, 0x44,
+ 0x5d, 0xd9, 0x8a, 0x40, 0xb1, 0x02, 0x09, 0x2d };
+
+int flag_gen(uint param_1)
+{
+ byte bVar1;
+ uint uVar2;
+ int iVar3;
+
+ uVar2 = 0;
+ iVar3 = 0;
+ do {
+ bVar1 = (byte)iVar3 & 0x1f;
+ iVar3 = iVar3 + 1;
+ param_1 = (param_1 * param_1 >> bVar1 | param_1 * param_1 << 0x20 - bVar1) * 0x1337 + 0x4201337
+ ^ uVar2;
+ uVar2 = uVar2 + 0x13371337;
+ } while (iVar3 != 0x20);
+ return (param_1 >> 8) + (param_1 >> 0x10) + param_1 + (param_1 >> 0x18);
+}
+
+int main(void) {
+ const int *arr = (void *)DATA;
+ for (int i = 0; i < 47; i++) {
+ int c = flag_gen(arr[i]);
+ printf("%c", (char)c);
+ }
+ printf("\n");
+ return 0;
+}
+```
+
+lactf{m4yb3_th3r3_1s_s0m3_m3r1t_t0_us1ng_4_db}
diff --git a/docs/writeups/2023/lactf/rev/switcheroo.txt b/docs/writeups/2023/lactf/rev/switcheroo.txt
new file mode 100644
index 0000000..c7cd4e5
--- /dev/null
+++ b/docs/writeups/2023/lactf/rev/switcheroo.txt
@@ -0,0 +1,296 @@
+Never fear, the flag shall not appear (in memory)! I've switched it out for a
+more secure system!
+
+Note: The actual flag consists purely of non-whitespace printable characters
+(aka ascii values 0x21 through 0x7e).
+
+
+
+
+RE
+--
+The switcheroo binary is compiled from assembly language, rather than C or
+anything else higher-level. However, it is still very useful to use Ghidra to
+analyze strings and add additional comments and markup in the code listing view.
+
+Given the above, the file is actually quite small and simple. We have just a
+couple boilerplate sections in the ELF, .data contains 3 strings and an array of
+64-bit integers, and all of the logic lies sequentially under .text.
+
+The program is a flag checker. When run, it first asks you to input the flag,
+then asserts that the size of input == 64, so we know the length of the expected
+flag. To validate the content of the proposed flag, we enter a loop to iterate
+over each input character (this is denoted by the `loop_start` label below).
+
+For each input character, we start by using the value of that character (ascii
+as an int) as an index into the 64-bit integer array found in the program. The
+value we lookup will encode what position(s) the character index may correctly
+occupy in the real flag. We enter an inner loop to decode the 64-bit value.
+
+At each step, an 8-bit left bit rotation is performed on the value, we then look
+at the resulting lowest-order byte in the 64-bit value. The first value we
+extract is a count value.
+
+The code asserts that the value of the current flag character position (as a
+byte) exists in the looked-up value within the next `count` byte rotations.
+This area is denoted by the `inner_loop_start` label below. If we hit a
+matching position value, the outer loop advances. However, if we exhaust
+`count` many rotations before that occurs, we increment another register that
+records how many failed characters were given, and the outer loop continues
+regardless.
+
+If the outer loop finishes without incrementing the failure register, the
+correct flag was given. See the full .text logic here, with some markup from
+me:
+
+```
+ undefined __stdcall entry(void)
+ undefined AL:1 <RETURN>
+ undefined1 Stack[0x0]:1 local_res0 XREF[1]: 00401040(*)
+ entry XREF[4]: Entry Point(*), 00400018(*),
+ 00400088(*),
+ _elfSectionHeaders::00000090(*)
+00401000 48 8d 34 LEA RSI,[s_Give_me_the_flag:_00402000] = "Give me the flag: "
+ 25 00 20
+ 40 00
+00401008 bf 01 00 MOV EDI,0x1
+ 00 00
+0040100d ba 12 00 MOV EDX,0x12
+ 00 00
+00401012 b8 01 00 MOV EAX,0x1
+ 00 00
+ write(stdout, "Give me the flag", size)
+00401017 0f 05 SYSCALL
+00401019 31 ff XOR EDI,EDI
+0040101b 48 89 e6 MOV RSI,RSP
+0040101e ba 64 00 MOV EDX,0x64
+ 00 00
+00401023 31 c0 XOR EAX,EAX
+ read(stdin, &stack, 100)
+00401025 0f 05 SYSCALL
+00401027 48 83 f8 40 CMP RAX,0x40
+ if read() != 64: fail
+0040102b 75 5e JNZ fail
+0040102d 4d 31 e4 XOR R12,R12
+00401030 4c 8d 1c LEA R11,[static_data]
+ 25 3c 20
+ 40 00
+00401038 4d 31 d2 XOR R10,R10
+ loop_start XREF[1]: 00401071(j)
+0040103b 49 39 c2 CMP R10,RAX
+0040103e 7d 33 JGE loop_break
+ R9 = stack[R10] // get current char
+00401040 4e 0f b6 MOVZX R9,byte ptr [RSP + R10*0x1]=>local_res0
+ 0c 14
+ R8 = static_data[R9] // lookup long by current char
+00401045 4e 8b 04 MOV R8,qword ptr [static_data + R9*0x8]
+ cd 3c 20
+ 40 00
+ rotate left by 8-bits (1-byte)
+0040104d 49 c1 c0 08 ROL R8,0x8
+ R13 = (char)(static_data[stack[i]] >> 56)
+00401051 4d 0f b6 e8 MOVZX R13,R8B
+00401055 4d 31 f6 XOR R14,R14
+ while R14 < R13
+ inner_loop_start XREF[1]: 00401069(j)
+00401058 4d 39 ee CMP R14,R13
+0040105b 7d 0e JGE inner_loop_break_bad
+0040105d 49 c1 c0 08 ROL R8,0x8
+00401061 45 38 d0 CMP R8B,R10B
+00401064 74 08 JZ inner_loop_break_good
+00401066 49 ff c6 INC R14
+00401069 eb ed JMP inner_loop_start
+ inner_loop_break_bad XREF[1]: 0040105b(j)
+0040106b 49 ff c4 INC R12
+ inner_loop_break_good XREF[1]: 00401064(j)
+0040106e 49 ff c2 INC R10
+00401071 eb c8 JMP loop_start
+ loop_break XREF[1]: 0040103e(j)
+00401073 4d 85 e4 TEST R12,R12
+00401076 75 13 JNZ fail
+00401078 eb 02 JMP success
+0040107a eb ?? EBh
+0040107b 00 ?? 00h
+ success XREF[1]: 00401078(j)
+0040107c 48 8d 34 LEA RSI,[s_That_was_the_flag!_0040202a] = "That was the flag!"
+ 25 2a 20
+ 40 00
+00401084 ba 12 00 MOV EDX,0x12
+ 00 00
+00401089 eb 0f JMP exit
+ fail XREF[2]: 0040102b(j), 00401076(j)
+0040108b 48 8d 34 LEA RSI,[s_That_was_not_the_flag_:(_00402012] = "That was not the flag :("
+ 25 12 20
+ 40 00
+00401093 ba 18 00 MOV EDX,0x18
+ 00 00
+00401098 eb 00 JMP exit
+ exit XREF[2]: 00401089(j), 00401098(j)
+0040109a bf 01 00 MOV EDI,0x1
+ 00 00
+0040109f b8 01 00 MOV EAX,0x1
+ 00 00
+ write(stdout, "That was [not] the flag", size)
+004010a4 0f 05 SYSCALL
+004010a6 6a 0a PUSH 0xa
+004010a8 48 89 e6 MOV RSI,RSP
+004010ab ba 01 00 MOV EDX,0x1
+ 00 00
+004010b0 b8 01 00 MOV EAX,0x1
+ 00 00
+ write(stdout, "\n", 1)
+004010b5 0f 05 SYSCALL
+004010b7 31 ff XOR EDI,EDI
+004010b9 48 c7 c0 MOV RAX,0x3c
+ 3c 00 00 00
+ exit(0)
+004010c0 0f 05 SYSCALL
+```
+
+
+
+
+Solution
+--------
+To extract the flag, I extracted the 64-bit integer array to attempt to fully
+decode it. With the rules we learned during RE, we know that each entry can be
+used to validate whether or not it resides at any given position in the flag
+string.
+
+I wrote a C program to iterate over a flag string (aka position from 0 -> 64)
+and print any character value (aka array entry at an ascii index) that _would_
+pass validation. This initially gave some ambiguous results, however when my
+search was restricted per the problem description (0x21 -> 0x7e), a unique flag
+appears.
+
+```
+#include <stdio.h>
+
+static const unsigned char A[] = {
+ 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x07, 0x7e, 0xfc, 0x3c, 0x78,
+ 0xfb, 0xf4, 0x04, 0x3e, 0x03, 0x87, 0x30, 0x04, 0x3d, 0x81, 0x70, 0x9d,
+ 0x4d, 0xa7, 0x3d, 0x09, 0xf8, 0xa1, 0x51, 0x4a, 0xfc, 0x02, 0x8b, 0xa8,
+ 0xb2, 0x50, 0x49, 0x0c, 0x4b, 0xf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97, 0xec, 0x04, 0x37, 0x01, 0x25, 0x0b, 0x6c, 0x8b,
+ 0xe4, 0xc9, 0x4e, 0x00, 0xdd, 0xe1, 0xa5, 0x12, 0x0d, 0xc4, 0x55, 0x00,
+ 0x0e, 0xe4, 0x20, 0xc4, 0xfc, 0xd4, 0xf0, 0x00, 0xf3, 0x27, 0x8b, 0x99,
+ 0xc1, 0xb8, 0x9b, 0x00, 0xf6, 0x1a, 0x04, 0x04, 0x5d, 0xc8, 0xca, 0x00,
+ 0x05, 0xba, 0x8e, 0x89, 0xaf, 0x41, 0x05, 0x02, 0x95, 0x10, 0x67, 0x3d,
+ 0x26, 0xb0, 0x2c, 0x00, 0x43, 0x36, 0xac, 0xe7, 0xff, 0x42, 0x3e, 0x02,
+ 0x87, 0x60, 0x09, 0x4e, 0x62, 0xf3, 0x19, 0x00, 0xec, 0x88, 0xa7, 0x5a,
+ 0x99, 0xd3, 0xf8, 0x26 };
+
+static const unsigned long *B = (unsigned long *)A;
+
+static void rol(long *v) {
+ long tmp = *v << 8;
+ tmp |= *v >> 56;
+ *v = tmp;
+}
+
+int check_char_in_pos(int c, int pos) {
+ long value = B[c];
+ rol(&value);
+
+ for (int count = value & 0xff; count > 0; count--) {
+ rol(&value);
+
+ if ((value & 0xff) == pos)
+ return 1;
+ }
+
+ return 0;
+}
+
+int main(void) {
+ for (int pos = 0; pos < 0x40; pos++) {
+ for (int c = 0x21; c <= 0x7e; c++) {
+ if (check_char_in_pos(c, pos)) {
+ printf("%c", (char)c);
+ break;
+ }
+ }
+ }
+
+ printf("\n");
+ return 0;
+}
+```
+
+lactf{4223M8LY_5W17Ch_57473M3n75_4r3_7h3_4850LU73_8357_u+1f60a}
+
+I still don't know where the switch statement was...
diff --git a/scores.txt b/scores.txt
index 8eb89b4..835a726 100644
--- a/scores.txt
+++ b/scores.txt
@@ -21,3 +21,5 @@ Metasploit Community CTF 2021 1300 22 /265 (727)
picoCTF 2022 13100 140 /7794
angstromCTF 2022 2111 80 /1179 (1319)
X-MAS CTF 2022 1123 66 /816 (1451)
+
+lactf 2023 5683 98 /980