This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "Top 10 2013-A1-Injection"
(added 'Top_10:SummaryTableTemplate' to get this section easier and to get better prepared for internationalisation. + added '|language=en' to get better prepared for internationalisation.) |
m (brighter background for 'Top_10_2010:ExampleBeginTemplate' => added '|year=2013'; added some '|language=en') |
||
Line 9: | Line 9: | ||
}} | }} | ||
− | {{Top_10_2010:SummaryTableHeaderBeginTemplate|year=2013}} | + | {{Top_10_2010:SummaryTableHeaderBeginTemplate|year=2013|language=en}} |
{{Top_10:SummaryTableTemplate|exploitability=1|prevalence=2|detectability=2|impact=1|year=2013|language=en}} | {{Top_10:SummaryTableTemplate|exploitability=1|prevalence=2|detectability=2|impact=1|year=2013|language=en}} | ||
{{Top_10_2010:SummaryTableHeaderEndTemplate|year=2013}} | {{Top_10_2010:SummaryTableHeaderEndTemplate|year=2013}} | ||
Line 35: | Line 35: | ||
{{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=example|position=left|risk=1|year=2013|language=en}} | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=example|position=left|risk=1|year=2013|language=en}} | ||
The application uses untrusted data in the construction of the following vulnerable SQL call: | The application uses untrusted data in the construction of the following vulnerable SQL call: | ||
− | {{Top_10_2010:ExampleBeginTemplate}}<span style="color:red;"> | + | {{Top_10_2010:ExampleBeginTemplate|year=2013}}<span style="color:red;"> |
String query = "SELECT * FROM accounts WHERE custID='" + request.getParameter("id") +"'"; | String query = "SELECT * FROM accounts WHERE custID='" + request.getParameter("id") +"'"; | ||
</span>{{Top_10_2010:ExampleEndTemplate}} | </span>{{Top_10_2010:ExampleEndTemplate}} | ||
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. | 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. | ||
− | {{Top_10_2010:ExampleBeginTemplate}}<span style="color:red;"><nowiki> | + | {{Top_10_2010:ExampleBeginTemplate|year=2013}}<span style="color:red;"><nowiki> |
http://example.com/app/accountView?id=' or '1'='1 | http://example.com/app/accountView?id=' or '1'='1 | ||
</nowiki></span>{{Top_10_2010:ExampleEndTemplate}} | </nowiki></span>{{Top_10_2010:ExampleEndTemplate}} |
Revision as of 14:18, 9 June 2013
NOTE: THIS IS NOT THE LATEST VERSION. Please visit the OWASP Top 10 project page to find the latest edition.
[[Top 10 {{{year}}}-T10|← T10]] | [[Top_10_{{{year}}}-Top 10|{{{year}}} Top 10 List]] |
[[Top 10 {{{year}}}-Broken Authentication and Session Management|Broken Authentication and Session Management →]] |
Threat Agents | Attack Vectors | Security Weakness | Technical Impacts | Business Impacts | |
---|---|---|---|---|---|
Application Specific | Exploitability EASY |
Prevalence COMMON |
Detectability AVERAGE |
Impact SEVERE |
Application / Business Specific |
Consider anyone who can send untrusted data to the system, including external users, internal users, and administrators. | Attacker sends simple text-based attacks that exploit the syntax of the targeted interpreter. Almost any source of data can be an injection vector, including internal sources. | Injection flaws occur when an application sends untrusted data to an interpreter. Injection flaws are very prevalent, particularly in legacy code. They are often found in SQL, LDAP, or XPath queries, OS commands, XML parsers, program arguments, etc. Injection flaws are easy to discover when examining code, but more difficult via testing. Scanners and fuzzers can help attackers find them. | Injection can result in data loss or corruption, lack of accountability, or denial of access. Injection can sometimes lead to complete host takeover. | Consider the business value of the affected data and the platform running the interpreter. All data could be stolen, modified, or deleted. Could your reputation be harmed? |
Am 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. For SQL calls, this means using bind variables in all prepared statements and stored procedures, and avoiding dynamic queries. 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. Penetration testers can validate these issues by crafting exploits that confirm the vulnerability. Automated dynamic scanning which exercises the application may provide insight into whether some exploitable injection flaws exist. Scanners cannot always reach interpreters and have difficulty detecting whether an attack was successful. Poor error handling makes injection flaws easier to discover. |
How Do I Prevent 'Injection'?
Preventing injection requires keeping untrusted data separate from commands and queries.
|
Example Attack Scenarios
The application uses untrusted data in the construction of the following vulnerable SQL call: String query = "SELECT * FROM accounts WHERE custID='" + 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 that enable a complete takeover of the database and possibly even the server hosting the database. |
References
OWASP
|
[[Top 10 {{{year}}}-T10|← T10]] | [[Top_10_{{{year}}}-Top 10|{{{year}}} Top 10 List]] |
[[Top 10 {{{year}}}-Broken Authentication and Session Management|Broken Authentication and Session Management →]] |