ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder

obfuscation question

Author Message
MisterPopularity



Joined: 25 May 2005
Posts: 29
Location: South Bend, Indiana

PostPosted: Thu Jan 19, 2006 1:18 pm    Post subject: obfuscation question Reply with quote

i'm trying to encode my entire vBulletin 3.5.3 installation with ALL three "obfuscation" parameters set and an obfuscation key defined. I'm getting the following error:

Warning: [obfuscated]() expects the argument (vb_error_handler) to be a valid callback in /path/to/init.go on line 0

Fatal error: Call to undefined function is_browser() in /path/to/global.go(0) : eval()'d code on line 18


keeping in mind that all of my php files are ".go" extensions. Has anyone else run into this?
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2788

PostPosted: Thu Jan 19, 2006 3:18 pm    Post subject: Reply with quote

Hi Chris

The issue here is most likely that you did not blacklist the error handler. In this simple example, below, the result is as follows:

Code:
nick@pod:/tmp > cat obfusc.php
<?php

function my_error()
{
}

set_error_handler('my_error');

?>

nick@pod:/tmp > ioncube_encoder_6.5 --obfuscate functions --obfuscation-key somekey obfusc.php -o obfusc-enc.php

nick@pod:/tmp > php obfusc-enc.php

Warning: [obfuscated]() expects the argument (my_error) to be a valid callback in /tmp/obfusc-enc.php on line 7


This is expected because set_error_handler() takes a function by name, and after obfuscation, the function my_error() now has a different name. So in this exceptional case, we need to blacklist the function to indicate that it should not be obfuscated. We do this by creating a blacklist file, and using it as follows:

Code:
nick@pod:/tmp > echo my_error > /tmp/blist

nick@pod:/tmp > ioncube_encoder_6.5 --obfuscate functions --obfuscation-key somekey obfusc.php -o obfusc-enc.php --obfuscation-ex blist

nick@pod:/tmp > php obfusc-enc.php
nick@pod:/tmp >


Note I used a shortened form of the --obfuscation-exclusions-file option to save typing at the command line. Having blacklisted the function, the function can now be found by set_error_handler() and the script behaves as expected.

Blacklisted functions are required in a case such as the above where the name of a function is passed to a builtin function, or for API functions that are to be called by external code. Dynamic name lookups to not need to be looked up though. So the following example works as it should, even when obfuscated:

Code:
nick@pod:/tmp > cat obfusc2-enc.php
<?php

function foo()
{
    echo "foo\n";
}

$n = 'foo';

$n();

?>

nick@pod:/tmp > ioncube_encoder_6.5 --obfuscate functions --obfuscation-key somekey  obfusc2.php -o obfusc2-enc.php

nick@pod:/tmp > php obfusc2-enc.php
foo

nick@pod:/tmp >


Finally, and also very noteworthy with obfuscation is that builtin functions are obfuscated as well, and that function calls are obfuscated. So in this case, the call to set_error_handler() is actually calling a function with a different name.
_________________
Community Admin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> ionCube PHP Encoder All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum