How does PHP eval () count line numbers?

I am dealing with a deeply unpleasant piece of third-party code in the middle of installing Magento, and I am having small problems after it flows. Here is the error message that I see:

PHP parsing error: syntax error, unexpected ']' in /chroot/home/user/example.com/html/dev4/app/code/local/company/PluginName/Model/Module/License/Light/Performer/Reader.php (36): eval () 'd code (18): eval ()' d code (1302): eval () 'd code on line 1

I defined the beginning of the eval () chain in Reader.php, and it is on line 36. So these are the numbers in brackets after that, as well as the links to lines within large blocks of text? I tend to believe it, but I can't figure it out on my own. If this is the case, then eval()'d code(1302)it seems especially scary. D:

I would provide more context, but the status of the code license is not very clear, so all I can give is that this triple-eval () chain currently breaks things up and that its second layer is built like this:

$s = "$BLOCK_OF_SCRAMBLED_TEXT"
$s2 = '';
for ($i=0;($i+0xB-1)<strlen($s);$i+=11) {
    for ($k = 013-1 ; $k > -1 ; --$k) {
        $s2 .= $s[$i+$k];
    }
}
    eval($s2);

When you freeze this block outside the Magento program stream, it $s2contains wonderful things, for example -

if($license->getModule()->getDecode()) {
    $source = base64_decode($source);
}
...
list($source) = explode("PERFORMER_CLASS_CREATED",$source,2);
$source .=  " */";

ob_start();
eval($source);
ob_end_clean();

So: how can I track the chain eval()to a point in code that really causes problems?

+5
source share
1 answer

, , - . , , eval(), , - . , ( , ).

$s = "BLOCK_OF_SCRAMBLED_CODE";
$s2 = '';
// Decode scrambled PHP
for ($i=0;($i+0xB-1)<strlen($s);$i+=11) {
   for ($k = 013-1 ; $k > -1 ; --$k) {
      $s2 .= $s[$i+$k];
   }
}
// Don't evaluate, instead output it via your preferred method and copy/paste
// into a new file...
// eval($s2);
var_dump($s2);

, , , , .

+1

All Articles