MIME Sniffing
Abstract:
The web.config file does not include the required header to mitigate MIME sniffing attacks
Explanation:
MIME sniffing, is the practice of inspecting the content of a byte stream to attempt to deduce the file format of the data within it.
If MIME sniffing is not explicitly disabled, some browsers can be manipulated into interpreting data in a way that is not
intended, allowing for cross-site scripting attacks.
For each page that could contain user controllable content, you should use the HTTP Header X-Content-Type-Options: nosniff.
Recommendations:
To mitigate this finding, the programmer can either: (1) set it globally for all pages in the application in the web.config file, or (2)
set the required header page by page for only those pages that might contain user-controllable content.
To set it globally add the header in the web.config file for the application being hosted by Internet Information Services (IIS):
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff"/>
</customHeaders>
</httpProtocol>
</system.webServer>
The following examples shows how to add the header to the global Application_BeginRequest method:
void Application_BeginRequest(object sender, EventArgs e)
{
this.Response.Headers["X-Content-Type-Options"] = "nosniff";
}
The following example shows how to add it to a page by implementing a custom HTTP module using the IHttpModule interface
public class XContentTypeOptionsModule : IHttpModule
{
...
void context_PreSendRequestHeaders(object sender, EventArgs e)
{
HttpApplication application = sender as HttpApplication;
if (application == null) return;
if (application.Response.Headers["X-Content-Type-Options"] != null) return;
application.Response.Headers.Add("X-Content-Type-Options", "nosniff");
}
}
MIME Sniffing的更多相关文章
- MIME sniffing攻击
基于IE的MIME sniffing功能的跨站点脚本攻击 IE有一个特性,那就是在将一个文件展示给用户之前会首先检查文件的类型,这乍看起来并没什么问题,但实际上这是相当危险的,因为这会允许IE执行图片 ...
- header的安全配置指南
0x00 背景 在统计了Alexa top 100万网站的header安全分析之后(2012年11月 - 2013年3月 - 2013年11月),我们发现其实如何正确的设置一个header并不是一件容 ...
- xmlhttp
File an issue about the selected textFile an issue about the selected text XMLHttpRequest Living Sta ...
- Awesome Go精选的Go框架,库和软件的精选清单.A curated list of awesome Go frameworks, libraries and software
Awesome Go financial support to Awesome Go A curated list of awesome Go frameworks, libraries a ...
- What are all the possible values for HTTP “Content-Type” header?
What are all the possible values for HTTP “Content-Type” header? You can find every content type her ...
- 你的图片可能是这样被CORB“拦截”的
问题 最近学习一个uniapp+nodejs的项目,前端写了这样一个标签 <image :src="info.imgUrl" ></image> 按理说不应 ...
- 参数探测(Parameter Sniffing)影响存储过程执行效率解决方案
如果SQL query中有参数,SQL Server 会创建一个参数嗅探进程以提高执行性能.该计划通常是最好的并被保存以重复利用.只是偶尔,不会选择最优的执行计划而影响执行效率. SQL Server ...
- 上传和设置Mime类型
这两天一直在忙把主页上传的事,幸亏不久前花七块钱买了一年的数据库和虚拟主机,昨天上传了自己的个人主页,发现很多问题要改,因为代码一直没整理就那么放着了,大部分东西都要重新弄,然后把本地数据库的数据迁移 ...
- 获取文件mime类型
检测文件类型 finfo_file (PHP >= 5.3.0, PECL fileinfo >= 0.1.0) 修改php.ini,将extension=php_fileinfo.dll ...
随机推荐
- Window 消息大全
消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了.例如,单击鼠标.改变窗口尺寸.按下键盘上的一个键都会使Windows发送一个消息给应用程序. 消息本身是作为一个记录传递给应用程序 ...
- sysbench 安装遇到的问题
sysbench 作为性能测试工具,提供了很多有用的参数,使用方法网络上一抓一把,这里记录下安装过程中遇到的问题已经解决办法 .tar.gz cd sysbench- ./autogen.sh ./c ...
- 条款19:设计class犹如设计type
1,新的type对象应该如何被创建和销毁? 这会影响class的构造函数ctor和析构函数dtor,以及内存分配函数和释放函数 //operator new //operator new[] // ...
- OAF_开发系列13_实现OAF通过Vector动态查询设置(案例)
20150715 Created By BaoXinjian
- OAF_文件系列8_实现OAF处理Excel的JXL包详解
写入/读取Excle,设置打印样式排版,锁定列与行,设置打印标题,给Excle加密. http://www.blogjava.net/xing5156/archive/2011/11/18/36422 ...
- [MySQL] 高可用架构MMM简单介绍
一.来源及原理: 众所周知,MySQL自身提供了AB复制(主从复制),然后可以很轻松实现master-master双向复制,同时再为其中一个Master节点搭建一个Slave库. 这样就实现了MySQ ...
- left join 取一条数据
产品生产过程中要记录产品在制作过程中的不良历史,即使在一个工序,也可以产生多条不良历史记录,所有的不良信息保存在B表中.假设产品在打包工序,存放打包工序成品参数记录的表A,数据是唯一的.但在打包过程中 ...
- interview que
百度: MySQL InnoDB存储的文件结构 索引树是如何维护的? 数据库自增主键可能的问题 Redis的并发竞争问题如何解决了解Redis事务的CAS操作吗 分析线程池的实现原理和线程的调度过程 ...
- windows下CMake使用图文手册 Part 4
例子4:链接静态库(.lib) 例子3里面我们构建了date.lib, 这个例子里我们调用这个库. 前提: date.h的头文件在 E:\Playground\CMakeExamples\DateLi ...
- XXX esx.problem.syslog.nonpersistent.formatOnHost not found XXX
ESXi 主机的摘要选项卡报告以下错误:配置问题:XXX esx.problem.syslog.nonpersistent.formatOnHost 未找到 XXX (2101811) Sympt ...