We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Hi,

    I have a site running on 2.2.2pl which recently had the Core Services hack - I have since removed the core services plugin and had a look for dodgy PHP files / users etc... I also changed all MODx admin passwords and FTP etc - thought had sorted the issue... but now have noticed that on 2 certain pages in the site - that in a table of data where I have some images - the img src elements have been hacked to include a load of spam / crap code... e.g.

    img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEAlgCWAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAAlgAAAAEAAQCWAAAAAQAB/+"
    


    This is a shortened example - its actually loads and loads of random characters...

    So.. question is... how is this happening? I can change the code back to the correct img src and all is fine for a few weeks - and then bang, it happens again...

    Any ideas where to search for the dodgy code performing this injection?

    Any ideas on a fix?

    I am going to be upgrading to a much more recent MODx build, but wanted to remove the malware before that upgrade.

    Cheers,

    dubbs.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Are you sure that is bad code? It is perfectly acceptable to use code like that to load images. http://stackoverflow.com/questions/1207190/embedding-base64-images
        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
        • 8168
        • 1,118 Posts
        Quote from: sottwell at Nov 24, 2015, 10:15 AM
        Are you sure that is bad code? It is perfectly acceptable to use code like that to load images. http://stackoverflow.com/questions/1207190/embedding-base64-images

        Its randomly injected code... whether or not its bad is another question... My concern is... how did it get there in the first place...? I have once removed it already - and now it is back... so being injected somehow...
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Then there is probably something in the template or the resources themselves. Perhaps some Javascript. Without seeing the page and being able to track where all of its elements come from it's hard to be any more specific.
            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
            • 8168
            • 1,118 Posts
            Quote from: sottwell at Nov 24, 2015, 10:54 AM
            Then there is probably something in the template or the resources themselves. Perhaps some Javascript. Without seeing the page and being able to track where all of its elements come from it's hard to be any more specific.

            Ok - so unlikely a malicious PHP file in the file system on the server then? currently reviewing the files on the server vs the original 2.2.2pl build files...
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              It could be, but considering that this appears to only affect certain pages makes it more likely that it's something specifically involved in generating those pages.
                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
                • 8168
                • 1,118 Posts
                Quote from: sottwell at Nov 24, 2015, 11:01 AM
                It could be, but considering that this appears to only affect certain pages makes it more likely that it's something specifically involved in generating those pages.

                OK thanks. Will keep searching...
                  • 8168
                  • 1,118 Posts
                  Susan - I found no extra files on the server other than within:

                  core/packages/modContext/
                  core/packages/xPDOFileVehicle/

                  Where there were a few extra files and folders... Are these legit?

                  Also found that the hacked code injection is also within the site CSS files... so not specific to the 2 pages I had previously identified...

                  Any thoughts anyone?

                    • 8168
                    • 1,118 Posts
                      • 8168
                      • 1,118 Posts
                      Just found another hack... When browsing files in the Resource brwoser/viewer when picking an image - all the thumbnails are missing and instead replaced with a "NO GD" image... Using Firebug the url for the image source it is pulling is:

                      src="/connectors/system/phpthumb.php?src=assets/images/exampleFolder/exampleImage.jpg&w=80&h=60&f=png&q=90&HTTP_MODAUTH=modx4fcf682084dca4.88984223_4565489d3816333.99955736&wctx=mgr&source=1"
                      


                      So, after the width and height vars - a load of random junk????

                      So looks like PHPThumb has been compromised also???