【发布时间】:2014-11-14 08:22:18
【问题描述】:
昨天在 Joomla VEL 中宣布了一个组件中的漏洞,为了不传播此信息,我不想在这里提及,我想修复它。
此漏洞同样适用于Joomla 1.5 版本的组件,但组件团队仅修复了Joomla 2.5 和3.x 版本中的漏洞。我将在这里发布在Joomla 2.5和Joomla 3中已经修改的功能,我想知道我是否可以以相同的方式或以不同的方式修改相同的功能以兼容Joomla 1.5版本.
在以下示例中,请考虑我将编辑代码以删除组件的名称。
所以,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}'");
此问题已通过以下方式修复:
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}'");
在 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}'");
此问题已通过以下方式修复:
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}'");
在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.'"');
这个问题还没有解决。
所以,在 Joomla 3 中,固定线是:
$option = ComponentDatabase::escape($option);
在 Joomla 2.5 中,固定行是:
$option = ComponentDatabase::getEscaped($option);
在 Joomla 1.5 中呢?如何正确转义选项参数并修复功能?
【问题讨论】:
-
您能自己看看
ComponentDatabase::getEscaped是否有空吗?或者 1.5 中的等价物是什么?我希望文档应该可用于旧版本。 -
我在 Joomla 1.5 文件中进行了正则表达式搜索,我看到
getEscaped在同一个组件中可用,但我不知道正确的语法,如果它与2.5版本与否。 -
例如,Joomla 1.5 版本中相同组件的另一个文件有
$result = self::$_dbo->getEscaped($text, $extra); -
因为我不知道该怎么做,我只是想自己修复这个漏洞但是...我没有很好的知识..所以...我正在尝试获取一些在 StackOverflow 中点亮这里!