RedpwnCTF 2019 - Writeup ( web : ghast )
Ghast. It's like a gist, but spookier. http://chall.2019.redpwn.net:8008/
添付のソースファイル(ghast.js)を確認すると以下の記載がある。
if (req.url === '/api/flag' && req.method === 'GET') { if (user.locked) { res.writeHead(403) res.end('this account is locked') return } if (user.name === secrets.adminName) { res.writeHead(200) res.end(secrets.flag) } else { res.writeHead(403) res.end('only the admin can wield the flag')
⇒ユーザ:secrets.adminNameのlockを解除した後、secrets.adminNameでログインしてapi/flagへアクセスできればよい。
cockieにuser=Z2hhc3Q6MA(ghast:0をBase64エンコードしたもの、=は除く)を設定する。
以下URLへアクセスする。
http://chall.2019.redpwn.net:8008/api/things/Z2hhc3Q6MA {"name":"sherlockholmes99","locked":true}
以上より、secrets.adminNameは"sherlockholmes99"になる。
ただしghast:0はlockedされているのでアクセスできない。
この後、色々調査するとghast:0以外にもsherlockholmes99がuserに指定されている。
当該のユーザをクッキーに指定した後、以下へアクセスするとflagが表示される。
[http://chall.2019.redpwn.net:8008/api/flag]
flag:flag{th3_AdM1n_ne3dS_A_n3W_nAme}