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 ...
随机推荐
- Javascript中变量提升的问题
一.函数声明变量提升 函数声明具有变量提升的问题,所以在函数被声明之前就可以访问. //else中的语句相当于将if中的function重写,因此无论flag为何值,返回的方法始终为重写后的方法. / ...
- sqlserver无ldf日志文件附加的方法(数据库没有完全关闭,无法重新生成日志)
数据库的ldf日志文件被删了,直接附加时报错:数据库没有完全关闭,无法重新生成日志 那怎么恢复数据呢?方法如下: 在数据库中新建一个同名的数据库(文件路径要与原来的相同,ldf的文件名也要相同),然后 ...
- R语言-数据结构
1.向量 向量是用来存储数值型.字符型或逻辑性数据的一维数组,用函数c()创建向量 a <- c(1,2,5,6,4) b <- c("one","two&q ...
- 扩展AuthorizeAttribute
MVC中经常会用到关于设置访问权限的问题: 如果我们扩展了AuthorizeAttribute,那么我们只需要在类或方法前加上此attribute,即可实现权限问题. AttributeTargets ...
- Git 版本库添加空目录方法
直接在版本库工作目录下创建空目录后,使用git status查看,发现空目录没有被版本库识别. 正确的添加空目录的方法: 在空目录下创建.gitkeep文件:touch .gitkeep 然后重新执行 ...
- 怎么打开sql server 数据库日志文件
To Open Log File Viewer, 1. Expand Server Node > 2. Expand SQL Server Agent > 3. Expand Jobs & ...
- 表在用时建索引要加ONLINE
因为: 源地址:https://zhidao.baidu.com/question/585392982737434725.html 一般建立索引会引起锁表,不允许进行数据更新等DML操作: 如果建立索 ...
- VS2015 使用Razor编写MVC视图时,Razor智能提示消失,报各种红线解决方案。
打开文件夹 Users\<CurrentUser>\AppData\Local\Microsoft\VisualStudio\<version> 删除文件夹 Component ...
- Windows系统
1. 更改XP登录界面 怎样启用XP的经典登录界面 第一步:用管理员账号登录系统. 第二步:运行gpedit.msc启动组策略编辑器,找到"计算机配置"--"管理模板&q ...
- XF 文档 - Element Framework Doc
配置篇 Chapter Configuration Schema篇 Chapter Schema 查询篇 Chapter Querying Data 数据更改及验证篇 Chapter Data Mod ...