aspx代码审计-2
今天和大家分享一下aspx网站的代码审计,漏洞类型为:未授权访问和任意文件下载。
本文作者:i春秋签约作家——非主流
今天看的源码文件就不共享给大家了,本文只作学习只用。
还是先看我们的文件夹目录和dll文件的目录:
这是网站根目录
正常打开,是会跳转到/2052/aspx/userlogin.aspx
Dll使用ILSpy反编译后,目录如下:



在代码审计中,类似未授权访问的漏洞是最好验证的,像一般aspx网站开发时,都会将dll中的类和页面与显示的aspx文件的名称命名一样说简单点,就是比如这里的jtgcweb.2052.aspx下的userlogin,就对应着文件夹2052/aspx/userlogin.aspx文件
话不多说,我们直接开始吧。
我们直接定位到存在未授权访问和任意文件下载漏洞的文件:/2052/Aspx/gw/download.aspx
文件说的很清楚,源码在这里
_2052_Aspx_Message_Download
通过源码,我们其实已经可以发现,好像并没有什么验证的脚本或是函数嘛。我们直接访问看看。既不报错,也不提示什么,单纯的一个无标题页,嗯,看来这个文件是可以直接在没有登陆的情况下请求到的。
接着分析上面的源码截图,学过asp的都知道,Request.QueryString()函数意指程序通过http的get方法进行参数传递,所以,这里我们便需要传递两个参数(分别是name和oid)进去,才可以完成这个if判断。
所以,我们暂时构造请求格式如下:
http://xxxxx/2052/Aspx/gw/download.aspx?name=1&oid=1
base.Response.AppendHeader(“Content-Disposition”, ”attachment; filename=” + base.Server.UrlPathEncode(text)); //这段代码的意思是指,从download.aspx文件所在的目录,开始下载文件,文件的名字从哪来?从text来,text的值又从哪来?从我们get请求中的name参数的值来。所以,我们试试get请求这个呢?
web.config文件在网站的根目录,download.aspx文件在2052/aspx/gw/目录下。
http://xxxxxxx/2052/Aspx/gw/download.aspx?name=../../../web.config&oid=/
这里为什么会报错呢?很奇怪啊,我们再分析分析源码看看。
哦,原来是这样,我们通过最后一句被传输的filename的值是通过str2和text的值拼接的。
Text的值,我们搞定了,但是str2的值呢,是通过str来决定的,也就是我们的oid参数,所以当我们将oid的值改为../的时候,str2指向的目录才是网站的根目录,那么我们现在再来试试?
http://xxxxxxx/2052/Aspx/gw/download.aspx?name=../../../web.config&oid=../
成功下载,我们打开看看呗?
很nice,所以,今天的任意文件下载漏洞和未授权访问漏洞,你学到了吗?









关注公众号:拾黑(shiheibook)了解更多
[广告]赞助链接:
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

随时掌握互联网精彩
赞助链接
排名
热点
搜索指数
- 1 长江的美丽变奏 7923792
- 2 中央一号文件:推进农村高额彩礼治理 7905272
- 3 DeepSeek预测《哪吒2》最终票房 7877791
- 4 小包裹折射中国经济澎湃动能 7729097
- 5 不允许城镇居民到农村买农房、宅基地 7606879
- 6 国防部深感诧异强烈不满 7542772
- 7 马库斯被北京的空气质量震惊了 7461415
- 8 终于有部剧还原了我的高清童年 7331315
- 9 王曼昱4比0胜孙颖莎 首夺亚洲杯冠军 7258996
- 10 吴越新角色是叛逆闺蜜系妈咪 7137964