近期更新概览

普通文章(1)

WriteUp(6):不在主页展示,集中放在 WriteUp tag

January 20, 2026

年度总结 - 2025(置顶)

自从接触到工作,记忆节点似乎就由工作为 key,其余为 value,所以本篇 blog 的时间线基本都是由工作发散的
Read more
June 29, 2024

2024.6.29 某行业赛 一道 Crypto+Misc 希尔密码

Hill Cipher(不知道题目叫什么名字) 下载题目附件后打开看到 / 拖到 010 Editor 提示报错,注意到文件末尾存在字符串,且为三的倍数 / 同时结合图片名为 hill.png 以及图片中数字的排列,推导可能是 Hill Cipher
Read more
June 28, 2024

2024.6.28 某(农信?)行业赛 Crypto 与 Misc

Crypto easyLCG 题目代码 from Crypto.Util.number import * from random import randint FLAG = ? ROUND = randint(200, 300) class LCG: lcg_a = getPrime(498) lcg_b = getPrime(498) lcg_n = getPrime(512) def __init__(self, lcg_seed): self.state = lcg_seed def next(self): self.state = (self.state * self.lcg_a + self.lcg_b) % self.lcg_n return self.state seed = bytes_to_long(FLAG) print(seed.bit_length()) lcg = LCG(seed) for _ in range(ROUND-6): lcg.next() print([lcg.next() for _ in range(6)]) # 351 # [2485483242304449696161151168576736302336140244327446722677621064961717587947642623655706309294371876714311165214262071924932913930440142186509325733360885, 6174672247406972581092780254648964828729162316422924118545162215261641830776919624579500836375440017861960302702691972683448546062254126073514097080361044, 4584872703321313263026316988830140564935997972340636369234263637913498924218112980629201945528119162637762726584003527994733552009906632734086040880127542, 4829175497283310360340169484343201154685159906303099960915060755507745973302279262836696523131741537828200567942990339422885197644614494869008027862313162, 6669041483112643196441450289748743294802963984583343809912658359929976814854869038886397237458253328867571805574485994275429182399171275201561798677581761, 2732859498560958306654933055106793656103744294844703560692860713169132266734427400301681246251133210447387861776419850678194913478737337289544516324708390] 思路 比较基础的参数恢复后逆推 seed / flag 是初始 seed 的 bytes 形式, 且 seed 的 bit 长度为 $351$ / 同时分析代码中 class LCG 的 next() 有
Read more
June 24, 2024

熊猫杯初赛与决赛 Crypto WriteUp

初赛密码题只有一道,还沾了点猜谜… / 绝密文件-代号P 题目代码 import cv2 import numpy as np from Crypto.Util.number import * from secret import p, q, c def arnold(img, shuffle_times, a, b): r, c, d = img.shape # d: dimension p = np.zeros(img.shape, np.uint8) # new image for s in range(shuffle_times): # shuffle times for i in range(r): # height for j in range(c): # width x = (i + b * j) % r # new position y = ((a * i) + (a * b + 1) * j) % c # new position p[x, y, :] = img[i, j, :] img = np.copy(p) return p Img_path = "flag_test.png" Img = cv2.imread(Img_path) assert isPrime(p) and isPrime(q) and p**2 + \ q**2 == c and c == 179093209181929149953346613617854206675976823277412565868079070299728290913658 Img_arnold = arnold(Img, c, p, q) cv2.imwrite("flag_enc.png", Img_arnold) 思路 分析得知 arnold()管理图片像素置换,而参数 $a,b$ 未知
Read more
June 21, 2024

WebSec 之 PHP反序列化 与 Python SSTI

反序列化 魔术方法是一种特殊的方法,当对对象执行某些操作时会覆盖 PHP 的默认操作 / PHP 保留所有以 __ 开头的方法名称。 因此,除非覆盖 PHP 的行为,否则不建议使用此类方法名称
Read more
June 21, 2024

WebSec 之 XSS

prompt(1) to win 平台 prompt(1) to win - 0x0 之 0-8 / 01 无过滤,白给局,掌握拼接的思路尝试 / payload: 1">`<script>prompt(1)</script>`<" 02 过滤 =( / HTML 实体绕过(注意HTML实体有多种形式,可以都试试) / <svg><script>prompt(1)<b> 03 正则匹配检测同时出现的 ->
Read more
June 21, 2024

一些入门的常见的 CTF Crypto 题型[2]

部分位已知 通过分析题目附件中的代码发现:素数总是隐藏了 50%bit,反过来就是 50%bit 已知 / DFS + 枚举状态 + 通过 $N$ 的低部分位来 Check 枚举的 $p,q$ 低位是否准确即可解出 $p,q$ / 随后即为常规 RSA
Read more
June 20, 2024

趣题分享[5] -- 古典密码 相关题目

可通过优化代码的方式打表,但这里只给出以古典方式分析题目 确认 c 与 secrets 的对应关系(使得可以通过 c 恢复 secrets) / 确认 Time_Machine() 的单调性(使得可以根据大小关系推断) / 词频分析(找出空格、e的对应值) / 特判(Case) / 枚举状态、NLP 处理小技巧、使用等宽字体、使用辅助函数恢复(磨刀不误砍柴工)、生成 ASCII 码表、生成多种排序方式、生成 Key Value Pair,且使用 Tuple 来实现更多展示信息,方便分析
Read more
June 20, 2024

一些入门的常见的 CTF Crypto 题型[1]

RSA是什么 特征:给出 p、q,考察 RSA 解密原理 SageMath’s Code / from Crypto.Util.number import long_to_bytes p = q = phi = (p - 1) * (q - 1) n = p * q e = d = inverse_mod(e, phi) m = power_mod(c, d, n) print(long_to_bytes(int(m))) # 强制类型转换 RSA $e=3$ 特征:$e$ (公钥指数) 很小 from gmpy2 import iroot import itertools n = e = 3 c = """ m = iroot(c, e) if m[1]: print(long_to_bytes(m[0])) """ for i in itertools.count(0): m = iroot(c + i * n, e) if m[1]: print(long_to_bytes(m[0])) break RSA 因数分解 特征:$N$ 的因子很小 这里为 ($80\text{bit} * 80\text{bit}$)
Read more
June 14, 2024

CryptoCTF 2024 部分WriteUp

Bada Points: 90 / Solve: 51 / Difficulty: Medium 🤔 / 题面 Bada The Bada equation contains an undetermined function. By closely examining how this equation behaves, you may be able to discover the concealed flag. / nc 00.cr.yp.toc.tf 17113 Note: There is no file to download in this challenge! / 尝试交互 > nc 00.cr.yp.toc.tf 17113 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Hey! It's time to solve the equation of a function f: N x N -> Z. ┃ ┃ Function f has given certain conditions. In each step, solve the ┃ ┃ equation f(x, y) = z with the given value of z. We know f(a+1, b) = ┃ ┃ f(a, b) + a, and f(a, b+1) = f(a, b) - b, for every `a' and `b'. ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ We know: f(1, 1) = -444045537086 and f(x, y) = 202500187503 ┃ Please send x, y separated by comma: 概述 通过将 $f(x, y) - f(1, 1) = n$ 转换成一个因式分解的问题,然后用这种分解来求解 $x$ 和 $y$ 的值。可以有效利用 $n$ 的因子来找到可能的 $x$ 和 $y$
Read more
June 12, 2024

R3CTF 2024 S𝑪𝑷-0εε WriteUp

*S𝑪𝑷-0εε 4 solved / 题面 ANY NON-AUTHORIZED PERSONNEL ACCESSING THIS FILE WILL BE IMMEDIATELY TERMINATED THROUGH BERRYMAN-LANGFORD MEMETIC KILL AGENT. / Download Attachment / 关键词 猜谜 + 未知位数约到Coppersmith界内 / Idea 打开附件中的 PDF / 和题目关联度不是很大的信息:SCP-033 / 发现有四行代码
Read more