MoeCTFWP
Web
http
**
打开题目后,要求如下:1. 用 GET 传参;2. 用 POST 传参;3. 直接将 Cookie 的character改成admin
先修改character
得到 flag(因是本地环境,未实际设置 flag,故显示为none)。完整参数要求:
GET 传参:/?UwU=u
POST 传参:Luv=u
Cookie:character:admin
请求头:X-Forwarded-For:
请求头:user-agent: MoEbrowser
Cookie
打开题目后界面如下
题目提供的附件内容如下
解题思路:需注册一个账号,登录后获取 flag。操作步骤如下:
注册账号并登录
登录成功后界面
登录成功后,右侧有一段 Base64 编码,解码后内容为:
{"username": "xinyi", "password": "123456", "role": "user"}
**
\4. 需将role的值从user改为admin,修改后的 Cookie 如下,使用该 Cookie 即可得到 flag:
Cookie: character=admin;token=eyJ1c2VybmFtZSI6ICJ4aW55aSIsICJwYXNzd29yZCI6ICIxMjM0NTYiLCAicm9sZSI6ICJhZG1pbiJ9=
gasgasgas
该题目需通过脚本解决,题目界面如下
解题脚本如下:
#include <string.h>
#include <curl/curl.h>
int main() {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
char url[] = "http://127.0.0.1:80/";
curl_easy_setopt(curl, CURLOPT_URL, url);
for(int i=1; i<99; i++) {
char math[100] = "";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "driver=Leafzzz&steering_control=0&throttle=0");
res = curl_easy_perform(curl);
char resTest[1000];
strcpy(resTest, curl_easy_getinfo(curl, CURLINFO_CONTENT));
int ym, fx;
if(strstr(resTest, "太大") != NULL) {
ym = 2;
} else if(strstr(resTest, "太小") != NULL) {
ym = 0;
} else {
ym = 1;
}
if(strstr(resTest, "向左") != NULL) {
fx = 1;
} else if(strstr(resTest, "向右") != NULL) {
fx = -1;
} else {
fx = 0;
}
char myData[100];
sprintf(myData, "driver=Leafzzz&steering_control=%d&throttle=%d", fx, ym);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, myData);
res = curl_easy_perform(curl);
printf("%s\n", curl_easy_getinfo(curl, CURLINFO_CONTENT));
if(strstr(resTest, "moectf{") != NULL) {
printf("Flaggggggggg!!!: %s\n", resTest);
break;
}
}
curl_easy_cleanup(curl);
}
return 0;
}
今天就先写到这里,下周继续。