SQL Injection

SQL Injection

Knowledge Base>SQL Injection

Summary

SQLi refers to exploitation of improper SQL query construction, allowing unauthorized access to a database.

Testing methodology

LoginSessionRegisterUploadUser DataIDsSearchHeadersFor ',',`,#,/,; '||' etcsleep()waitfor delaypg_sleep(5)benchmark()Boolean Condition Based On Query Success ANDBoolean Condition Based On Query Success ORString ConcatenationPayload SuccessPayload SuccessPayload SuccessCheck Query ContextInjection Affects Other FieldsDeduce by SyntaxBased on Syntaxfits MSSQLfits MySQLfits Postgresfits Mongofits OracleXP_DIRTREELOAD_FILEINTO OUTFILEUTL_HTTP.REQUESTDBMS_LDAP.INITUTL_INADDR.get_host_addrUDF FunctionLOAD_FILELOAD_DATAINTO OUTFILESP_EXECUTE_EXTERNAL_SCRIPTUDF FunctionXP_CMDSHELLUDF FunctionExternal TablesdbmsschedulerJava Stored Procedure' || 1==1%00' && this.password%00($ne), ($gt)' or 1=1/*' or 1=1--' or 1=1#'or 1=1;-- -' or 1=1--' or 1=1--ORDER BY, UNIONmaster..sysserverssys.sql_loginsinformation_schema Enumerationall_tablesall_col_commentsDUALpg_shadowpg_userinformation_schema.tablesMultiple Techniques
Collected Entry Points
Identified Functionalities
Error
Time Delay
Response Anomaly
Potential Injection
Identified Query Syntax
Second Order Identified
Identified Database Type
MSSQL
MySQL
Postgres
Mongo
Oracle
Out of band
Bypass Authentication
RCE
Access Sensitive Information

Description

SQL Injection (SQLi) occurs when an application fails to properly sanitize user-supplied input before using it in an SQL query. Attackers can manipulate the input to modify or execute unintended SQL commands, potentially leading to unauthorized access to sensitive data, data manipulation, or even remote code execution.

Remediations

  • Implement parameterized queries or prepared statements to separate SQL code and user input.
  • Apply strict input validation and input filtering to block or sanitize user-supplied input.
  • Use least privilege principles, ensuring database accounts have limited permissions.

By using this site you agree to our Terms of Service and Privacy Policy.