Joomla! Core SQL注入漏洞(CVE-2018-8045)

Joomla! Core SQL注入漏洞(CVE-2018-8045)

漏洞描述:

​ joomla!3.5.0-3.8.5版本对sql语句内的变量缺少类型转换,导致User Notes列表视图内SQL注入漏洞

影响版本:

​ joomla!3.5.0-3.8.5

漏j洞复现:

首先,安装joomla!如3.8.5

image-20201117171614458

然后,访问http://ip:port/YourJoomlaPath/administrator/index.php?option=com_users&view=notes,然后按下图顺序点击,并开启burpsuite拦截抓包

image-20201117171921141

抓包后可以发现,Bcategory_id的值处便是注入点

image-20201117172219381

尝试在7 后添加sql注入的paylaod,如and updatexml(1,concat(0x7e,(select version()),0x7e),3)等

image-20201117172501726

如上图可见,复现成功

漏洞分析:

这是未修复的版本漏洞点:

$categoryId = $this->getState('filter.category_id');

​    if ($categoryId && is_scalar($categoryId))
​    {
​        $query->where('a.catid = ' . $categoryId);
​    }

可以看到,$categoryId = $this->getState(‘filter.category_id’); 在获取category_id未进行过滤,导致了sql注入

再看一下修复后的相关代码:

image-20201117171238056

	// Filter by a single or group of categories.
	$categoryId = $this->getState('filter.category_id');
	// Filter by a single category.
	$categoryId = (int) $this->getState('filter.category_id');

	if ($categoryId && is_scalar($categoryId))
	if ($categoryId)
	{
		$query->where('a.catid = ' . $categoryId);
	}

可以看到,3.8.6版本中对notes.php中的 c a t e g o r y I d 的 值 进 行 了 限 制 , 强 制 转 换 类 型 为 i n t 型 , 所 以 categoryId的值进行了限制,强制转换类型为int型,所以 categoryIdintcategoryId是漏洞参数,可以进行sql注入

修复建议:

升级更新Joomla 以修复漏洞

漏洞相应拦截:

由于sql注入可以进行编码等方式绕过,所以需要注意绕过等,规则如下:

alert tcp any any -> any any (msg:"Joomla! Core SQL注入漏洞(CVE-2018-8045) Attempt"; flow:to_server,established; content:"|2f|administrator|2F|index|2E|php|3F|option|3D|com|5F|users|26|view|3D|notes"; pcre:"/category_id[\s\S]*\x3D[\s\S]*(([\s\S]*))|(%28[\s\S]*%29)/im"; reference:cve,2018-8045; classtype:web-application-attack; sid:20201104; rev:1;)
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值