-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arbitrary PHP code execution in M2.0.2 #3233
Comments
i hope this is what this function was intended to do
There seems to be very similar arbitrary php execution bug in this file https://github.com/magento/magento2/blob/077584c99ebb8007cad176c3b9a0144a05c259cd/lib/internal/Magento/Framework/Data/Collection/Filesystem.php , but this one needs some products to be listed in the filesystem.. With the filtering the attacker should be able to run php script on server from remote host. /**
* The filters renderer and caller
* Applies to each row, renders once.
*
* @param array $row
* @return bool
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.EvalExpression)
*/
protected function _filterRow($row)
{
// render filters once
if (!$this->_isFiltersRendered) {
$eval = '';
for ($i = 0; $i < $this->_filterIncrement; $i++) {
if (isset($this->_filterBrackets[$i])) {
$eval .= $this->_renderConditionBeforeFilterElement(
$i,
$this->_filterBrackets[$i]['is_and']
) . $this->_filterBrackets[$i]['value'];
} else {
$f = '$this->_filters[' . $i . ']';
$eval .= $this->_renderConditionBeforeFilterElement(
$i,
$this->_filters[$i]['is_and']
) .
($this->_filters[$i]['is_inverted'] ? '!' : '') .
'$this->_invokeFilter(' .
"{$f}['callback'], array({$f}['field'], {$f}['value'], " .
'$row))';
}
}
$this->_filterEvalRendered = $eval;
$this->_isFiltersRendered = true;
}
$result = false;
if ($this->_filterEvalRendered) {
eval('$result = ' . $this->_filterEvalRendered . ';');
}
return $result;
} There does not seem to be any verification agains code execution on this variable: $this->_filterBrackets[$i]['value'] please do not use eval or similar functions, or read the PHP documentation:
|
Thank you for reporting this issue. We have created an internal ticket |
- Removed eval statement from phrase parser.
- No need to add slashes now that we do not do eval.
@scholtz this issue is fixed and merged to develop branch. Thank you for reporting this issue |
[thunder] MAGETWO-94844: Add the ability to install Magento without creating an administrator
I have looked over file Phrase.php and it seems it allows arbitrary php code execution!
Anyone can exploit it by setting the php into language csv file, and with the execution of command 'php bin/magento i18n:collect-phrases -o "lang.csv" -m .' it will execute.
I have modified a bit the Phrase.php to speed up testing:
Please do not use eval to evaluate the phrase :)
The text was updated successfully, but these errors were encountered: