惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
Cisco Talos Blog
Cisco Talos Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
Project Zero
Project Zero
E
Exploit-DB.com RSS Feed
S
Secure Thoughts
K
Kaspersky official blog
L
Lohrmann on Cybersecurity
NISL@THU
NISL@THU
WordPress大学
WordPress大学
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 热门话题
小众软件
小众软件
P
Privacy & Cybersecurity Law Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
About on SuperTechFans
Hacker News: Ask HN
Hacker News: Ask HN
AWS News Blog
AWS News Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hacker News: Front Page
F
Full Disclosure
Latest news
Latest news
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
T
Troy Hunt's Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
TaoSecurity Blog
TaoSecurity Blog
G
GRAHAM CLULEY
Forbes - Security
Forbes - Security
V
V2EX - 技术
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
C
Cyber Attacks, Cyber Crime and Cyber Security
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
P
Privacy International News Feed
C
Check Point Blog
N
News and Events Feed by Topic

博客园 - davin

phonegap3.0+HTMLl5 开发 ipad app 总结 移动支付-修复FireFox在android移动设备下面的Session 丢失的问题 Window.history.forward(1) 阻止页面后退详解 Pro WPF and Silverlight MVVM:第5章 Event and Command 读书笔记 Pro WPF and Silverlight MVVM 第4章ViewModel 读书笔记 Silverlight4:Devexpress Report Useful rules for compatible with FF,safari and ie8 Entity Framework 4.0 FK Properties && FK Associations Entity Framework 4.0 recipes 读书笔记2 ExecuteStoreQuery() Entity Framework 4.0 Recipes 读书笔记1 EDM中的 Complex Type sqlserver2008 + team foundation server 2008 sp1 silverlight animation 读书笔记(4)三角函数 silverlight animation 读书笔记(3)坐标与向量 silverlight animation 读书笔记<2>模糊, 裁剪,拖拽 foundation silverligh3 animation 读书笔记<1>transform 在silverlight中打开调用外部程序的几种方式 Entity Framework object && Json 序列化的问题 silverlight3:(ItemControl 的)UI Virtualization SharpZipLib 数据压缩
Beginning Asp.Net Security 读书笔记-----XSS
davin · 2014-07-24 · via 博客园 - davin

 几个月前通过Veracode对代码进行动态和静态安全扫描,扫出了数以千计的安全bug,基本上都是top 10的,安全漏洞. 其中CWE80,CWE601数量最多.具体CWE的定义可参考http://cwe.mitre.org/ 。

 正好手上有Beginning Asp.Net Security这本书,所以就看了看。所有的安全漏洞都源于非法用户的输入,所以任何应用程序或业务系统都需要在一定范围内设置安全边界。

 在安全边界以外,接受任何用户输入都应该认为是不安全的,而黑客也是通过用户变量的进行代入达到攻击的目的,所以在接受用户输入的时候需要加入校验。在Asp.Net中对于Request默认是有验证的,在发送任何发送Request的http runtime时候都会验证请求中的form内容,如果request中有危险字符

我们可以得到如图黄页错误。我们可以通过下面设置取消在http runtime的验证

•<%@ Page validateRequest=“false” %>

•<system.web> <pages validateRequest="false" /> </system.web>

在mvc里面可以 用下面的配置:

•<httpRuntime requestValidationMode="2.0" />

•[AllowHtml]

•[ValidateInput(false)]

取消了http runtime 的request 验证,那么后台程序就可以接收到用户的所有输入了,一旦用户的输入包括了javascript,sql就有可能被注入攻击,所以需要对用户的输入进行处理了(encode).

Anti-Cross Site Scripting Library

Anti-Cross Site Scripting Library是MS的开源项目,它针对CSS,Javascript,html,url等标签中的特殊危险字符进行编码,以达到防范攻击的目的