BambooFox CTFにWeb問題を解きに行った

書き出し

年末に時間が少しできたので、その空いた時間でWeb問題を解きに行った。

Web Newbie

問題

http://server

Hey, I just learned how to make a web application!

Even though I might create some vulnerabilities, but I bet you'll never get the flag!

The submitted files will be deleted every hour.

テキストデータを保存公開できるアプリケーションのような風貌の問題のサイト

flag

BAMBOOFOX{0hhh_n0_s7up1d_li77l3_8ug}

解法

  1. navにコメントアウトされたヒントがある
      <!--
      <li class="nav-item">
        <a class="nav-link" href="/myfirstweb/index.php?op=nav&link=hint">Hint</a>
      </li>
      -->

なかには

HINT
Flag is in ../flag.txt

と記載されていた。 2.ディレクトリとラバーサルがある - http://host/myfirstweb/index.php?op=nav&link=filepath - http://host/myfirstweb/index.php?op=view&file=filepathlinkfileディレクトリトラバーサルがある。 なのでこれらに../flag.txtを入れると

Error
Found flag format in content, no flag for you!

と出てくる。 3. そのまま指定する http://host/flag.txtと入れると出てくる

その他

実は2と3の間に何か他の脆弱性があってそれを利用するのではないかと思い探していたときに、ソースコードを抜き出せたので中身を見てみると、中身がNode.jsで動いていた。

HAPPY

問題

I prefer Jekyll for building my blog. Please try to read /home/web/flags/flag1.txt.

flag

BAMBOOFOX{251d19bd7cb60e72a3825d898bffcee5}

解法

特にpostしている箇所がなかったのでそのままpathを指定してあげたらflagを取得できた http://host/../../../../../../home/web/flags/flag1.txt

まとめ

問題を解いていると深読みしたり、逆に固執してしまうことがあるので、直していきたい。