TGCTF-2025-Web-Writeup
Web (ez)upload hint写有源码泄露 index.php.bak拿源码 1<?php 2define('UPLOAD_PATH', __DIR__ . '/uploads/'); 3$is_upload = false; 4$msg = null; 5$status_code = 200; // 默认状态码为 200 6if (isset($_POST['submit'])) { 7 if (file_exists(UPLOAD_PATH)) { 8 $deny_ext = array("php", "php5", "php4", "php3", "php2", "html", "htm", "phtml", "pht", "jsp", "jspa", "jspx", "jsw", "jsv", "jspf", "jtml", "asp", "aspx", "asa", "asax", "ascx", "ashx", "asmx", "cer", "swf", "htaccess"); 9 10 if (isset($_GET['name'])) { 11 $file_name = $_GET['name']; 12 } else { 13 $file_name = basename($_FILES['name']['name']); 14 } 15 $file_ext = pathinfo($file_name, PATHINFO_EXTENSION); 16 17 if (!in_array($file_ext, $deny_ext)) { 18 $temp_file = $_FILES['name']['tmp_name']; 19 $file_content = file_get_contents($temp_file); 20 21 if (preg_match('/.+?</s', $file_content)) { 22 $msg = '文件内容包含非法字符,禁止上传!'; 23 $status_code = 403; // 403 表示禁止访问 24 } else { 25 $img_path = UPLOAD_PATH . $file_name; 26 if (move_uploaded_file($temp_file, $img_path)) { 27 $is_upload = true; 28 $msg = '文件上传成功!'; 29 } else { 30 $msg = '上传出错!'; 31 $status_code = 500; // 500 表示服务器内部错误 32 } 33 } 34 } else { 35 $msg = '禁止保存为该类型文件!'; 36 $status_code = 403; // 403 表示禁止访问 37 } 38 } else { 39 $msg = UPLOAD_PATH . '文件夹不存在,请手工创建!'; 40 $status_code = 404; // 404 表示资源未找到 41 } 42} 43 44// 设置 HTTP 状态码 45http_response_code($status_code); 46 47// 输出结果 48echo json_encode([ 49 'status_code' => $status_code, 50 'msg' => $msg, 51]); 审计一下代码,看到有个name,可以对文件名进行修改,想到目录穿越 ...
XYCTF-2025-Web-Writeup
Web Signin 题目 1# -*- encoding: utf-8 -*- 2''' 3@File : main.py 4@Time : 2025/03/28 22:20:49 5@Author : LamentXU 6''' 7''' 8flag in /flag_{uuid4} 9''' 10from bottle import Bottle, request, response, redirect, static_file, run, route 11with open('../../secret.txt', 'r') as f: 12 secret = f.read() 13 14app = Bottle() 15@route('/') 16def index(): 17 return '''HI''' 18@route('/download') 19def download(): 20 name = request.query.filename 21 if '../../' in name or name.startswith('/') or name.startswith('../') or '\\' in name: 22 response.status = 403 23 return 'Forbidden' 24 with open(name, 'rb') as f: 25 data = f.read() 26 return data 27 28@route('/secret') 29def secret_page(): 30 try: 31 session = request.get_cookie("name", secret=secret) 32 if not session or session["name"] == "guest": 33 session = {"name": "guest"} 34 response.set_cookie("name", session, secret=secret) 35 return 'Forbidden!' 36 if session["name"] == "admin": 37 return 'The secret has been deleted!' 38 except: 39 return "Error!" 40run(host='0.0.0.0', port=8080, debug=False) 目录穿越拿secret ...
春秋云镜-Exchange-Writeup
靶标介绍: Exchange 是一套难度为中等的靶场环境,完成该挑战可以帮助玩家了解内网渗透中的代理转发、内网扫描、信息收集、特权提升以及横向移动技术方法,加强对域环境核心认证机制的理解,以及掌握域环境渗透中一些有趣的技术要点。该靶场共有 4 个 Flag,分布于不同的靶机。 *注意:该靶场只有4个flag,如果提交完4个flag后仍未攻克成功,请关闭环境提交反馈。 ...
春秋云镜-Time-Writeup
靶标介绍: Time是一套难度为中等的靶场环境,完成该挑战可以帮助玩家了解内网渗透中的代理转发、内网扫描、信息收集、特权提升以及横向移动技术方法,加强对域环境核心认证机制的理解,以及掌握域环境渗透中一些有趣的技术要点。该靶场共有4个flag,分布于不同的靶机。 ...
NCTF-2025-Web-Writeup
sqlmap-master 题目 1from fastapi import FastAPI, Request 2from fastapi.responses import FileResponse, StreamingResponse 3import subprocess 4 5app = FastAPI() 6 7@app.get("/") 8async def index(): 9 return FileResponse("index.html") 10 11@app.post("/run") 12async def run(request: Request): 13 data = await request.json() 14 url = data.get("url") 15 16 if not url: 17 return {"error": "URL is required"} 18 19 command = f'sqlmap -u {url} --batch --flush-session' 20 21 def generate(): 22 process = subprocess.Popen( 23 command.split(), 24 stdout=subprocess.PIPE, 25 stderr=subprocess.STDOUT, 26 shell=False 27 ) 28 29 while True: 30 output = process.stdout.readline() 31 if output == '' and process.poll() is not None: 32 break 33 if output: 34 yield output 35 36 return StreamingResponse(generate(), media_type="text/plain") 其实就是一个网页端的sqlmap 看一下sqlmap的使用文档 ...
春秋云镜-Brute4Road-Writeup
参考文章 https://bowuchuling.github.io/posts/chunqiuBrute4Road.html https://h0ny.github.io/posts/Brute4Road-%E6%98%A5%E7%A7%8B%E4%BA%91%E5%A2%83 文章 - 浅谈约束委派攻击 - 先知社区 FLAG1 拿到靶机先用fscan扫一扫 ┌──────────────────────────────────────────────┐ │ ___ _ │ │ / _ \ ___ ___ _ __ __ _ ___| | __ │ │ / /_\/____/ __|/ __| '__/ _` |/ __| |/ / │ │ / /_\\_____\__ \ (__| | | (_| | (__| < │ │ \____/ |___/\___|_| \__,_|\___|_|\_\ │ └──────────────────────────────────────────────┘ Fscan Version: 2.0.0 [2025-03-17 14:12:55] [INFO] 暴力破解线程数: 1 [2025-03-17 14:12:55] [INFO] 开始信息扫描 [2025-03-17 14:12:55] [INFO] 最终有效主机数量: 1 [2025-03-17 14:12:55] [INFO] 开始主机扫描 [2025-03-17 14:12:55] [INFO] 有效端口数量: 233 [2025-03-17 14:12:55] [SUCCESS] 端口开放 39.98.114.207:80 [2025-03-17 14:12:55] [SUCCESS] 端口开放 39.98.114.207:22 [2025-03-17 14:12:55] [SUCCESS] 端口开放 39.98.114.207:6379 [2025-03-17 14:12:55] [SUCCESS] 端口开放 39.98.114.207:21 [2025-03-17 14:12:55] [SUCCESS] 服务识别 39.98.114.207:22 => [ssh] 版本:7.4 产品:OpenSSH 信息:protocol 2.0 Banner:[SSH-2.0-OpenSSH_7.4.] [2025-03-17 14:12:55] [SUCCESS] 服务识别 39.98.114.207:21 => [ftp] 版本:3.0.2 产品:vsftpd 系统:Unix Banner:[220 (vsFTPd 3.0.2).] [2025-03-17 14:13:00] [SUCCESS] 服务识别 39.98.114.207:80 => [http] 版本:1.20.1 产品:nginx [2025-03-17 14:13:00] [SUCCESS] 服务识别 39.98.114.207:6379 => [redis] 版本:5.0.12 产品:Redis key-value store [2025-03-17 14:13:06] [INFO] 存活端口数量: 4 [2025-03-17 14:13:06] [INFO] 开始漏洞扫描 [2025-03-17 14:13:06] [INFO] 加载的插件: ftp, redis, ssh, webpoc, webtitle [2025-03-17 14:13:06] [SUCCESS] 网站标题 http://39.98.114.207 状态码:200 长度:4833 标题:Welcome to CentOS [2025-03-17 14:13:07] [SUCCESS] 匿名登录成功! [2025-03-17 14:13:09] [SUCCESS] Redis 39.98.114.207:6379 发现未授权访问 文件位置:/usr/local/redis/db/dump.rdb [2025-03-17 14:13:13] [SUCCESS] Redis无密码连接成功: 39.98.114.207:6379 [2025-03-17 14:13:18] [SUCCESS] 扫描已完成: 5/5 发现redis不需要密码 ...
TPCTF2025-Web-赛后复现Writeup
参考文章 https://blog.0xfff.team/posts/tpctf_2025_writeup/ https://z3n1th1.com/2025/03/tpctf2025-writeup/ TPCTF2025 Writeup - 星盟安全团队 baby layout 这是一道关于绕过DOMPurify库,进行xss cookie窃取的题目 DOMPurify 是一个专门用于清理 HTML 输入的 JavaScript 库,旨在防止跨站脚本 (XSS) 攻击。它通过过滤和净化用户提供的 HTML 内容,确保其安全地嵌入到网页中,避免恶意代码的执行。 ...
春秋云镜-Initial-Writeup
参考文章 https://9anux.org/2024/08/01/%E6%98%A5%E7%A7%8B%E4%BA%91%E5%A2%83Initial%E8%AF%A6%E8%A7%A3/ 菜鸡第一个通关的靶场Orz FLAG1 fscan扫一下 ./fscan.exe -h 39.99.139.119 直接用thinkphpgui写马连蚁剑 先用vshell上线 读flag需要提权 peass-ng/PEASS-ng: PEASS - Privilege Escalation Awesome Scripts SUITE (with colors) ...