Anti XSS 防跨站脚本攻击库
2016-06-13 06:29
155 查看
https://wpl.codeplex.com/
Before understanding Anti-Cross Site Scripting Library (AntiXSS), let us understand Cross-Site Scripting(XSS).
An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by your browser and used with that site. These scripts can even rewrite the content of the HTML page.
Cross-Site Scripting (XSS) attacks occur when:
Data enters a Web application through an untrusted source, most frequently a web request.
The data is included in dynamic content that is sent to a web user without being validated for malicious code.
The malicious content sent to the web browser often takes the form of a segment of JavaScript, but may also include HTML, Flash or any other type of code that the browser may execute. The variety of attacks based on XSS is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to web content controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site.
Improved Performance. AntiXSS has been completely rewritten with performance in mind, and yet retains the fundamental protection from XSS attacks that you have come to rely on for your applications.
Secure Globalization. The web is a global market place, and cross-site scripting is a global issue. An attack can be coded anywhere, and Anti-XSS now protects against XSS attacks coded in dozens of languages.
Standards Compliance. AntiXSS is written to comply with modern web standards. You can protect your web application without adversely affecting its UI.
To prevent XSS, we need to use the below code (AntiXSS):
Hide Copy Code
You can download AntiXSS library from here.
Before understanding Anti-Cross Site Scripting Library (AntiXSS), let us understand Cross-Site Scripting(XSS).
Cross-site Scripting (XSS)
Cross-Site Scripting attacks are a type of injection problem, in which malicious scripts are injected into the otherwise benign and trusted web sites. Cross-site scripting (XSS) attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user in the output it generates without validating or encoding it.An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script. Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by your browser and used with that site. These scripts can even rewrite the content of the HTML page.
Cross-Site Scripting (XSS) attacks occur when:
Data enters a Web application through an untrusted source, most frequently a web request.
The data is included in dynamic content that is sent to a web user without being validated for malicious code.
The malicious content sent to the web browser often takes the form of a segment of JavaScript, but may also include HTML, Flash or any other type of code that the browser may execute. The variety of attacks based on XSS is almost limitless, but they commonly include transmitting private data like cookies or other session information to the attacker, redirecting the victim to web content controlled by the attacker, or performing other malicious operations on the user's machine under the guise of the vulnerable site.
Anti-Cross Site Scripting Library
AntiXSS helps you to protect your current applications from cross-site scripting attacks, at the same time helping you to protect your legacy application with its Security Runtime Engine. AntiXSS incorporates radically and innovatively rethought features, offering you a newer, more powerful weapon against the often employed cross-site scripting (XSS) attack. AntiXSS gives you:Improved Performance. AntiXSS has been completely rewritten with performance in mind, and yet retains the fundamental protection from XSS attacks that you have come to rely on for your applications.
Secure Globalization. The web is a global market place, and cross-site scripting is a global issue. An attack can be coded anywhere, and Anti-XSS now protects against XSS attacks coded in dozens of languages.
Standards Compliance. AntiXSS is written to comply with modern web standards. You can protect your web application without adversely affecting its UI.
How it works?
Proper output encoding and good input validation will fix the XSS issue. For output encoding, use AntiXSS Library for its comprehensive encoding capabilities. AntiXSS works by looking at all the characters in the input and encoding characters not in the whitelist.XSS Vulnerability
Hide Copy CodeResponse.Write(Request.Params["input"]);
To prevent XSS, we need to use the below code (AntiXSS):
Hide Copy Code
AntiXss.UrlEncode(TextBox1.Text) AntiXss.HtmlAttributeEncode(TextBox1.Text) AntiXss.XmlEncode(TextBox1.Text) AntiXss.JavaScriptEncode(item)
You can download AntiXSS library from here.
相关文章推荐
- linux文件复制和移动
- 掌握 Cinder 的设计思想 - 每天5分钟玩转 OpenStack(46)
- 掌握 Cinder 的设计思想 - 每天5分钟玩转 OpenStack(46)
- iOS单例详解
- 掌握 Cinder 的设计思想 - 每天5分钟玩转 OpenStack(46)
- JNI - AttachCurrentThread
- 四人团-江南行-绍兴旅游
- 【跟着子迟品 underscore】Array Functions 相关源码拾遗 & 小结
- 项目团队数据库版本管理及发布探索
- 说话没必要太损
- Canvas Transformation
- Android tablayout and toolbar
- Symmetric Tree
- 神经网络
- leetcode #89 in cpp
- C/C++中读写文件
- [ES7] Exploring ES2016 Decorators
- Binary Tree Level Order Traversal II
- LeetCode 166. Fraction to Recurring Decimal
- iOS之Runtime