## 首頁(其他picoCTF writeup) https://hackmd.io/@sunfrancis12/ry_LLAgp3 作者: [台中教育大學 白帽社](https://hackmd.io/@ntcuhack/index) -sunfrancis12 ## GET aHead 進去網址裡,按照慣例先點開f12  index.php的內容如下 ``` <!doctype html> <html> <head> <title>Red</title> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <style>body {background-color: red;}</style> </head> <body> <div class="container"> <div class="row"> <div class="col-md-6"> <div class="panel panel-primary" style="margin-top:50px"> <div class="panel-heading"> <h3 class="panel-title" style="color:red">Red</h3> </div> <div class="panel-body"> <form action="index.php" method="GET"> <input type="submit" value="Choose Red"/> </form> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-primary" style="margin-top:50px"> <div class="panel-heading"> <h3 class="panel-title" style="color:blue">Blue</h3> </div> <div class="panel-body"> <form action="index.php" method="POST"> <input type="submit" value="Choose Blue"/> </form> </div> </div> </div> </div> </div> </body> </html> ``` 接下來試試看Choose Blue按鈕  ``` <!doctype html> <html> <head> <title>Blue</title> <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <style>body {background-color: blue;}</style> </head> <body> <div class="container"> <div class="row"> <div class="col-md-6"> <div class="panel panel-primary" style="margin-top:50px"> <div class="panel-heading"> <h3 class="panel-title" style="color:red">Red</h3> </div> <div class="panel-body"> <form action="index.php" method="GET"> <input type="submit" value="Choose Red"/> </form> </div> </div> </div> <div class="col-md-6"> <div class="panel panel-primary" style="margin-top:50px"> <div class="panel-heading"> <h3 class="panel-title" style="color:blue">Blue</h3> </div> <div class="panel-body"> <form action="index.php" method="POST"> <input type="submit" value="Choose Blue"/> </form> </div> </div> </div> </div> </div> </body> </html> ``` 仔細看程式碼,可以發現以下幾行 ``` <form action="index.php" method="GET"> <input type="submit" value="Choose Red"/> </form> ......中間跳過.......... <form action="index.php" method="POST"> <input type="submit" value="Choose Blue"/> </form> ``` 從程式碼推論,如果使用GET請求,背景會變成紅色,如果使用POST請求背景則是會變成藍色 ## 基礎條件有了,以下開始解題 ~~(通靈)~~ 而從題目給的提示1 *"Maybe you have more than 2 choices"* 推斷,他應該不只有兩種請求方式(GET,POST),而從題目 **"GET aHEAD"** 來看,應該就是用那個了吧!!!!! 下面幫大家複習一下: ### 請求類型 * GET # 請求獲取 Request-URL 所標識的資源 * POST # 在 Request-URL 所標識的資源後附加新的數據 * HEAD # 請求獲取由 Request-URL 所標識的資源的響應消息報頭 * PUT # 請求服務器存儲一個資源並用 Request-URL 作爲標識 * DELETE # 請求服務器刪除 Request-URL 所標識的資源 * TRACE # 請求服務器回送收到的請求消息,主要用於測試或診斷 * CONNECT # 保留將來使用 * OPTIONS # 請求查詢服務器性能、查詢資源相關選項、預檢請求 > 引用自: https://www.readfog.com/a/1644269618053877760 想必各位都猜到了吧!沒錯就是用HEAD請求去訪問網站,然後他就會吐給你一串flag囉 向網站用HEAD請求的格式如下 ``` curl -i -I http://mercury.picoctf.net:21939/index.php ``` ## 補充: 這題也可以用Burp來完成喔
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up