04Injection Techniques
(MySQL) Using the UNION technique to steal data
Easy20MIN
UNION technique
Of different SQL injection techniques, UNION is usually the most effective when its use is possible. With it, you can usually retrieve any information from the database in one go. Unlike simply manipulating the WHERE clause, UNION technique is not limited to the data that the original query attempted to retrieve.
For example, here is a query that retrieves credit cards from the database.
SQL Playground
When the query is added with the UNION SELECT statement, the query can retrieve not only credit card information but also data from another table, in this case the user (users) table.
SQL Playground
1 / 6
Hakatemia Pro
Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.