tesseract
WebページのURLと、サーバのファイル一式が与えられた。
Webページは、画像ファイルをアップロードするとそこに含まれるテキストを抽出する、とされるものだった。
dist-tesseract/app.py
を読むと、入力のファイル名を含む process_path
を用いてコマンドを実行している以下の部分があった。
An URL of a web page and the files for the server were given.
The web page was said that it accepts uploading an image file and extracts texts from the image.
Reading dist-tesseract/app.py
, I found this part that executes a command using process_path
, which contains the file name in the input:
process = subprocess.run(
f"tesseract \'{process_path}\' \'{process_path}\' -l eng",
shell=True,
check=False,
capture_output=True,
)
さらに、app.py
と同じディレクトリに flag.txt
があった。
Firefoxで開発者ツールを開き、一旦適当な画像ファイルをアップロードした後、
送信されるファイル名を ';base64 flag.txt; naiyo
に変えて「編集して再送信」すると、Base64エンコードされたデータを含むレスポンスが得られた。
このデータをCyberChefの From Base64 でデコードすると、flagが得られた。
Also, there was a file flag.txt
in the same directory as app.py
.
I opened the developer tools in Firefox and uploaded an image file.
Then, I performed "Edit and Resend", changing the name of file to upload in the request to ';base64 flag.txt; naiyo
.
As a result, the server sent a response that contains Base64-encoded data.
I obtained the flag by decoding the data using "From Base64" on CyberChef.
buckeye{5an1t1ze_y0ur_c0mm4nds_or_just_d0nt_use_c0mm4nds_1n_th3_f1r5t_p1ac3}
writeup by MikeCAT
BuckeyeCTF 2021