sql_injection:example_attacks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sql_injection:example_attacks [2016/10/13 12:30] – peter | sql_injection:example_attacks [2020/04/16 20:52] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== SQL Injection - Example attacks ====== | ||
- | |||
- | [[SQL Injection - Example attacks: | ||
- | |||
- | [[SQL Injection - Example attacks: | ||
- | |||
- | [[SQL Injection - Example attacks:SQL Injection attack against PHP addslashes|SQL Injection attack against PHP addslashes]] | ||
- | |||
- | [[SQL Injection - Example attacks:SQL injection that gets around mysql_real_escape_string()|SQL injection that gets around mysql_real_escape_string()]] | ||
- | |||
- | |||
- | ===== Example attacks ===== | ||
- | |||
- | **Scenario #1**: The application uses untrusted data in the construction of the following vulnerable SQL call: | ||
- | |||
- | <code java> | ||
- | String query = " | ||
- | </ | ||
- | |||
- | **Scenario #2**: Similarly, an application’s blind trust in frameworks may result in queries that are still vulnerable, (e.g., Hibernate Query Language (HQL)): | ||
- | |||
- | <code sql> | ||
- | Query HQLQuery = session.createQuery(“FROM accounts WHERE custID=' | ||
- | </ | ||
- | |||
- | In both cases, the attacker modifies the ‘id’ parameter value in her browser to send: ' or ' | ||
- | |||
- | For example: | ||
- | |||
- | This changes the meaning of both queries to return all the records from the accounts table. | ||
- | |||
- | |||
- | ===== Other attacks ===== | ||
- | |||
- | Passing the following in as input. | ||
- | |||
- | <code php> | ||
- | -1 union all select table_name from information_schema.tables | ||
- | </ | ||
- | |||
- | and now just extract table structure: | ||
- | |||
- | <code sql> | ||
- | SELECT ... WHERE id = -1 union all select column_name from information_schema.column where table_name = 0x61727469636c65 | ||
- | </ | ||
- | |||
- | |||
- | ===== References ===== | ||
- | |||
- | * http:// | ||
- | |||
- | * http:// | ||
- | |||
sql_injection/example_attacks.1476361801.txt.gz · Last modified: 2020/07/15 09:30 (external edit)