Skip to content

Commit

Permalink
Update Rainy's Writeup (Referring to Blog Post) (USTC-Hackergame#41)
Browse files Browse the repository at this point in the history
* Update Rainy's Writeup (Referring to Blog Post)

* Update Rainy's Writeup (Referring to Blog Post)

* Update Rainy's Writeup (Referring to Blog Post)
  • Loading branch information
howtomakeaname authored Nov 9, 2024
1 parent b05d9b6 commit 8b22104
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
| [綾瀬桃桃](players/Momoko-Ayase/README.md) | 废物一个 | 签到、喜欢做签到的 CTFer 你们好呀、猫咪问答(Hackergame 十周年纪念版)(1,2,3)、打不开的盒、每日论文太多了!、比大小王、旅行照片 4.0、Node.js is Web Scale、PaoluGPT(1)、惜字如金 3.0(1)、先不说关于我...啊吧啊吧(1) |
| [夏和小](players/夏和小/README.md) | 总排名第 29 名 | 签到、喜欢做签到的 CTFer 你们好呀、猫咪问答(Hackergame 十周年纪念版)、每日论文太多了!、比大小王、PowerfullShell、PaoluGPT、强大的正则表达式(3)、惜字如金3.0(B)、优雅的不等式(1,2)、不太分布式的软总线(1,2,3)、动画分享(1)、关灯(1,2,3)、禁止内卷、神秘代码2(1)、AI(1,2) |
| [Jemmy](players/Jemmy/README.md) | 总排名第 8 名 | 比大小王、不宽的宽字符、Node.js is Web Scale、PaoluGPT、强大的正则表达式、惜字如金、优雅的不等式、无法获得的秘密、Docker for Everyone Plus、看不见的彼方、ZFS 文件恢复、不太分布式的软总线、RISC-V:虎胆龙威、关灯、禁止内卷、零知识数独 |
| [Rainy](players/Rainy/README.md) | 总排名 197,纯新人 | 签到、喜欢做签到的 CTFer 你们好呀、猫咪问答(Hackergame 十周年纪念版)、打不开的盒、每日论文太多了!、比大小王、旅行照片 4.0、Node.js is Web Scale、PaoluGPT、惜字如金 3.0(1)、零知识数独(1,2)、AI(1) |
| [Rainy](players/Rainy/README.md) | 总排名 197,纯大一新人 | 签到、喜欢做签到的 CTFer 你们好呀、猫咪问答(Hackergame 十周年纪念版)、打不开的盒、每日论文太多了!、比大小王、旅行照片 4.0、Node.js is Web Scale、PaoluGPT、惜字如金 3.0(1)、零知识数独(1,2)、AI(1) |
| [CNDY](players/CNDY/README.md) | 只做了签到( | 签到 |
| [7086cmd](players/7086cmd/README.md) | 总排名 287,高中菜牲 | 签到、喜欢做签到的 CTFer 你们好呀、打不开的盒、每日论文太多了!、比大小王、Node.js is Web Scale、PaoluGPT、优雅的不等式(1)、动画分享(1) |
| [Mako #Ciallo~(∠・ω< )⌒★](players/Mako%20%23Ciallo~(∠・ω%20)⌒★/wp.md) | 总排名 51,大一学生 | 比大小王、不宽的宽字符、PowerfulShell、惜字如金 3.0、无法获得的秘密 |
Expand Down
161 changes: 94 additions & 67 deletions players/Rainy/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# Rainy's Writeup of Hackergame 2024

> 纯新人,第一年来,菜菜 /(ㄒoㄒ)/~~
> Blog Post: [https://wooow.top/article/woh24woh24/](https://wooow.top/article/woh24woh24/)
纯新人,第一年来,菜菜 (ㄒoㄒ)

## 签到

**启动**!观察到URL带上了`?pass=false`改为true即可拿到flag
直接**启动**!观察到URL带上了`?pass=false`改为`true`即可拿到flag

flag{we!cOM3-TO-haCK3rGAME-AND-3njOy-H@cK1Ng-Z0Z4}
`flag{we!cOM3-TO-haCK3rGAME-AND-3njOy-H@cK1Ng-Z0Z4}`

## 喜欢做签到的 CTFer 你们好呀

[Hackergame首页](https://hack.lug.ustc.edu.cn/)下拉,在承办单位处找到 [NEBULA战队](https://www.nebuu.la/),进入题目说的招新主页

这是一个Bash风格的网页,先打help看下可用命令,把~~sudo(奶龙😀)~~、about、env什么的先试一遍
这是一个Shell风格的网页,先打help看下可用命令,把~~sudo(奶龙😀)~~`about``env`什么的先试一遍

执行env后发现一个flag
执行`env`后发现一个flag

``` bash
``` Shell
PWD=/root/Nebula-Homepage
ARCH=loong-arch
NAME=Nebula-Dedicated-High-Performance-Workstation
Expand All @@ -25,16 +27,16 @@ FLAG=flag{actually_theres_another_flag_here_trY_to_f1nD_1t_y0urself___join_us_us
REQUIREMENTS=1. you must come from USTC; 2. you must be interested in security!
```

然后尝试正常ls列出目录(一开始还没往隐藏文件去想),还去搜了NixOS啥的,发现好像与本题无太大关系😂
然后尝试正常`ls`列出目录(一开始还没往隐藏文件去想),还去搜了NixOS啥的,发现好像与本题无太大关系😂

再尝试下源代码审计,在`index-5c589ff418560b46.js`中检索flag,在第2个flag结果附近,注意到

``` javascript
"".concat(atob("ZmxhZ3swa18xNzVfYV9oMWRkM25fczNjM3J0X2YxNGdfX19wbGVhc2Vfam9pbl91c191c3RjX25lYnVsYV9hbkRfdHdvX21hSm9yX3JlcXVpcmVtZW50c19hUmVfc2hvd25fc29tZXdoZXJlX2Vsc2V9"))
```
欸,这不是base64吗,把atob(……)这段F12放到控制台执行,解码后得到第二个flag
👀这不是base64吗,`atob(……)`这段放到浏览器控制台执行,解码后得到第二个flag

flag{0k_175_a_h1dd3n_s3c3rt_f14g___please_join_us_ustc_nebula_anD_two_maJor_requirements_aRe_shown_somewhere_else}
`flag{0k_175_a_h1dd3n_s3c3rt_f14g___please_join_us_ustc_nebula_anD_two_maJor_requirements_aRe_shown_somewhere_else}`

## 猫咪问答(Hackergame 十周年纪念版)

Expand Down Expand Up @@ -69,7 +71,7 @@ flag{0k_175_a_h1dd3n_s3c3rt_f14g___please_join_us_ustc_nebula_anD_two_maJor_requ
})
.then(response => response.text())
.then(html => {
//解析HTML DOM
//拿到的是HTML,需要解析HTML DOM
let parser = new DOMParser()
let doc = parser.parseFromString(html, "text/html")
let _text = doc.querySelector(".alert-secondary").innerText
Expand All @@ -88,7 +90,7 @@ flag{0k_175_a_h1dd3n_s3c3rt_f14g___please_join_us_ustc_nebula_anD_two_maJor_requ

6. 大语言模型会把输入分解为一个一个的 token 后继续计算,请问这个网页的 HTML 源代码会被 MetaLlama 3 70B 模型的 tokenizer 分解为多少个 token

穷举!在浏览器控制台执行:
枚举!在浏览器控制台执行:

``` typescript
for(let q6=1000;q6<2000;q6++){
Expand Down Expand Up @@ -116,19 +118,22 @@ flag{0k_175_a_h1dd3n_s3c3rt_f14g___please_join_us_ustc_nebula_anD_two_maJor_requ

可知1833

`flag{A_900D_C@7_!s_The_©αT_wHo_©αN_p@$S_tHE_qบ1Z}`
`flag{7en_Ye4RS_0F_hacK3ЯgΛme_OM3detou_WitH_n3kØ_QU!Z}`

## 打不开的盒

找个3D打印在线查看器,比如[这个](https://imagetostl.com/cn/view-stl-online),放大,从2024透过去对内部截图,再 OCR识别/人眼识别手打 转文字即可取到flag
找个[3D打印在线查看器](https://imagetostl.com/cn/view-stl-online),放大,从2024透过去对内部截图,再OCR识别/~~人眼识别手打~~转文字即可取到flag

flag{Dr4W_Us!nG_fR3E_C4D!!w0W}
`flag{Dr4W_Us!nG_fR3E_C4D!!w0W}`

## 每日论文太多了!

PDF文件下载下来,搜索flag,发现在其中一面论文的左上角一张图片里有白色字体写的"flag is here",但是没有flag{}的字样,推测可能是被隐藏了
下载PDF文件,搜索flag,发现在其中一面论文的左上角一张图片里有白色字体写的"flag is here",但是没有flag{}的字样,推测可能是被隐藏了

然后找个提取PDF中图片的工具,比如[这个](https://pdfcandy.com/cn/extract-images.html),下载下来,其中一张图片就有flag,用OCR识别转文字即可
然后找个[提取PDF中图片的工具](https://pdfcandy.com/cn/extract-images.html),下载提取结果,其中一张图片就有flag,用OCR识别转文字即可

flag{h4PpY_hAck1ng_3veRyd4y}
`flag{h4PpY_hAck1ng_3veRyd4y}`

## 比大小王

Expand Down Expand Up @@ -179,29 +184,29 @@ go()

可以得到:

flag{!-4M-ThE-H4cK3r-K!nG-0f-cOmPaR!NG-NUMb3Rs-2oZ4}
`flag{!-4M-ThE-H4cK3r-K!nG-0f-cOmPaR!NG-NUMb3Rs-2oZ4}`

## 旅行照片 4.0

1. 照片拍摄的位置距离中科大的哪个校门更近?

东西南北都试一试,可知东校区西门
东西南北都人工试一试,可知东校区西门

2. 话说 Leo 酱上次出现在桁架上是……科大今年的 ACG 音乐会?活动日期我没记错的话是?

搜索“中国科大2024ACG音乐会”,可知20240519
搜索“中科大2024ACG音乐会”,可知20240519

flag{5UB5CR1B3_T0_L30_CH4N_0N_B1L1B1L1_PLZ_98794d67e7}
`flag{5UB5CR1B3_T0_L30_CH4N_0N_B1L1B1L1_PLZ_193bf998f5}`

3. 这个公园的名称是什么?(不需要填写公园所在市区等信息)

把图片放大,注意到垃圾桶上面有**六安**字样,搜索发现是城市名,再尝试搜这个城市的公园,对照跑道,可知中央森林公园
把图片放大,注意到垃圾桶上面有**六安**字样,搜索发现是城市名,再尝试搜这个城市有的公园,对照跑道样式,可知中央森林公园

4. 这个景观所在的景点的名字是?(三个汉字)

搜图,结合题目三个汉字的要求,确定坛子岭

flag{D3T41LS_M4TT3R_1F_R3V3RS3_S34RCH_1S_1MP0SS1BL3_8cb69a32c8}
`flag{D3T41LS_M4TT3R_1F_R3V3RS3_S34RCH_1S_1MP0SS1BL3_008d4f5f31}`

5. 距离拍摄地最近的医院是?(无需包含院区、地名信息,格式:XXX医院)

Expand All @@ -211,7 +216,7 @@ flag{D3T41LS_M4TT3R_1F_R3V3RS3_S34RCH_1S_1MP0SS1BL3_8cb69a32c8}

搜索四编组动车型号,试出CRH6F-A

flag{1_C4NT_C0NT1NU3_TH3_5T0RY_4NYM0R3_50M30N3_PLZ_H3LP_8195f39157}
`flag{1_C4NT_C0NT1NU3_TH3_5T0RY_4NYM0R3_50M30N3_PLZ_H3LP_8195f39157}`

## Node.js is Web Scale

Expand All @@ -229,9 +234,9 @@ let store = {};
推测原型链污染

输入 key: `__proto__.t`, value: `cat /flag`
再调用`/execute?cmd=t`
再访问`/execute?cmd=t`

flag{n0_pr0topOIl_50_U5E_new_Map_1n5teAD_Of_0bject2kv_86e388ff83}
`flag{n0_pr0topOIl_50_U5E_new_Map_1n5teAD_Of_0bject2kv_86e388ff83}`

## PaoluGPT

Expand Down Expand Up @@ -271,7 +276,7 @@ for (let i = 0; i < links.length; i++) {

稍等一会,得到:

flag{zU1_xiA0_de_11m_Pa0lule!!!_196f3121f3}
`flag{zU1_xiA0_de_11m_Pa0lule!!!_196f3121f3}`

### 窥视未知

Expand All @@ -283,11 +288,13 @@ results = execute_query("select id, title from messages where shown = true", fet
results = execute_query(f"select title, contents from messages where id = '{conversation_id}'")
```

默认不显示shown=true的对话,推测另一个应该就是在shown=false的对话中,同时下边SQL查询的存在注入风险,然后构造`' or where shown = false--`
默认不显示`shown=true`的对话,推测另一个flag应该就是在`shown=false`的对话中,同时下边SQL查询的存在注入风险,然后构造`' or where shown = false--`

flag{enJ0y_y0uR_Sq1_&_1_would_xiaZHOU_hUI_guo_a706cea1d6}
`flag{enJ0y_y0uR_Sq1_&_1_would_xiaZHOU_hUI_guo_a706cea1d6}`

## 惜字如金 3.0(题目A
## 惜字如金 3.0

### 题目A

根据规则修改Python脚本:

Expand Down Expand Up @@ -390,14 +397,16 @@ def post() -> flask.Response:
assert closing == '}' and opening == 'flag{'
return {'answer_flag': answer_flag}, 200
```
flag{C0mpl3ted-Th3-Pyth0n-C0de-N0w}
`flag{C0mpl3ted-Th3-Pyth0n-C0de-N0w}`

## 优雅的不等式

## 优雅的不等式(Easy
### Easy

在知乎上搜索到[文章](https://zhuanlan.zhihu.com/p/669285539),根据其中第1种类型的原理,解出系数
`x*x*(1-x)**2*(15-2*x+15*x*x)/(1+x*x)`

flag{y0u_ar3_g0od_at_constructi0n_982b662cda}
`flag{y0u_ar3_g0od_at_constructi0n_982b662cda}`

## 零知识数独

Expand All @@ -409,43 +418,56 @@ flag{y0u_ar3_g0od_at_constructi0n_982b662cda}

搜索`snarkjs``circom`,配好环境

``` Shell
npm install snarkjs -g
#View https://docs.circom.io/getting-started/installation/
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
git clone https://github.com/iden3/circom.git
cd circom
cargo build --release
cargo install --path circom
cd ../
npm install circomlib
```

执行
``` Bash
``` Shell
circom sudoku.circom --r1cs --wasm --sym
```
生成`sudoku.wasm`

解出数独,根据`sudoku.circom`的要求,编辑出`input.json`
生成`./sudoku_js/sudoku.wasm`,将其移至当前目录下便于后面操作

解出数独,根据`sudoku.circom`的格式要求,新建并编辑`input.json`
``` JSON
{
"unsolved_grid": [
[9, 0, 0, 0, 0, 0, 1, 0, 0],
[8, 0, 0, 0, 0, 0, 2, 0, 0],
[7, 0, 0, 0, 0, 0, 3, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 6],
[0, 2, 0, 0, 0, 0, 0, 7, 0],
[0, 0, 3, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 6, 0],
[0, 0, 2, 0, 0, 0, 0, 0, 7],
[0, 3, 0, 0, 0, 0, 0, 0, 0]
[0, 6, 0, 0, 4, 0, 7, 0, 1],
[0, 9, 3, 0, 0, 0, 0, 0, 0],
[7, 0, 0, 0, 9, 0, 8, 0, 0],
[3, 0, 0, 0, 0, 0, 0, 0, 5],
[0, 0, 8, 7, 0, 0, 0, 4, 0],
[0, 0, 0, 0, 3, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 2, 1, 6, 0],
[0, 4, 0, 8, 0, 5, 9, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 7]
],
"solved_grid": [
[9, 0, 0, 0, 0, 0, 1, 0, 0],
[8, 0, 0, 0, 0, 0, 2, 0, 0],
[7, 0, 0, 0, 0, 0, 3, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 6],
[0, 2, 0, 0, 0, 0, 0, 7, 0],
[0, 0, 3, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 6, 0],
[0, 0, 2, 0, 0, 0, 0, 0, 7],
[0, 3, 0, 0, 0, 0, 0, 0, 0]
[8, 6, 2, 5, 4, 3, 7, 9, 1],
[5, 9, 3, 1, 8, 7, 4, 2, 6],
[7, 1, 4, 2, 9, 6, 8, 5, 3],
[3, 7, 9, 4, 2, 8, 6, 1, 5],
[6, 2, 8, 7, 5, 1, 3, 4, 9],
[4, 5, 1, 6, 3, 9, 2, 7, 8],
[9, 8, 5, 3, 7, 2, 1, 6, 4],
[1, 4, 7, 8, 6, 5, 9, 3, 2],
[2, 3, 6, 9, 1, 4, 5, 8, 7]
]
}
```

执行
``` Bash
``` Shell
node sudoku_js/generate_witness.js sudoku.wasm input.json witness.wtns
snarkjs groth16 prove sudoku.zkey witness.wtns proof.json public.json
```
Expand All @@ -455,27 +477,27 @@ snarkjs groth16 prove sudoku.zkey witness.wtns proof.json public.json
``` JSON
{
"pi_a": [
"8675764042730050040124473686079059135006151345534014969424964870071614018797",
"17195090035365156877369809768777783243963395905574970663133842667808990032952",
"19519569601443877529841379184511804661822623434087164904352625826179156948133",
"2682837314985806677717346712478184552918419161577008207527853034067541448658",
"1"
],
"pi_b": [
[
"20748128216962356572272652831648516597010475465959768852216688635045904926326",
"10009917252567508546769680988504601965080993252615750621430495365805680127858"
"7010535527370989753089386143550495087684739302415257406065255071407236151699",
"1387092455065133401010021275874929550054582825902761332492247997596855257480"
],
[
"3572893038827597083070199460367895852880043891776436058659254264527221527243",
"8249384538129175745796114250196881670919110375219561724477973349773360238214"
"6181395008603124266894200447221630417226871309341132292706415757742397764903",
"9173276508799393706032118462054890921693089393320324585023890851218403180045"
],
[
"1",
"0"
]
],
"pi_c": [
"2884699217974106299853460376620977186228499829621229753780411559592403969860",
"11538995908966585640951866062597231689540460300896188617485836455930231898784",
"4581445017619053660491199330292606165416925531438640239277767880463245438096",
"4517625030615366793301484885609249507033820468808886907974473148384435812669",
"1"
],
"protocol": "groth16",
Expand Down Expand Up @@ -569,27 +591,32 @@ snarkjs groth16 prove sudoku.zkey witness.wtns proof.json public.json
]
```
执行
``` Bash
``` Shell
snarkjs groth16 verify verification_key.json public.json proof.json
```
验证通过,提交`proof.json`

flag{you_are_a_5udoku_expert_and_pr0ved_your_kn0wledge_dc29a4dd28}
`flag{you_are_a_5udoku_expert_and_pr0ved_your_kn0wledge_dc29a4dd28}`

## 先不说关于我从零开始独自在异世界转生成某大厂家的 LLM 龙猫女仆这件事可不可能这么离谱,发现 Hackergame 内容审查委员会忘记审查题目标题了ごめんね,以及「这么长都快赶上轻小说了真的不会影响用户体验吗🤣」

## 先不说关于我从零开始独自在异世界转生成某大厂家的 LLM 龙猫女仆这件事可不可能这么离谱,发现 Hackergame 内容审查委员会忘记审查题目标题了ごめんね,以及「这么长都快赶上轻小说了真的不会影响用户体验吗🤣」(「行吧就算标题可以很长但是 flag 一定要短点」
### 「行吧就算标题可以很长但是 flag 一定要短点」

Amazing啊这个标题😎

~~先尝试根据英语积累人工推测复原(人工智能,人手工的智能😎),可以复原前面的一些词~~

在本地跑一下`build.sh`,根据生成的内容中相似的部分,可以复原一些词

再到[通义千问](https://tongyi.aliyun.com/qianwen/)上面跑一下`……(x代指hackergame中的字母(包括x),请将本文段还原,用英文输出原文)`,可以再恢复一些词

基本能拿到原文,验一下sha256发现正确(这算是非预期解?

``` text
In the grand hall of Hackergame 2024, where the walls are lined with screens showing the latest exploits from the cyber world, contestants gathered in a frenzy, their eyes glued to the virtual exploits. The atmosphere was electric, with the smell of freshly brewed coffee mingling with the scent of burnt Ethernet cables. As the first challenge was announced, a team of hackers, dressed in lab coats and carrying laptops, sprinted to the nearest server room, their faces a mix of excitement and determination. The game was on, and the stakes were high, with the ultimate prize being a golden trophy and the bragging rights to say they were the best at cracking codes and hacking systems in the land of the rising sun.
```

flag{llm_lm_lm_koshitantan_fa7b655c38bc8847}
`flag{llm_lm_lm_koshitantan_fa7b655c38bc8847}`

## 一点碎碎念

Expand Down

0 comments on commit 8b22104

Please sign in to comment.