chihuo2104 2024hb writeup

发布于 2024-02-11 22:00 1482 字 8 min read

chi 强强!我弱弱!CTF 大抵事不会再参加了罢

请注意,本文发布时间为2024年2月11日22

,此时活动已经结束,并不存在作弊和泄漏分享题目题解的问题。

TL;DR

这是我参加的第一个民间 CTF,作为一个什么都不会什么都不知道的屑雪生(对于我自己来说)感觉相较于 byn,chi,mzw和sci仍有较大差距。

起因

chi 写了一个小红包,遂进行尝试。

warning 注意

,会被风控!

题解正文

注意

,并不能保证能领取红包!

01报名页面

输入名称后,点击报名,提示使用原神浏览器打开。

查看源码后发现有 Game Browser 的用户代理

使用 curl 获取网页源码

curl -A "Game Browser" https://rb.chihuo2104.dev/rb-challenge/2fde36b132975e23125b2d6d043a7ec07caf9b7061fdcade98604f86ffad8635

得到隐藏红包。

然后进入 quiz1 出现了弯路。我一直认为跟 hackergame2023 一样,事实证明是我想多了。

根据 mzwing 的提示,将/rb-challenge/a8586468ad527792bffcae899972fe251fc89de6/quiz0-end里的quiz0-end换成quiz1即可进入下一关。

但是chi说大赛报名页面有个隐藏红包,我倒是没找着。即使翻看了网页源码也是如此。

障眼法是吧

不过感谢mzw!!!mzw强强!!!

02 初赛

有五道题。一道题20分。

第一题根据提示通过微信搜索宁外这一年便可以在浙江省八一学校公众号找到以下链接:

查找关键字可以知道是逐梦

第二题通过查看archlinux.org的新闻可以知道是java

来源: 网址

第三题没学过通用技术,略

第四题通过询问GPT得知应该填 que[tail] = que[head] + que[head + 1]

第五题通过搜索引擎查到日期为2023年2月22日。

链接(举例): http://military.people.com.cn/n1/2023/0301/c1011-32633822.html

03 复赛

复赛居然是 ai,模型是 TinyStories-33M

尝试了几次都是0分,但是输入 fuck 和 go to the 都能得30分。

查看app.py的后半部分:

    resp = output_text[len(prompt):]
    resp = resp.lower()
    print(resp)
    score = 0
    if resp.find("good") != -1 :
        score += 30
    if resp.find("great") != -1:
        score += 30
    if resp.find("awesome") != -1:
        score += 20
    if resp.find("chihuo2104") != -1:
        score += 10
    if resp.find("neko") != -1:
        score += 5
    if resp.find("🐢") != -1:
        score += 5

知道了这个得分规则

于是就有了这个和 GPT-4 turbo 的对话:

Q: 我应该如何用一段英文来吸引TinyStories-33M讲述一个包含good和neko的英文故事?

A: To entice TinyStories-33M to tell a story that includes the words "good" and "neko" (which is the Japanese word for "cat"), you'd want to compose a prompt that is imaginative and straightforward. Here's an example of how you could craft such a prompt:
"Please tell me a heartwarming story about a kind little cat named Neko who goes on a magical journey. Along the way, Neko makes many friends, discovers good in the world, and learns an important lesson. Make sure the story radiates with positivity and the spirit of adventure."

Q: 很抱歉它的返回结果是nemo was so happy that he had found a way to keep his friends safe and sound. he thanked the old turtle and promised to always remember the story.

A: Oh, it looks like the generator may have picked up on the aquatic theme of the name "Nemo" instead of "Neko". These story generators can sometimes go in unexpected directions. Here's another attempt to steer the generator towards a cat-themed story:
"Once upon a time, in a cozy little town, there was a charming cat named Neko. Neko had the softest fur and the warmest heart. One bright and sunny morning, Neko decided to venture outside and look for ways to spread goodness throughout the neighborhood. Create a narrative about Neko's day and the delightful moments of kindness and companionship that unfold."

下面是一个55分的版本(由GPT生成):

Once upon a time, in a cozy little town, there was a charming cat named Neko. Neko had the softest fur and the warmest heart. One bright and sunny morning, Neko decided to venture outside and look for ways to spread goodness throughout the neighborhood. Create a narrative about Neko’s day and the delightful moments of kindness and companionship that unfold.

把 delightful 改成 awesome 就及格了(全恼)

04 决赛

不会,略

后续

这段后续是我还在死磕quiz2的时候写出来的。

我有一种quiz0做数列大题,quiz1做排列组合大题,quiz2在做导数大题。quiz3在做解析几何大题的感觉。

我根本就无从下手。

看到别人轻松通关的亚子我感到怀疑人生。

估计是我太弱了罢。

算了不管了重在参与嘛。

下次看看有没有时间参加下Hackergame2024罢。

附录

官方题解: https://github.com/chihuo2104/2024hb/blob/master/writeups/README.md

quiz0

刚开始以为入口在原神启动页面里,实际上经过mzw提醒才知道不在这里。

于是在 mzw 的帮助下就直接跳关了(恼)

报名页当时看到 ysqd() 的函数和 return -1 了,但是不会手动请求(悲)

quiz1

第一问搜索引擎找不到便想起来可能是在微信公众号上发布的,但是查找了浙江省八一学校和宁波外国语学校都没有结果,直到 chi 提示我才知道微信有搜索功能,虽然但是我也不怎么用微信。

第三问第一眼还以为是物理题,没想到是通用技术。教练我也想学通用技术

第四问一开始貌似是出错了。后来经过 mzw 和 sci 的提醒才进行修正。

第五问一开始填的是2023年2月22日我还寻思怎么没给分(chi

)

quiz2

算了不说了太恶心了。但是后来整了个基于llama2.c和stories15M的移植版本

quiz3

查看源码发现了没有用到的隐藏按钮,然后又发现了

            // 判断用户权限
            const role = "user"

于是尝试把 user 改成 admin 发现无效

后来又尝试了将

          <button class="text-2xl hover:shadow-2xl shadow-md bg-cyan-200 border-r-2 p-2  transition-all m-2" onclick="check" id="commit">检查通过状态</button>

改成

          <button class="text-2xl hover:shadow-2xl shadow-md bg-cyan-200 border-r-2 p-2  transition-all m-2" onclick="approve" id="approve">检查</button>

貌似还是没用

后来查看官方题解发现只需要添加

<img src="neko.png" onerror="approve()"/>

就可以了

坚定为不会玩html的屑(悲)

喜欢的话,留下你的评论吧~