LoginSignup
0
0

More than 1 year has passed since last update.

KBID 1 - Path traversal (LFI)をやってみた。

Posted at

Owaspのやられサイトで勉強してみた。
KBID 1 - Path traversal (LFI)

やられサイトの構築

requirements.txtでパッケージを一括でインストールする。

$ pip3 install -r requirements.txt

pythonでLFIをたちあげる。

$ python3  LFI.py

Reconnaissance

Intro, Chapter 1とChapter 2を選択するプルダウンメニューがある。
image.png

valueはintro.txtファイルから取得されている。
image.png

filenameパラメータはシステム内のファイルからコンテンツを取得するために利用されている。
filenameをユーザーが操作できる状態にあるため、想定外の機密情報を盗まれる可能性がある。

LFI.py
@app.route("/home", methods=['POST'])
def home():
    filename = request.form['filename']
    if filename == "":
        filename = "text/default.txt"
    f = open(filename,'r')
    read = f.read()
    return render_template("index.html",read = read)

Exploitation

text/default.txtを../../../../../etc/passwdに書き換える。
ペネトレーションテストではLFIの証明によく/etc/passwdを取得しようとする。らしい。
image.png

Submit buttonをクリックすると/etc/passwd情報が表示される。成功。
image.png

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