1. SQL Injection
SQLi = SQL injection is a web security vulnerability. Hijack requests app makes to databases.
Modifying how APP sends SQL queries to database.
SQLi can be used to retrieve data from other tables and return it to the query sent by using UNION query.
SQLi can happen in the WHERE statement of the SELECT also, in the UPDATE, INSERT, SELECT, ORDER BY.
Types of SQLi order:
First order, when application takes user input from HTTP request and in process of that request, incorporates the input in an SQL query in an unsafe way.
Example: using login pages to see if app would query things differently using user inputs.
APP takes input and plugs it into SQL query single quotes. If input is user'-- then when placed in query, the input's quote will precede the default quote and the dashes will comment out the rest of the code.
Second order, when application takes user input from HTTP request and stores it for future use. Also known as Stored SQLi. The vulnerability occurs when it is pulled in the future to make SQL query in an unsafe way.
Database Differences
Difference in databases can affect string concatenation, comments, batched (or stacked) queries, platform specific APIs, and error messages.
SQLi Prevention:
Use parameterized queries instead of string concatenations within query.
Comments
Post a Comment