web.config中的HttpCookie.HttpOnly属性
Abstract:
The program does not set the HttpCookie.HttpOnly property to true.
Explanation:
The default value for the httpOnlyCookies attribute is false, meaning that the cookie is accessible through a client-side script.
This is an unnecessary cross-site scripting threat, resulting in stolen cookies. Stolen cookies can contain sensitive information
identifying the user to the site, such as the ASP.NET session ID or forms authentication ticket, and can be replayed by the
attacker in order to masquerade as the user or obtain sensitive information.
Example 1: Vulnerable configuration:
<configuration>
<system.web>
<httpCookies httpOnlyCookies="false">
Recommendations:
Microsoft Internet Explorer version 6 Service Pack 1 and later supports a cookie property, HttpOnly, that can help mitigate crosssite
scripting threats that result in stolen cookies. Stolen cookies can contain sensitive information identifying the user to the site,
such as the ASP.NET session ID or forms authentication ticket, and can be replayed by the attacker in order to masquerade as the
user or obtain sensitive information. When an HttpOnly cookie is received by a compliant browser, it is inaccessible to clientside
script.
Example 2: Here see the secure configuration. Any cookie marked with this property will be accessible only from server-side
code, and not to any client-side scripting code like JavaScript or VBScript. This shielding of cookies from the client helps to
protect Web-based applications from cross-site scripting attacks. A hacker initiates a cross-site scripting (also called CSS or
XSS) attack by attempting to insert his own script code into the Web page to get around any application security in place. Any
page that accepts input from a user and echoes that input back is potentially vulnerable.
<configuration>
<system.web>
<httpCookies httpOnlyCookies="true">
Tips:
1. It is possible to enable HttpOnly programmatically on any individual cookie by setting the HttpOnly property of the
HttpCookie object to true. However, it is easier and more reliable to configure the application to automatically enable HttpOnly
for all cookies. To do this, set the httpOnlyCookies attribute of the httpCookies element to true.
2. Setting the HttpOnly property to true does not prevent an attacker with access to the network channel from accessing the
cookie directly. Consider using Secure Sockets Layer (SSL) to help protect against this. Workstation security is also important,
as a malicious user could use an open browser window or a computer containing persistent cookies to obtain access to a Web site
with a legitimate user's identity.
web.config中的HttpCookie.HttpOnly属性的更多相关文章
- WCF项目问题2-无法激活服务,因为它需要 ASP.NET 兼容性。没有未此应用程序启用 ASP.NET 兼容性。请在 web.config 中启用 ASP.NET 兼容性,或将 AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode 属性设置为 Required 以外的值。
无法激活服务,因为它需要 ASP.NET 兼容性.没有未此应用程序启用 ASP.NET 兼容性.请在 web.config 中启用 ASP.NET 兼容性,或将 AspNetCompatibility ...
- web.config中配置页面出错后跳转指定错误页面
每当用户访问错误页面时,会出现不友好的404错误,所以为了防止这种不友好,我们在web.config中的<system.web>节点下配置 <customErrors>,在出现 ...
- ASP.Net Web.config 中引用外部config文件
1. 前提准备: Web.config file: <?xml version="1.0" encoding="utf-8"?><config ...
- web.config中sessionState节点的配置方案
web.config中sessionState节点的配置方案 web.config关于sessionState节点的配置方案,sessionState有五种模式:Custom,off,inProc,S ...
- web.config中<customErrors>节点
错误提示: “/”应用程序中的服务器错误.------------------------------------------------------------------------------- ...
- web.config中configSections section节 -Z
由于最近一个项目的数据库变动比较频繁, 为了减少数据层的负担, 打算采用.net的MVC框架, 使用LINQ对付数据层. 这个框架的web.config文件里出现了configSectio ...
- ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法
ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法 第一种情况,本地开发时,使用本地数据库,如下面的代码 <connectionStrings& ...
- web.config中的InProc模式 与 StateServer模式[转]
开发asp.net应用时,修改web.config中的SessionState节点. <sessionState mode="StateServer" stateConnec ...
- asp.net mvc 3 配置全局错误处理 Web.config中设置CustomError
摘自: http://www.myexception.cn/web/1130191.html asp.net mvc 配置全局异常处理 Web.config中设置CustomError Web.con ...
随机推荐
- 【python】获取指定网页上的所有超级链接
# -*- coding: utf-8 -*- import urllib2 import re #connect to a URL website = urllib2.urlopen("h ...
- HTML meta 头部的一些内容
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable= ...
- Spark BlockManager的通信及内存占用分析(源码阅读九)
之前阅读也有总结过Block的RPC服务是通过NettyBlockRpcServer提供打开,即下载Block文件的功能.然后在启动jbo的时候由Driver上的BlockManagerMaster对 ...
- Redis应用配置项说明
近期整理了下项目中Redis配置参数,以便学习备用~ #指定内存大小,格式为1k 1GB 1M,单位不区分大小写 # 1k => 1000 bytes # 1kb => 1024 byt ...
- DataTable
//遍历datatable的方法2009-09-08 10:02方法一: DataTable dt = dataSet.Tables[]; ; i < dt.Rows.Count ; i++) ...
- linux查找日志技巧
对于从事web开发的人员来说.服务器上的日志多如牛毛,如何快速从中找出所需信息非常重要,以下是我在工作中用到的查找日志的简单命令,希望能对您有所帮助: 工具/原料 linux SecureCR ...
- oracle kill session
kill session 是DBA经常碰到的事情之一.如果kill 掉了不该kill 的session,则具有破坏性,因此尽可能的避免这样的错误发生.同时也应当注意,如果kill 的session属于 ...
- gtest学习一:在vs2013中搭建gtest环境
gtest版本:1.7.0,在哪里下载源码就不说了,网上太多了~ 配置过程: 1.下载解压后,进入googletest/msvc目录,直接打开gtest.sln,发现有四个工程:gtest.gtest ...
- win10 下runtime error 解决办法
下载http://120.52.73.50/download.microsoft.com/download/5/2/1/5212066c-5f48-4b16-a059-ed84b505a65d/vcr ...
- PlayerPrefs游戏存档
本地存储.相当于Flash里面的SharedObject. Android位置:机器自身存储的(非扩展卡)/data/data/appname/shared_prefs/{AppName}.xml,如 ...