惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
Jina AI
Jina AI
雷峰网
雷峰网
月光博客
月光博客
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
B
Blog RSS Feed
美团技术团队
C
CXSECURITY Database RSS Feed - CXSecurity.com
小众软件
小众软件
Security Latest
Security Latest
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
Last Week in AI
Last Week in AI
A
Arctic Wolf
Latest news
Latest news
Attack and Defense Labs
Attack and Defense Labs
I
Intezer
F
Fortinet All Blogs
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
Webroot Blog
Webroot Blog
S
Secure Thoughts
Help Net Security
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
V
Visual Studio Blog
P
Proofpoint News Feed
博客园 - 【当耐特】
P
Privacy International News Feed
V
Vulnerabilities – Threatpost
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
H
Help Net Security
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tenable Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog

博客园 - 天寒

oracle 11gr2 2.04 em 更改 hostname 后无需重建资料库的方法 emca 更改监听端口 centos 安装vmware 9.02 报 Failed to load module "pk-gtk-module" "canberra-gtk-module" can not update ICEAuthority file mint或则ubuntu IIS使用ASP.NET State Service存储Session 16个出色的开源软件 教程:创建简单的 ETL 包 SQL Server 2005 Beta 2 Transact-SQL 增强功能 深度看点 Linq查询与性能解析 EF v2 and Data Access Architecture Best Practices ASP.NET Dynamic Data Entity Framework Resources [转]PDC:Anders谈C# 4.0:新功能和展望 [转]从C# 2.0新特性到C# 3.5新特性 [转]探寻C# 3.5新特性 Eclipse反编译插件: Jodeclipse与JadClipse iis 6 tuning [转载]OllyDBG 入门系列(一)-认识OllyDBG C# new and override
IIS 静态文件 如doc附件的安全控制
天寒 · 2013-01-10 · via 博客园 - 天寒

问题描述:

http://www.qq.com/downloadFloder/12345.doc

IIS + asp.net 下,如果用户知道上面的文件路径,就可以直接下载doc类型的附件。

实现方法:

大概说说,默认情况下,IIS + asp.net是两层分别处理,
1)如果用户请求*.doc,*.txt的文件,IIS 直接返回结果给用户。
2)如果用户请求*.aspx,IIS将处理转交给asp.net。

而我们的form验证是在asp.net层的,如果控制*.doc安全话,就让IIS把*.doc文件的处理交给asp.net,就是在IIS属性配置映射。

配置:

1)IIS6站点->属性->主目录 ->应用程序设置 配置->添加映射 

可执行文件:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

扩展名:.doc

动作: 全部 或者 限制为GET,HEAD,POST,DEBUG

2)在web.config 中配置

<httpHandlers>
<add verb="*" path="*.doc" type="System.Web.StaticFileHandler" />
</httpHandlers>

3)在下载目录downloadFolder配置web.config 限制非验证用户

<?xml version="1.0"?>
<configuration>
 <system.web>
  <authorization>
    <deny users="?"/>
  </authorization>
 </system.web>
</configuration>

如果进一步对权限进行控制,则可以自己写个类代替System.Web.StaticFileHandler接管文件的处理。