実は来月あたりに徳丸試験の受験を予定しているので勉強も兼ねてこちらのRoom攻略
- URL=
そんなに難しくはないんだけどやたら長いので3回くらいに分けつつ、読めば終わるところも簡単に要約をつけてまとめまる方針でいきます
- Task 1 Introductio
- Task 2 Accessing machines
- Task 3 [Severity 1] Injection
- Task 4 [Severity 1] OS Command Injection
- Task 5 [Severity 1] Command Injection Practical
- Task 6 [Severity 2] Broken Authentication
- Task 7 [Severity 2] Broken Authentication Practical
- Task 8 [Severity 3] Sensitive Data Exposure (Introduction)
- Task 9 [Severity 3] Sensitive Data Exposure (Supporting Material 1)
- Task 10 [Severity 3] Sensitive Data Exposure (Supporting Material 2)
- Task 11 [Severity 3] Sensitive Data Exposure (Challenge)
- What is the name of the mentioned directory?
- Navigate to the directory you found in question one. What file stands out as being likely to contain sensitive data?
- Use the supporting material to access the sensitive data. What is the password hash of the admin user?
- Crack the hash.What is the admin’s plaintext password?
- Login as the admin. What is the flag?
Task 1 Introductio
No answer needed
前フリ このRoomは初心者向けです。
Task 2 Accessing machines
No answer needed
接続しよう
Task 3 [Severity 1] Injection
No answer needed
インジェクションには大きく分けてSQLインジェクションとOSコマンドインジェクションがある
リテラルの部分がアプリケーションに特別な解釈されちゃうことが原因
いろいろ悪用されちゃいますよーって話。
Task 4 [Severity 1] OS Command Injection
OSコマンドインジェクションはWebアプリケーションからOSコマンドを実行できる脆弱性だよーって話。
こちらをご参考に
Task 5 [Severity 1] Command Injection Practical
やってみようコマンドインジェクションの巻
PHPのコードの例が示されている。

PHP調べたらpassthru関数に渡された値はコマンドとして実行されるらしい。
- URL=
What strange text file is in the website root directory?
ls

明らかに異質なファイルを探す
cat drpepper.txt

How many non-root/non-service/non-daemon users are there?
要するに普通のユーザーは何人?ってことなので
cat /etc/passwd
※出力が見づらいのでソースで見ています

ユーザーの数を聞かれてるけど。id(カンマで区切られた3つめのカラム)が1000番台になる子なのであれ?間違えた?と思ったけどまさかのゼロで正しかった。
What user is this app running as?
whoami

What is the user’s shell set as?
/etc/passwdみたときに載ってた
/usr/sbin/nologin
What version of Ubuntu is running?
多分やり方はなんでも良いのですが、こないだやった
Linux Local Enumerationのルームと同じ手順でシェルがとれたのでここからはリバースシェルの画面でお送りします。
Ubuntuのバージョンを調べる
lsb_release -a

Print out the MOTD. What favorite beverage is shown?
motdとはユーザーのログイン時に表示されるメッセージが保存されているファイルです。
好きな飲み物は?…ってすでにオチがだいたい予想つくけどな…。

motdどこだっけ?ってちょっと探してしまった
cat /etc/update-motd.d/00-header
Task 6 [Severity 2] Broken Authentication
No answer needed
認証に欠陥があると脆弱性になっちゃうよ
- ブルートフォースで総当りとか
- パスワードがめちゃんこ弱いとか(辞書攻撃に弱い)
- Cookieに欠陥があるとか
そういうところに気をつけよう。緩和策としては
- パスワードポリシー強化(よわいパスワードは使わせない)
- アカウントロック(パスワード何回も間違えるとロック)
- 多要素認証
があるよ。って話。
Task 7 [Severity 2] Broken Authentication Practical
壊れた認証実践編
admin
というユーザーがいるとき <半角スペース>admin
というユーザーが登録できてしまってしかもadminと同じリソースにアクセスできる壊れ方をしている(そんなことある?)darrenっていうユーザーで試そう。
What is the flag that you found in darren’s account?

<半角スペース>darren
で適当に登録してログイン
What is the flag that you found in arthur’s account?
arthurでも同じことを試す。そんなことあります?感がどうしても拭えない。まれによくあることだったりするんだろうか。
Task 8 [Severity 3] Sensitive Data Exposure (Introduction)
No answer needed
誤ってデータを公開してしまうことをSensitive Data Exposureと呼ぶ。
中間者攻撃とかしなくても脆弱なアプリケーションであれば漏洩してしまうことがある。
Task 9 [Severity 3] Sensitive Data Exposure (Supporting Material 1)
No answer needed
sqliteのデータベースがWebアプリからアクセス可能な場所にあるとき、データベースごとダウンロードできることがある(どっかでそういうCTFの問題あったな…)
そういうときは sqlite3 <database-name>
で中を読めますよ、って話。
Task 10 [Severity 3] Sensitive Data Exposure (Supporting Material 2)
No answer needed
パスワードのハッシュがみつかったら色んな方法で解くことができることがあるよ。オンラインのツールもあるよ。
- URL=
Task 11 [Severity 3] Sensitive Data Exposure (Challenge)
やっと本題(長かった)タスク8の環境をデプロイしてブラウザから普通に接続する。
What is the name of the mentioned directory?
ログイン画面のソースを見る

なぜ脆弱なアプリケーションの作者はいつもこんなに露骨にコメントを残してしまうのだろう。(こんなことあります?)
Navigate to the directory you found in question one. What file stands out as being likely to contain sensitive data?
assetsディレクトリに移動

だからなんでこんなに露骨に(以下略)
Use the supporting material to access the sensitive data. What is the password hash of the admin user?
DBをダウンロードしてきて、タスク9を参考にコマンド発行
$ sqlite3 webapp.db
sqlite> .tables
sqlite> PRAGMA table_info(users);
sqlite> SELECT * FROM users;

Crack the hash.What is the admin’s plaintext password?
さっきのオンラインツールでハッシュを探す

Login as the admin. What is the flag?
パスワードがわかったので普通にログインすればよい。

まだまだ続くよ〜