Possible unauthorized access to my server

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.5
Webmin version 2.641
Usermin version 2.540
Virtualmin version 8.1.0 Professional
Theme version 26.41
Apache version 2.4.52
Package updates All installed packages are up to date
IRED

I have a puzzling problem which is interfering with one of my websites.
The server runs around 8 virtual servers but only one is affected. Every morning around 2 AM, it writes a new index.php file and then adds .htaccess to all my directories that prevented *.php from running. This effectively shut down my Joomla website.

This could be fixed by adding the correct index.php file back to my public_html directory and erasing all >7000 .htaccess files in the directory structure. The site then ran perfectly. But at 2 AM in the morning these files were added again.

I have noticed some *.php files which I have since changed their suffixes to .phpxx so they will not run. Hopefully this will fix this.

My Questions:

  1. I have blocked access to port 22 with a firewall, this has been this way since I setup the server. I assume under this circumstance, the only administrative access would be from Virtualmin. Is this correct?
  2. I have looked at the IP access log on virtualmin and only see IP addresses that I recognize and are from me. Can I assume that that is the only admin access to my server?
  3. Only one virtual server is affected, so does that mean that it is likely that only that virtual server has been hacked?
    4)Does renaming a .PHP file to another extension such as .Phpxx prevent it from executing in Apache?
  4. I then renamed several .php files that I did not know what it did.
  5. I changed the passwords for everything.

Does anyone know anything about this type of attack. Other things I can check. Are all my assumptions correct.

Thanks,
Michael

I had accidently sent message before writing it. Sorry. I have since edited the message with the questions. Thanks

sounds like maybe Joomla is outdated/vulnerable or one/many of the plugins could be?
not a Joomla user but I know it is important to keep wordpress updated and also the plugins

if it keeps doing the same thing, is there a persistent process on the server doing it?

  • what is in the contents of the .htaccess ?
  • .php to .phpx will stop them being executed unless the handler has been changed.
  • is there any more index files in your root (index.html, index.asp etc..)
  • check the cronjobs, has new one been added for 2am ?

I would back the site up and take it offline. I would then extract the website backup and scan the files with an antivirus software and ClamAV.

The guys on the forum can give you better guidance than me. :slight_smile:

Thanks.
The .htaccess file was
Order Allow, Deny
Deny from All

If only one site is affected, take it off line, back it up and restore an older backup. You want to check all the logs relevant to the site. Then make sure everything is updated. Joomla, plugins, etc..

Hackers are using AI so new exploits are happening all the time it seems. The good news is it doesn’t sound like you need to wipe the server, at least not yet. If they haven’t gained access to anything outside that server they haven’t ‘hacked the system’. Good luck.

Can I just add one thing, backup the hacked site first so you can examine it. It might help identifying the culprit.

@ID10T is right :smiley:

I use wordfence in wordpress, only equivalent I can find for joomla is

Maybe join a Joomla forum for advise.

Also check

Thank you for your help.
I have not resolved this problem yet. But now only replacing one file and not adding .htaccess files after removing many .php extensions.
I have no applications on the list.

My question still is–if Port 22 is blocked besides the virtualmin ports any other way to gain access to the computer to add malicious files.

Malicious software does not need to find a way in via ssh.
The vulnerabilities exposed from joomla/plugins is enough, and any other software that a vulnerability is found/discovered.

Leave the htaccess with deny all on so no external access is available.

Make sure that the index.php in root and the one in admin are renamed to something not index.php.

If all files are still renamed etc.. you can rule out joomla as it only has 2 entry points.

Scan for anonomous files that can be executed..

Check crons.

The virtual server could be compromised.

Someone has accessed your work station with a trojan would be another thought as your not seeing unusual IP’s and is messing with you. Make a note of the times you actually access the server and compare with logs. Just a thought, nasty one but there are some right scumbags out there.

Not a gamer are you?

David

What makes you think the attacker has administrative access? They’ve only touched one domain’s files. That means that have domain owner access. Probably through a bug in the web app running on that domain.

Not based on that alone. If your server has been compromised at an administrative level (the attacker has root), you cannot trust any logs to tell you the truth. An administrative user can let you see anything they want you to see.

Probably. It sounds like they’re sloppy, so seems likely they’re not exerting much effort. If they had root and the inclination, you wouldn’t get obvious clues something is wrong.

You’ll either need to figure out how they’re getting in, or you’ll need to restore from a backup of the app prior to the problem, and then update immediately to current and hopefully not exploitable code.

The 2AM thing seems likely to be a cronjob, but if they gained the ability to execute code as a domain owner user and edit files as that user, they probably planted dozens of calls in your app that will restore their access even if you find and delete one of them.

Good start.

Reboot your server just incase of a TSR.

Terminate stay resident.

I thought this was a mddos trick to get around ms-dos’s inability to multitask, and not even considered useful in a linux enviroment which could multi task. But to simulate a tsr you could use a multplexer such as tmux start your code in a tmux window and drop out of tmux and delete the code that you ran, this approach would not survive a reboot. This is the only way of doing that unless you write a service which will servive a reboot. TSR is so last century :skull_and_crossbones:

Rather than being negative all of the time and trying to show off, why don’t you help the OP. :smiley:

I was helping the op by mentioning the point that tsrs haven’t been a thing since ms-dos days, perhaps saving sometime on researching what a tsr was. Also if someone has got into the machine and set a multiplexer running that would be something to look for perhaps, as I have never used joomolia wouldn’t want to give bad advice or send the OP in the wrong direction, but if joomolia has plugins I would guess that to be the original wntry point

If it is a joomla that is/was not up-to-date then have look at this

Summary of vulnerability

CVE-2026-48907 is the result of a chained design failure in the JCE profile import workflow, combining missing authorization, insufficient file validation, and disabled upload safety controls. Together, these issues allow unauthenticated attackers to upload and execute arbitrary PHP code via the /tmp directory, leading to pre-auth RCE in default or weakly hardened Joomla deployments.

The vulnerability is fully addressed in JCE 2.9.99.5 and later, with additional hardening in 2.9.99.6.

Recommendations

  • Immediate upgrade to JCE >= 2.9.99.6.
  • Restrict web access to /tmp/ and prevent PHP execution in temporary directories at the web server level, to prevent any future similar flaw.
  • Enable WAF rules or request filtering for com_jce&task=profiles.import.

We had several sites hacked within days the vulnerability was found.

regards
Jan

I want to thank everyone for their responses to my question. All the responses were very helpful.

Indeed, I believe the cause of the hack was this JCE vulnerability. I have upgraded to the most recent version. In addition to adding hundreds of .php files to the tmp directory, it added about 100 JCE profiles interfering with the function of the editor.

I have added a .htaccess file to prevent files in the public_html/tmp directory from being executed. I assume that these files can be deleted. so I will delete them.

I have gone through and erased all .php files that are not necessary.

Hopefully this will correct this problem.

Thanks,

Michael

Glad i could be of some help.

This proves once again the necessity to always, and i mean daily, check for updates and always keep everything up-to-date.

Creators of script and add-ons/themes/etc… don’t release updates because they don’t want to walk the dog, they do that because there are genuine and serious security issues discovered.

Regards
Jan