搜索
查看: 491|回复: 2

高版本正方教务系统上传后缀过滤不严导致能直接上传Webshell

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11913
发表于 2013-8-26 20:28:24 | 显示全部楼层 |阅读模式
在旧版本中有一个利用插件上传文件的漏洞,但是在新版本中已经没有了这个插件.这个漏洞是由于过滤不严造成的,可以直接上传Webshell进行提权,由于代码在DLL中,全国大部分高校均有此漏洞,影响范围很大,90%以上的学校均可使用这个方法进行提权

上传函数仅判断是否包含".asp" ".php"".exe"字符串 因此可以直接上传如CER格式的Webshell进行提权

jwggfbb.cs


private void btn_sc_Click(object sender, EventArgs e)

{

if (Strings.InStr(this.loFile.get_PostedFile().get_FileName(), ".asp", 0) > 0)

{

this.RegisterStartupScript("Startup", "<script type="text/javascript" language="javascript">// <![CDATA[
alert('不能上传asp文件!!');
// ]]></script>");

}

else if (Strings.InStr(this.loFile.get_PostedFile().get_FileName(), ".php", 0) > 0)

{

this.RegisterStartupScript("Startup", "<script type="text/javascript" language="javascript">// <![CDATA[
alert('不能上传php文件!!');
// ]]></script>");

}

else if (Strings.InStr(this.loFile.get_PostedFile().get_FileName(), ".exe", 0) > 0)

{

this.RegisterStartupScript("Startup", "<script type="text/javascript" language="javascript">// <![CDATA[
alert(不能上传exe文件,请压缩后上传!!');
// ]]></script>");

}

else

{

this.tcf = false;

this.Button1_Click();

if (!this.tcf)

{

if (StringType.StrCmp(this.scms, "1", false) == 0)

{

this.data_dir.set_Text(ConfigurationSettings.get_AppSettings().get_Item("HTTP1") + "/wbwj/" + this.lstrFileName);

}

if (StringType.StrCmp(this.scms, "2", false) == 0)

{

this.data_dir.set_Text("wbwj/" + this.lstrFileName);

}

}

}

}
scglwj.cs


private void Button2_Click(object sender, EventArgs e)

{

if (Strings.InStr(this.loFile1.get_PostedFile().get_FileName(), ".asp", 0) > 0)

{

this.get_Response().Write("<script type="text/javascript" language="javascript">// <![CDATA[
alert('不能上传asp文件!!');
// ]]></script>");

}

else if (Strings.InStr(this.loFile1.get_PostedFile().get_FileName(), ".php", 0) > 0)

{

this.get_Response().Write("<script type="text/javascript" language="javascript">// <![CDATA[
alert('不能上传php文件!!');
// ]]></script>");

}

else

{

this.Button1_Click();

string mysql = "insert into jwggfbb (GGBT,GGZW,FBDW,FBSJ,YXQX,mxddx,mxxdx,fbnr,scip) values ('" + this.ggbt.get_Text() + "','" + ConfigurationSettings.get_AppSettings().get_Item("HTTP1") + "UpLoad/" + this.lstrFileName + "','" + this.fbdw.get_Text() + "',to_char(sysdate,'YYYY-MM-DD hh:mi:ss'),'" + this.yxqx.get_Text() + "','','','wjgl','" + this.get_Request().get_UserHostAddress() + "')";

OracleConnection objConnection = new OracleConnection(ConfigurationSettings.get_AppSettings().get_Item("MyConn") + this.zhj.jiemi(ConfigurationSettings.get_AppSettings().get_Item("MyPwd"), this.zhj.str_jm));

if (Module1_sjf.checksql(mysql))

{

OracleCommand objCommand = new OracleCommand(mysql, objConnection);

objConnection.Open();

objCommand.ExecuteNonQuery();

objConnection.Dispose();

this.DataGrid1.set_EditItemIndex(-1);

this.zhj.BindtoGrid("select * from jwggfbb where fbnr='wjgl' order by fbsj,yxqx", this.DataGrid1);

}

}

}
当为asp文件时会提示不能上传asp文件



直接将asp大马改成CER格式 直接上传无鸭梨 麻麻再也不用担心我的学习啦



文件存放在网站根目录的wbwj文件夹中 虽然叫wbwj但是还是没有限制运行权限,直接提权得到服务器权限
专业回帖 该用户已被删除
发表于 2013-8-29 19:00:40 | 显示全部楼层
有竞争才有进步嘛
专业回帖 该用户已被删除
发表于 2013-8-29 22:33:15 | 显示全部楼层
找到好贴不容易,我顶你了,谢了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表