搜索
查看: 8825|回复: 0

Joomla! 3.7 Core SQL Injection附POC(CVE-2017-8917)

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11882
发表于 2017-6-11 19:33:05 | 显示全部楼层 |阅读模式
During regular research audits for our [url=]Sucuri Firewall (WAF)[/url], we discovered a sql Injection vulnerability affecting Joomla! 3.7 – [url=]CVE-2017-8917[/url]. The vulnerability is easy to exploit and doesn’t require a privileged account on the victim’s site.
Are You at Risk?
The vulnerability is caused by a new component, com_fields, which was introduced in version 3.7. If you use this version, you are affected and should update as soon as possible. This vulnerable component is publicly accessible, which means this issue can be exploited by any malicious individual visiting your site.
Given the nature of SQL Injection attacks, there are many ways an attacker could cause harm – examples include leaking password hashes and hijacking a logged-in user’s session (the latter results in a full site compromise if an administrator session is stolen).
Technical Details
The public-facing com_fields component borrows some views from the administrative side component of the same name. While this may sound like an odd thing to do, it serves a very practical purpose – it allows the reuse of generic code that was written for the other side, instead of writing it from scratch again.
[url=] 0?wx_fmt=png.jpg [/url]
As you can see from the snippet above, it sets the $config[‘base_path’] variable with the JPATH_COMPONENT_ADMINISTRATOR constant value which represents the local path to the administrator component directory. Doing this will cause Joomla! to grab views and models from this path instead of the public facing one. As this action is conditional to the view parameter containing fields and layout to contain modal, we know the URL to access this view must look like this:
/index.php?option=com_fields&view=fields&layout=modal
Visiting this URL leads to a listing of all the custom fields available on the site which can be ordered based on various parameters.
The only administrator view that can be accessed is fields – and this will grab its data from an admin-side model (due to the $config[‘base_path’] trick we discussed earlier). In this case, the vulnerability we discovered was located in the FieldsModelFields model, in ./administrator/components/com_fields/models/fields.php.
The culprit can be found in the getListQuery method.
[url=] 0?wx_fmt=png.jpg [/url]
For those not familiar with how Joomla! deals with SQL queries, the $query->order() really is just a method whose input will be concatenated to a query’s ORDER BY statement, so you can guess that leaving non-sanitized user input in there is the last thing you want. Unfortunately, this is exactly what happened.

The list.fullordering state can be populated with user input because the FieldsModelFields model inherits from the JModelList class, which contains the snippet above. You may notice that it performs some verification on the content and then sets the list.direction and list.ordering state accordingly, but what about list.fullordering?
[url=] 0?wx_fmt=png.jpg [/url]
After the switch statement, this instruction sets the state we were looking for with a value that we can control, regardless of whether it generated a valid list.direction or list.ordering state.
So in order to exploit this vulnerability, all an attacker has to do is  add the proper parameters to the URL in order to inject nested SQL queries.
In Conclusion
If you have not already, update as soon as possible!
This is a serious vulnerability that can be misused in different ways to compromise a vulnerable site. Update now. If you believe your Joomla site is hacked, you can follow our [url=]free DIY cleanup guide[/url].


POC:
/index.php?option=com_fields&view=fields&layout=modal&list[fullordering]=updatexml(0x3a,concat(1,(select md5(1))),1)
0?wx_fmt=jpeg.jpg

过段时间可能会取消签到功能了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表