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 ...
随机推荐
- winform中ComboBox实现text和value,使显示和值分开,重写text和value属性
winform的ComboBox中只能赋值text,显示和值是一样的,很多时候不能满足根本需要,熟悉B/S开发的coder最常用的就是text和value分开的,而且web下DropDownList本 ...
- [zz] Principal Components Analysis (PCA) 主成分分析
我理解PCA应该分为2个过程:1.求出降维矩阵:2.利用得到的降维矩阵,对数据/特征做降维. 这里分成了两篇博客,来做总结. http://matlabdatamining.blogspot.com/ ...
- MyBatis学习(一)、MyBatis简介与配置MyBatis+Spring+MySql
一.MyBatis简介与配置MyBatis+Spring+MySql 1.1MyBatis简介 MyBatis 是一个可以自定义SQL.存储过程和高级映射的持久层框架.MyBatis 摒除了大部分的J ...
- sublime text2在windows中以命令行启动
sublime text2在windows中以命令行启动 把执行文件添加到PATH中即可,如图: 如果你和我一样习惯了mac下的简写subl,那么需要在程序目录中新建一个批处理文件subl.bat ...
- [asp.net]c# winform打印类
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using ...
- oracle之trunc与round
round(x[,y]) 功能:返回四舍五入后的值 参数:x,y,数字型表达式,如果y不为整数则截取y整数部分,如果y>0则四舍五入为y位小数,如果y小于0则四舍五入到小数点向左第y位. 返回: ...
- ORM框架详解
.Net开源微型ORM框架测评 什么是ORM? 对象关系映射(英语:Object Relation Mapping,简称ORM,或O/RM,或O/R mapping),是一种程序技术,用于实现面向对象 ...
- Spring3.1新特性(转)
一.Spring2.5之前,我们都是通过实现Controller接口或其他实现来定义我们的处理器类. 二.Spring2.5引入注解式处理器支持,通过@Controller 和 @RequestMap ...
- [AS3.0] NetConnection.Connect.Rejected 解决办法
以下是运用FMS录制视频的一段代码: package { import flash.display.Sprite; import flash.events.AsyncErrorEvent; impor ...
- selenium之操作ChromeDriver
链接:http://www.testwo.com/blog/6931 1.下载ChromeDriver驱动包(下载地址: http://chromedriver.storage.googleapis. ...