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的更多相关文章

  1. MIME sniffing攻击

    基于IE的MIME sniffing功能的跨站点脚本攻击 IE有一个特性,那就是在将一个文件展示给用户之前会首先检查文件的类型,这乍看起来并没什么问题,但实际上这是相当危险的,因为这会允许IE执行图片 ...

  2. header的安全配置指南

    0x00 背景 在统计了Alexa top 100万网站的header安全分析之后(2012年11月 - 2013年3月 - 2013年11月),我们发现其实如何正确的设置一个header并不是一件容 ...

  3. xmlhttp

    File an issue about the selected textFile an issue about the selected text XMLHttpRequest Living Sta ...

  4. 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 ...

  5. 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 ...

  6. 你的图片可能是这样被CORB“拦截”的

    问题 最近学习一个uniapp+nodejs的项目,前端写了这样一个标签 <image :src="info.imgUrl" ></image> 按理说不应 ...

  7. 参数探测(Parameter Sniffing)影响存储过程执行效率解决方案

    如果SQL query中有参数,SQL Server 会创建一个参数嗅探进程以提高执行性能.该计划通常是最好的并被保存以重复利用.只是偶尔,不会选择最优的执行计划而影响执行效率. SQL Server ...

  8. 上传和设置Mime类型

    这两天一直在忙把主页上传的事,幸亏不久前花七块钱买了一年的数据库和虚拟主机,昨天上传了自己的个人主页,发现很多问题要改,因为代码一直没整理就那么放着了,大部分东西都要重新弄,然后把本地数据库的数据迁移 ...

  9. 获取文件mime类型

    检测文件类型 finfo_file (PHP >= 5.3.0, PECL fileinfo >= 0.1.0) 修改php.ini,将extension=php_fileinfo.dll ...

随机推荐

  1. java 8 原版 api 下载地址,

    http://download.oracle.com/otn-pub/java/javafx/8.0.25-b17/javafx-8u25-apidocs.zip?AuthParam=14174994 ...

  2. Python 网络编程(二)

    Python 网络编程 上一篇博客介绍了socket的基本概念以及实现了简单的TCP和UDP的客户端.服务器程序,本篇博客主要对socket编程进行更深入的讲解 一.简化版ssh实现 这是一个极其简单 ...

  3. Filezilla 适用于 Win2003 和 WinXP 的版本

    服务器端版本为: 0.9.43 客户端版本为: 3.9.01

  4. 源码阅读笔记 - 3 std::string 与 Short String Optimization

    众所周知,大部分情况下,操作一个自动(栈)变量的速度是比操作一个堆上的值的速度快的.然而,栈数组的大小是在编译时确定的(不要说 C99 的VLA,那货的 sizeof 是运行时计算的),但是堆数组的大 ...

  5. ubuntu下快速制作linux 系统安装盘

    1. 安装unetbootin sudo apt-get install unetbooin 2. 超级系统管理员启动,选择镜像文件并安装 先插入空白USB,然后打开终端输入命令 su - 输入密码, ...

  6. CentOS下Apache开启Rewrite功能

    1.centos的配置文件放在: /etc/httpd/conf/httpd.conf 打开文件找到: LoadModule rewrite_module modules/mod_rewrite.so ...

  7. js 处理 html 标签转义 处理json中含有的ascii 编码

    function escape2Html(str) { var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&am ...

  8. 在MyBook Live上部署svn

    一直以来都在用svn管理源代码,美中不足的是由于svn服务器端部署在本地,无法实现在异地迁入迁出程序,因此考虑将svn服务器部署在我的MyBook Live上. 一.部署svn 1.分别执行以下2条命 ...

  9. SDRAM控制器的Verilog建模之一

    前言:作为经典存储器的三剑客中的flash和sram已经建模测试过了,虽然现在都已经ddr2,ddr3,667MHZ.1333MHZ的天下了,但是接下这周来准备写一下sdram的controller. ...

  10. Oracle去掉字符串首尾

    今天刚注册博客,与大家分享一下今天的新的: 今天在报表中碰到这样一个需求,数据库里面的一个字段是其他的3个字段合成的,但是现在读取数据只要中间的那一部分, 思考了许久这个字段的中间部分不是固定的,头和 ...