Statement in advance: I just talked about how to use this component.
In another important XX period (I hope this article will help my colleagues who are facing this need), a web application is facing security reinforcement Requirements for the first time, and the appscan Security Test Report is refreshing, the content is comprehensive, and the prompt is recommended, and it is noon. Of course, some Chinese are obviously useless.
Previously, the back-end architecture of this application was re
In advance: Just talking about, I also used this component a little bit.And to an important XX period (hopefully this article to meet the needs of the colleagues to help), a Web application for the first time to face the security requirements, AppScan Security test report is very refreshing, comprehensive content, hints suggest in place, and is noon Oh, of course some Chinese obviously Dog.Before this application of the back-end architecture is relatively solid, so the important problem is near
standard HTML Tag.
You need to encode the slash (/), because when XSS attacks are performed, the slash (/) is very useful for disabling the current HTML Tag.
We recommend that you use the ESAPI function library provided by OWASP, which provides a series of very strict functions for various security coding. In the current example, you can use:
String encodedContent = ESAPI.encoder().encodeForHTML(request.getParameter(“input”));
Principle 3: HTML attri
.
HTML entity encoding before inserting non-trusted data ... HTML entity encoding before inserting non-trusted data ... HTML entity encoding ...
[Coding Rules]So what exactly should HTML entity coding do? It needs to encode the following 6 special characters:–> amp;>–> gt;"–> quot;' –> #x27;/–> #x2f;There are two points that need to be specifically stated:
It is not recommended to encode single quotation marks (') as apos; Because it's not a standard HTML ta
This article is a translated version of the XSS defense Checklist Https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_SheetIntroductionThis article describes a simple positive pattern that properly uses output transcoding or escaping (encoding or escaping) to defend against XSS attacks.Despite the huge amount of XSS attacks, following some simple rules can completely prevent this kind of serious attack.This article does not discuss the commercial and technical impact
when dealing with nested contexts, such as a URL written in JavaScript in HTML properties. You might want to encode libraries such as owasp Esapi help.4. Unsafe direct Object referencesAny time an application exposes an internal identifier, such as a database key, file name, or HashMap index, an attacker could attempt to manipulate these identifiers to access unauthorized data. For example, if you pass untrusted data from an HTTP request to a Java fi
1. Write the filter intercept yourself, but be aware that when you configure filter in Web. XML, put this filter in the first place.2. Implement Esapi Library with open source, reference website: Https://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API3. It can be implemented using the tool classes provided in spring.One, the first method.Web. xml file Filter configurationclass> newly written xssfilter path class> * Writing filter Fil
not use a precompiled placeholder.
The checksum function has a defect or a placeholder use error.
Main Defense methods:1. Pre-compile and bind variables with SQL statements2, the use of white list and blacklist to achieve input inspection3. Using Esapi for escape processing in dynamic SQL and splicing SQL scenarios
// ESAPI转义,防SQL注入 publicstaticencodeForSql(String input) {
URL where it can be mor E easily disclosed or stolen. 3. Cross-site Scripting (XSS)- xss occurs when Java EE developers take untrusted information from The HTTP request and put it in the HTTP response without proper contextual output encoding. the attacker can use this behavior to inject their scripts into a website where they can hijack sessions and steal D Ata. to prevent these attacks, developers need to perform context-sensitive output encoding. if you ' re putting data to HTML, use #xx;
only incoming input that conforms to the desired format2 The same white list filtering policy is performed on the client browser (saving round-trip traffic)3 Use blacklist and whitelist input validation (in the form of vulnerability "signature" and "experienced" behavior) at the Web application Firewall (WAF) level to provide intrusion detection/blocking capabilities and monitoring application attacks4 The use of parameterized statements from the beginning to the end in the application to ensur
-Site_Request_Forgery_ (CSRF) _prevention_cheat_sheetAnother example is the ESAPI session management control, which includes components for CSRF-Http://www.owasp.org/index.php/ESAPI[2] Ensure that there are no cross-site scripting issues (CWE-79) in the application because most CSRF defenses can be bypassed by using script that is controlled by the attacker.[3] Generate a unique current logo for each form,
On SendSafely.com we make heavy use of latest new JavaScript APIs introduced with HTML5. We encrypt files, calculate checksums and upload data using pure JavaScript. moving logic like this down to the browser, however, makes the threat of Cross-Site Scripting (XSS) even greater than before. in order to prevent XSS vulnerabilities, our site makes liberal use of pretty aggressive client-side and server-side encoding APIs. these APIs are based on the owasp esap
indicates that this link can be viewed only after logon, as shown in Figure 10-4.
Figure 10-4 we are attempting to access a Private Link
➌ Enable webscrab and enable the "intercept requests" function in the proxy, set the Firefox proxy to the IP address and port (8008) of webscrab, and then access this private link again, webscrab intercepts this request, modifies jsessionid to the jsessionid of the admin user above, as shown in 10-5, and submits the request.
Figure 10-5 capture and modify
} + returnsb.tostring (); - } the * $ Panax Notoginseng}String title = Htmlfilter.filter (Request.getparameter ("title"));String content = Htmlfilter.filter (request.getparameter ("content"));Encode it before you join the database. Although XSS forms a variety, it is difficult to defend. But this is basically enough for small and medium companies.If you don't feel enough, you can refer to using owasp Esapi, not only to prot
()%3b%3c%2fscript%3e, so any time encoded text I s found we simply return with a HTTP error code. This rule makes use of the ESAPI library supplied by OWASP.Like the second rule, the third rule would prevent further processing if the supplied parameter have any special HTML Charac Ters. If you would like your customers to being able to pass through characters as , this rule is too broad. However, it's almost always valid to block special HTML charact
using object[x] accessors.10, in the ECMAScript 5 sandbox running JS code, yes JS interface is not compromised.11, Don ' t eval() JSON to convert it to native JavaScript objects. Instead Use and JSON.toJSON()JSON.parse()frequently asked questions about mitigating Dom Based XSS attacksComplex ContextA point has two meanings, first the JS variable, and then the URL for the target application.
If the client uses the JS version of the URL escape library, you can do the following
Thoughts and conclusions on XSS prevention
I recently read some web security-related articles, most of which have systematic and complete solutions. However, XSS (Cross-site scripting) attack-related information is messy, even the XSS attacks where HTML object escaping can solve are unclear.
After turning over a bunch of materials, I thought I 'd better record some of my thoughts on it.
Note that there are different ways to avoid XSS:Text section of the HTML Tag, for example:
In the first case
authentication error information may cause dictionary attacks or brute-force cracking. Therefore, we should give a common error message as much as possible.
In addition, to prevent brute-force attacks, we can set the following rules:
-The first Logon Failed. The next logon interval is at least 5 s.
-The second Logon Failed. The next logon interval is at least 15 s.
-The third logon fails. The next logon interval is at least 45 s.
-The fourth Logon Failed. The graphic Verification Code CAPTCHA i
1. CauseImproper authentication and session management methods.Including logout, password management, timeout mechanism, remembering users, password problems, and account updates.2. HazardsThe account is stolen and attackers can have all the permissions of the account. Privileged accounts are often attacked.3. Discovery(1) An insecure hash or encryption algorithm is used to store passwords.(2) Use the weak account management function to guess or overwrite the user password (Account creation, pas
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.