简体   繁体   English

Joomla 1.5 / 2.5 / 3的MySQL注入漏洞

[英]MySQL injection vulnerability for Joomla 1.5/2.5/3

Yesterday in Joomla VEL has been announced a vulnerability in a component that I would rather not mention here in order not to spread this information, and that I would like to fix. 昨天,在Joomla VEL中已经宣布了一个组件中的漏洞,为了避免传播此信息,我不想在此提及,并且我想修复此漏洞。

This vulnerability applies also to Joomla 1.5 version of the component, but the component team only fixed the vulnerability in Joomla 2.5 and 3.x versions. 此漏洞也适用于组件的Joomla 1.5版本,但是组件团队仅修复了Joomla 2.5和3.x版本中的漏洞。 I am going to post here the function that has been modified in Joomla 2.5 and Joomla 3, and I would like to know if I can modify the same function in the same way or in a different way in order to be compatible with Joomla 1.5 version. 我将在此处发布在Joomla 2.5和Joomla 3中已修改的功能,并且我想知道是否可以以相同的方式或以不同的方式修改相同的功能以便与Joomla 1.5版本兼容。

In the following example, please consider that I will edit the code in order to remove the name of the component. 在下面的示例中,请考虑我将编辑代码以便删除组件的名称。

So, original function in Joomla 3 was: 因此,Joomla 3的原始功能是:

function _setExtension($option) {
    static $components = array();

    if (!isset($components[$option])) {
        $filter = ComponentUtility::getSkippedComponents();
        $component = ComponentDatabase::loadResult("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) AND `element` = '{$option}'");

This has been fixed in the following way: 此问题已通过以下方式解决:

function _setExtension($option) {
    static $components = array();

    if (!isset($components[$option])) {
        $filter = ComponentUtility::getSkippedComponents();
        $option = ComponentDatabase::escape($option);
        $component = ComponentDatabase::loadResult("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) AND `element` = '{$option}'");

In Joomla 2.5, the original function was: 在Joomla 2.5中,原始功能为:

function _setExtension($option) {
    static $components = array();

    if (!isset($components[$option])) {
        $filter = ComponentUtility::getSkippedComponents();
        $component = ComponentDatabase::loadResult("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) AND `element` = '{$option}'");

This has been fixed in the following way: 此问题已通过以下方式解决:

function _setExtension($option) {
    static $components = array();

    if (!isset($components[$option])) {
        $filter = ComponentUtility::getSkippedComponents();
        $option = ComponentDatabase::getEscaped($option);
        $component = ComponentDatabase::loadResult("SELECT `element` FROM `#__extensions` WHERE `type` = 'component' AND `element` NOT IN ({$filter}) AND `element` = '{$option}'");

In Joomla 1.5, the original function is: 在Joomla 1.5中,原始功能是:

function _setExtension($option) {
    static $components = array();

    if (!isset($components[$option])) {
        $filter = "'com_sef', 'com_sh404sef', 'com_joomfish', 'com_config', 'com_media', 'com_installer', 'com_templates', 'com_plugins', 'com_modules', 'com_cpanel', 'com_cache', 'com_messages', 'com_menus', 'com_massmail', 'com_languages', 'com_users'";
        $component = ComponentDatabase::loadResult('SELECT `option` FROM `#__components` WHERE `parent` = "0" AND `option` NOT IN ('.$filter.') AND `option` = "'.$option.'"');

And this has not been fixed. 并且此问题尚未解决。

So, in Joomla 3, the fixing line was: 因此,在Joomla 3中,固定线为:

            $option = ComponentDatabase::escape($option);

In Joomla 2.5 the fixing line was: 在Joomla 2.5中,固定线是:

        $option = ComponentDatabase::getEscaped($option);

And in Joomla 1.5? 在Joomla 1.5中? How can I properly escape the option parameter and fix the function? 如何正确地转义option参数并修复功能?

ComponentDatabase is not a class that belongs to Joomla by default, therefore it belongs to your component. ComponentDatabase在默认情况下不是属于Joomla的类,因此它属于您的组件。

getEscaped is however a function that belongs to Joomla 1.5 which simple gets an escaped string from the database. 但是getEscaped是Joomla 1.5的一个函数,它简单地从数据库中获取转义的字符串。

Assuming that ComponentDatabase also belongs to the Joomla 1.5 compatible version of this component, should should be able to do the same as the other fixes: 假设ComponentDatabase也属于该ComponentDatabase的Joomla 1.5兼容版本,则应该能够与其他修复程序相同:

$option = ComponentDatabase::getEscaped($option);

If ComponentDatabase does not belong to the Joomla 1.5 version of the component, then copy it over from the Joomla 2.5 version (not 3.x) and bare in mind that you might have to make some tweaks to it. 如果ComponentDatabase不属于该组件的Joomla 1.5版本,则将其从Joomla 2.5版本(不是3.x)复制过来,并记住您可能需要对其进行一些调整。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM