ãã®å¤§ä¼ã¯2024/10/26 16:00(JST)ï½2024/10/28 4:00(JST)ã«éå¬ããã¾ããã
ãã®å¤§ä¼ã¯å人æ¦ãçµæã¯1900ç¹ã§126人ä¸23ä½ã§ããã
é常ã«æ®å¿µãããå°ãä¸ä½ã«è¡ãããã£ãã
ã¹ã³ã¢ã®ã«ãã´ãªãã¨ã®åå¸ã¯ãããªæãã
1åã解ããªãã£ãåé¡ã«ãã´ãªã¯Reverse Engineeringã¨Web Securityã
Reverse Engineeringã§ãã1åã¯è«ççã«ã¯åã£ã¦ããã¯ãã§ãããprintableãªæååã«ãªããªãã®ã§ãã©ããééã£ã¦ããã®ãããã解ããã¨ãã§ããæ®å¿µã§ãã
èªåã®è§£ããåé¡ãWriteupã¨ãã¦æ¸ãã¦ããã¾ãã
Welcome to UrchinSec (Miscellaneous 100)
Discordã«å ¥ãã#welcomeãã£ãã«ã®ãããã¯ãè¦ãã¨ããã©ã°ãæ¸ãã¦ãã£ãã
urchinsec{welcome_to_UrCh1nSe(}
Follow Us (OSINT 100)
https://www.instagram.com/urchinsec_ãè¦ã¦ã¿ãã2ã¤ç®ã®ç»åã«ã³ã¡ã³ããããã®ã§ãè¦ã¦ã¿ãã¨ããã©ã°ãæ¸ãã¦ãã£ãã
urchinsec{d0nt_f0rg3t_tO_f0ll0w_us}
Heart (Secure Code Reviewing 100)
ã³ã¼ãã®èå¼±æ§ã®ããè¡ã¨ãèå¼±æ§ã®ååãçããåé¡ãã³ã¼ãã¯ä»¥ä¸ã®éãã
from flask import Flask, request, render_template_string app = Flask(__name__) @app.route('/name/<input_name>', methods=['GET']) def say_name(input_name): if request.method == 'GET': if input_name is not None: return render_template_string(f"Hello {input_name}") if __name__ == '__main__': app.run(host='127.0.0.1', port=5555)
9è¡ç®ã§å ¥åå¤ã{input_name}ã¨ããå½¢ã§æ¸¡ããã¦ãã¦ãSSTIã®èå¼±æ§ãããã
urchinsec{9_SSTI}
RedHand (Secure Code Reviewing 100)
ã³ã¼ãã®èå¼±æ§ã®ååãçããåé¡ãã³ã¼ãã¯ä»¥ä¸ã®éãã
<?=`$_GET[0]`?>
Web Shellã§OSã³ãã³ããå®è¡ã§ããã®ã§ãCommand Injectionã¨è¨ããã
urchinsec{command_injection}
Syringe (Secure Code Reviewing 100)
ã³ã¼ãã®èå¼±æ§ã®ããè¡ã¨ãèå¼±æ§ã®ååãçããåé¡ãã³ã¼ãã¯ä»¥ä¸ã®éãã
const express = require('express'); const mysql = require('mysql'); const app = express(); const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: 'Sup3rStr0ngP@ssw0rd!', database: 'syringe_hospital' }); app.get('/get-patients', (req, res) => { const patient_name = req.query.patient_name; const query = `SELECT * FROM patients WHERE patient_name = '${patient_name}'`; connection.query(query, (error, results) => { if (error) throw error; res.send(results); }); }); app.listen(3000, () => { console.log('Server running on http://localhost:3000'); });
15è¡ç®ã§å ¥åå¤ã${patient_name}ã¨ããå½¢ã§æ¸¡ããã¦ãããSQL Injectionã®èå¼±æ§ãããã
urchinsec{15_SQLi}
10 Round (Forensics 100)
RARãã¡ã¤ã«ã¨æãããããå é 2ï½3ãã¤ãç®ãå£ãã¦ããã®ã§ã以ä¸ã®ããã«ä¿®å¾©ããã
00 00 â 61 72
解åããã¨ãflagãã¡ã¤ã«ãå±éãããã
$ file flag flag: ARJ archive data, v11, slash-switched, created 27 aug 1980+51, original name: flag.arj, os: Unix $ mv flag flag.arj
7.zipã§è§£åããã¨ãflagãã¡ã¤ã«ãå±éãããã
$ file flag flag: Zstandard compressed data (v0.8+), Dictionary ID: None $ mv flag flag.zst $ zstd -d flag.zst flag.zst : 598 bytes $ file flag flag: LZMA compressed data, streamed $ mv flag flag.lzma $ xz --format=lzma --decompress flag.lzma xz: flag: Cannot set the file permissions: Value too large for defined data type $ file flag flag: 7-zip archive data, version 0.4 $ mv flag flag.7z $ 7z x flag.7z 7-Zip 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20 64-bit locale=en_US.UTF-8 Threads:32 OPEN_MAX:1024 Scanning the drive for archives: 1 file, 598 bytes (1 KiB) Extracting archive: flag.7z -- Path = flag.7z Type = 7z Physical Size = 598 Headers Size = 130 Method = LZMA2:12 Solid = - Blocks = 1 Everything is Ok Size: 464 Compressed: 598 $ file flag.tar.xz flag.tar.xz: XZ compressed data, checksum CRC64 $ tar Jxfv flag.tar.xz flag.zip $ unzip flag.zip Archive: flag.zip extracting: flag $ file flag flag: XZ compressed data, checksum CRC64 $ mv flag flag.xz $ unxz flag.xz unxz: flag: Cannot set the file permissions: Value too large for defined data type $ file flag flag: bzip2 compressed data, block size = 900k $ mv flag flag.bz2 $ bzip2 -d flag.bz2 $ file flag flag: gzip compressed data, was "flag", last modified: Fri Oct 25 05:27:03 2024, from Unix, original size modulo 2^32 47 $ mv flag flag.gz $ gzip -d flag.gz gzip: flag: Value too large for defined data type $ file flag flag: ASCII text $ cat flag urchinsec{d0ubl3_c0mpr3s51on_1s_c00l_1cf5d3a2}
urchinsec{d0ubl3_c0mpr3s51on_1s_c00l_1cf5d3a2}
Log-ical - Part 1 (Forensics 100)
éä¸ãã以ä¸ã®UserAgentã§ã¢ã¯ã»ã¹ãã¦ãããã°ãããã
Mozilla/5.0 (compatible; Nmap Scripting Engine; https://nmap.org/book/nse.html)
ããã¯nmapã§åµå¯ãã¦ããã¨æããããæ»æå IPã¢ãã¬ã¹ã¯10.0.100.13ã«ãªã£ã¦ãããã¾ããªãã¡ã©ã«10.0.100.2ãå«ã¾ãã¦ãããã°ãããã®ã§ããããã¿ã¼ã²ããã®IPã¢ãã¬ã¹ã¨èããããã
urchinsec{10.0.100.13_10.0.100.2}
Open Letter (Forensics 300)
解åããword\settings.xmlãè¦ãã¨ãXMLãã¼ã¿ã®ä¸ã«ä»¥ä¸ãå«ã¾ãã¦ããã
Here is the Admin password: urchinsec{w0rd2z1p_zip2w0rd_c9f2d3a0}
urchinsec{w0rd2z1p_zip2w0rd_c9f2d3a0}
Box (Cryptography 100)
ã¹ãã¥ã¿ã¬ã¼æå·ã¨æ¨æ¸¬ãã4æåãã¨ã«æ¹è¡ã縦ã«èªãã
b__o oltx xio⣠_k_⣠iebâ£
box_i_like_to_box
urchinsec{box_i_like_to_box}
Destination (Cryptography 100)
ASCIIã³ã¼ãããã¤ãã¹1ãã¦ããã³ã¼ãããã
>>> s = '118 115 100 105 106 111 116 102 100 124 66 84 68 74 74 96 117 115 53 111 116 103 49 115 110 96 50 99 105 57 102 54 126' >>> ''.join([chr(int(c) - 1) for c in s.split(' ')]) 'urchinsec{ASCII_tr4nsf0rm_1bh8e5}'
urchinsec{ASCII_tr4nsf0rm_1bh8e5}
Shifty Business (Cryptography 100)
æå·ã®åå¤ãå³ã·ããã§nã®åå¤ã®åã ãã·ããããã¨ããã©ã°ã®åæåã®ASCIIã³ã¼ãã2ä¹ãããã®ã«ãªãããã®ãã¨ã使ã£ã¦å¾©å·ããã
#!/usr/bin/env python3 from gmpy2 import iroot with open('output.txt', 'r') as f: enc = eval(f.read()) flag = '' for c in enc: v = c >> (16 + 32 + 64 + 128) code, success = iroot(v, 2) assert success flag += chr(code) print(flag)
urchinsec{1t's_4all_ab0u+_e45y_3ncRyPT10N_e4c8a1}
Tr3ppl3 Stuffs (Cryptography 300)
n1ã¨n2ã®GCDã¯pãªã®ã§ãq, rãç®åºãããã¨ãã§ããããã¨ã¯n3, n2, n1ãã¢ã¸ã¥ãã¨ããRSAæå·ã®å¾©å·ãé ã«è¡ã£ã¦ããã°ãã©ã°ã«ãªãã
#!/usr/bin/env python3 from Crypto.Util.number import * with open('public-key.txt', 'r') as f: params = f.read().splitlines() n1 = int(params[0].split(' ')[1]) n2 = int(params[1].split(' ')[1]) n3 = int(params[2].split(' ')[1]) e = int(params[3].split(' ')[1]) c = int(params[4].split(' ')[1]) p = GCD(n1, n2) q = n1 // p r = n2 // p assert q * r == n3 ns = [n1, n2, n3] phis = [(p - 1) * (q - 1), (p - 1) * (r - 1), (q - 1) * (r - 1)] for i in range(len(ns)): d = inverse(e, phis[2 - i]) c = pow(c, d, ns[2 - i]) flag = long_to_bytes(c).decode() print(flag)
URCHINSEC{Wh00ps_tr1ppl3_RS4_15_N0t_3v3n_h4rd_s0met1mes}
WarmUp (Cryptography 300)
æå·å¦çã®æ¦è¦ã¯ä»¥ä¸ã®éãã
ã»message: æªç¥ ã»knapsack = generate_knapsack() ãã»knapsack = [1, 2] ãã»ä»¥ä¸6åç¹°ãè¿ã ããã»knapsackã«knapsackã®åã«ãã©ã¹1ããå¤ã追å ãã»knapsackãè¿å´ ã»m = 257 ã»n: -1000以ä¸1000以ä¸ã©ã³ãã æ´æ° ã»ciphertext = encrypt_message(message, knapsack, m, n) ãã»bits = convert_to_bits(message) ããã»bits: messageã1æåãã¤8æ¡ã®2é²æ°æååã«ãã1ããããã¤ã«ãããã®ã®é å ããã»bitsãè¿å´ ãã»chunk_size: knapsackã®é·ã ãã»chunks: bitsãchunk_sizeã®é·ããã¨ã«ããé å ãã»ciphertext = [] ãã»chunksã®åchunkã«ã¤ãã¦ä»¥ä¸ãå®è¡ ããã»chunkã®é·ããchunk_sizeããå°ããå ´å ãããã»chunkã«[0]ãããã£ã³ã° ããã»c_value: knapsackã¨chunkã®åå¤ã®æãç®ã®å ããã»encrypted_value = (c_value * n) % m ããã»ciphertextã«encrypted_valueã追å ãã»ciphertextãè¿å´ ã»ciphertextãåºå
ãã©ã°ã"urchinsec{"ããå§ã¾ããã¨ãåæã«nãå²ãåºãããã¨ã¯ãã©ã°ã®åæåã§ãã«ã¼ããã©ã¼ã¹ã§æå·ãä¸è´ãããã®ãå²ãåºãã復å·ããã
#!/usr/bin/env python3 from Crypto.Util.number import * def generate_knapsack(): knapsack = [1, 2] for i in range(6): knapsack.append(sum(knapsack) + 1) return knapsack def convert_to_bits(message): bits = [] for char in message: char_bits = bin(ord(char))[2:].zfill(8) bits.extend([int(b) for b in char_bits]) return bits knapsack = generate_knapsack() m = 257 with open('out.txt', 'r') as f: ciphertext = eval(f.read().split(': ')[1]) flag_head = 'urchinsec{' bits = convert_to_bits(flag_head) chunk_size = len(knapsack) chunks = [bits[i:i + chunk_size] for i in range(0, len(bits), chunk_size)] c_value = sum(k * b for k, b in zip(knapsack, chunks[0])) n = ciphertext[0] * inverse(c_value, m) % m for i in range(1, len(chunks)): c_value = sum(k * b for k, b in zip(knapsack, chunks[i])) tmp_n = ciphertext[i] * inverse(c_value, m) % m assert tmp_n == n flag = '' for i in range(len(ciphertext)): for code in range(32, 127): bit = bin(code)[2:].zfill(8) chunk = [int(c) for c in list(bit)] c_value = sum(k * b for k, b in zip(knapsack, chunk)) encrypted_value = (c_value * n) % m if encrypted_value == ciphertext[i]: flag += chr(code) break print(flag)
urchinsec{w000oow!!!_M4st3r_H0w_d1d_y0u_g3t_it????}