5. Tuning SQLMap attacks

in most cases sqlmap automatically works pretty good

every sqli payload consists of:

sqlmap prefix/suffix specification

sometimes we may need to specify a prefix/suffix for sqli, not covered by typical sqlmap runs for such runs we use --prefix and --suffix

sqlmap -u "www.example.com/?q=test" --prefix="%'))" --suffix="-- -"

results in enclosure of all vector values between static prefix and suffix i.e. ; vulnerable code may look like:

$query = "SELECT id,name,surname FROM users WHERE id LIKE (('" . $_GET["q"] . "')) LIMIT 0,1";
$result = mysqli_query($link, $query);

vector UNION ALL SELECT 1,2,VERSION() bounded with prefix %')) and suffix -- - will result in the following valid SQL statement:

SELECT id,name,surname FROM users WHERE id LIKE (('test%')) UNION ALL SELECT 1,2,VERSION()-- -')) LIMIT 0,1

sqlmap level/risk

by default:

level and risk specify bigger sets of boundaries and vectors already incorporated in sqlmap

--level (1-5)

--risk (1-3)

you can test differences using different combinations of --level and --risk and check verbosity in stdout, looking at [PAYLOAD] prefixed output

default level value has a pretty small set of boundaries set

level=1, risk=1

regular users not advised to touch these options because it will make the whole detection process a lot slower however special cases of sqli vulns (like usage of OR payloads is a must, such as in case of login pages)

sqlmap advanced tuning, page responses

theres a whole lot more to do to tune your requests for sqli Status codes

Titles

Strings

text-only

Techniques

UNION sqli tuning