disk_manage.cgi hogging CPU usage

Questions about SNMP, Power, System, Logs, disk, & RAID.
JarnoVanDerLinden
Starting out
Posts: 10
Joined: Sat Nov 26, 2016 11:44 am

Re: disk_manage.cgi hogging CPU usage

Post by JarnoVanDerLinden »

I believe it's the exploit described by https://www.qnap.com/en/support/con_show.php?cid=109.
Hulli
Starting out
Posts: 49
Joined: Thu Mar 28, 2013 9:56 pm

Re: disk_manage.cgi hogging CPU usage

Post by Hulli »

wtsai wrote:Question for you. Do you find any file called "disk_manage.cgi" under /mnt/HDA_ROOT ?? Also, ssh to your server, perform a process list command "ps -ef", what do you find with disk_manage.cgi?

Hi I have exact this file there.
I have had a close look to the file and find some readable text in it that included some words like minerserver etc etc.
So yes I think this is the file which do the high processor usage.

I create a copy of this file to my PC and deletet the file on the NAS.
After NAS reboot processor usage was back to normal.

Do I have to check something addidtionaly??

brgds

Hulli


My config : TVS663 with QTS 4.3.3.0154
Hulli
Starting out
Posts: 49
Joined: Thu Mar 28, 2013 9:56 pm

Re: disk_manage.cgi hogging CPU usage

Post by Hulli »

Hi,
I think only deleting the file is not enough.
I saw that I have now 12 Zombie processes with disk_manage.cgi...
Any idea how to get rid of this??

brgds
Hulli
User avatar
dolbyman
Guru
Posts: 35276
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: disk_manage.cgi hogging CPU usage

Post by dolbyman »

backup your data (if not done already) and start your nas from scratch
Hulli
Starting out
Posts: 49
Joined: Thu Mar 28, 2013 9:56 pm

Re: disk_manage.cgi hogging CPU usage

Post by Hulli »

Hi,

Thats exactly what I want to avoid...
I am searching an alternative solution.
Maybe someone​ can explain where the NAS has the autostart options to clean it up.

Brgds Hulli
User avatar
dolbyman
Guru
Posts: 35276
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: disk_manage.cgi hogging CPU usage

Post by dolbyman »

viewtopic.php?f=25&t=131771#p609632

but you can never be sure if there is not other backdoors installed, a compromised system is better dealt with fire
JarnoVanDerLinden
Starting out
Posts: 10
Joined: Sat Nov 26, 2016 11:44 am

Re: disk_manage.cgi hogging CPU usage

Post by JarnoVanDerLinden »

When checking for disk_manage.cgi processes, make sure you look for the ones from /mnt/HDA_ROOT/, because there is a valid disk_manage.cgi used by the OS.

Also remove the crontab entry that periodically tries to launch the miner. You have to edit the /etc/config/crontab text file by deleting the line that looks like "*/3 * * * * /mnt/ext/opt/apache/bin/php /mnt/HDA_ROOT/rcu_shed"

From what I saw, this particular hack doesn't add anything to the autostart. It depends on crontab to launch it through php.
Hulli
Starting out
Posts: 49
Joined: Thu Mar 28, 2013 9:56 pm

Re: disk_manage.cgi hogging CPU usage

Post by Hulli »

JarnoVanDerLinden wrote:I'm having the same issue. Looks like the disk_manage.cgi got started within the last 24 hours.
There is no autorun.sh present.
I'm fairly sure the admin password was not guessed.
TS-251A, 4.2.2 Build 20161214
I think there is an exploit somewhere.

I also just noticed that along with the disk_manage.cgi come qwatchdogd, rcu_shed and rcu_shed.json files in HDA_ROOT.

Further digging, crontab has gained an entry:
*/3 * * * * /mnt/ext/opt/apache/bin/php /mnt/HDA_ROOT/rcu_shed
same issue here.
the disk_manage.cgi seems to be the miner.
The rcu and qwatchdogd seems to be either a Tor accesspoint or a Tor gateway..

I deleted everything from the NAS and also killed the CRON Job.
Now it seems to be much better from the performance view.

I have still some processor issues with Perl5 20.1 task which takes ca. 20 to 25% CPU utilisation.
Do I need this perl programming envoirement?
Before the update to the new OS 4.3.3 there was no Perl on my NAS I assume....


brgds

Hulli
Hulli
Starting out
Posts: 49
Joined: Thu Mar 28, 2013 9:56 pm

Re: disk_manage.cgi hogging CPU usage

Post by Hulli »

seems that everything is back to normal after reboot...
processor runs between 3 and 8% which is normal within my envoirement.

So cross fingers that the full miner backdoor was eliminated.


brgds
Hulli
User avatar
amigoccs
Starting out
Posts: 38
Joined: Sun Aug 11, 2013 5:21 pm
Contact:

Re: disk_manage.cgi hogging CPU usage

Post by amigoccs »

Hi,

This mining program sees spread in Taiwan from 2017/4/28 quickly and discuss in local community. I have collect related information and write a blog about this at Check And Solve If Your QNAP NAS Has been Injected a CPUMiner Program.

Here is a short version about my post. I didn't include the samples running linux commands on both NAS to save words. Because some reports the mining program is launched again after removal and firmware upgrade, I will update my post and follow up this issue.

1. What happen

A mining program is injected to using your NAS to work for mineXMR.com using your NAS to work for mineXMR.com.

According to the [Connection Details] section in [Get Started] tab on mineXMR.com, port 4444 is for Low end CPU. And also the [Mining Apps] section, this program should be CPUMiner (forked by LucasJones & Wolf) which is available on GitHub: OhGodAPet/cpuminer-multi. In the README.md file, it is x86-64 only.

2. How to Identify if CPUMiner is Running on my NAS

2.1 High CPU Utilization

You probably will see high CPU utilization (30% or higher) in [Control Panel] → [System Settings] → [System Status] → [Resource Monitor] → [CPU usage] tab when low network access.

But if your are using QTS 4.3.3, don't get fooled with the [Resource Monitor] gadget in [Dashboard] which may be launched by upper right corner. It's not always updated automatically.

2.2 Strange Running Process

Enable Allow SSH connection in [Control Panel] → [Network Services] → [Telnet/SSH] tab and login as admin and search for process disk_manage.cgi. If /mnt/HDA_ROOT/disk_manage.cgi is found, you probably get infected. Check schedule tasks in next section.

disk_manage.cgi is a standard QTS program but /mnt/HDA_ROOT/disk_manage.cgi isn’t. It’s a fake with the same name to fool you.

There are actually 3 suspicious processes running in the background:

a. /mnt/HDA_ROOT/disk_manage.cgi
b. /mnt/HDA_ROOT/qwatchdogd.cgi
c. /mnt/HDA_ROOT/rcu_shed.cgi


2.3 Strange Schedule Program

ssh login to QTS as admin and search for schedule task rcu_shed. If /mnt/HDA_ROOT/rcu_shed is found, you probably get infected.

3. Solution

3.1 Kill the Process

[~] # kill -KILL PID_OF_/mnt/HDA_ROOT/disk_manage.cgi
[~] # kill -KILL PID_OF_/mnt/HDA_ROOT/qwatchdogd.cgi
[~] # kill -KILL PID_OF_/mnt/HDA_ROOT/rcu_shed.cgi

3.2 Stop Auto-reload

To stop reload the mining program, remove "*/3 * * * * /mnt/ext/opt/apache/bin/php /mnt/HDA_ROOT/rcu_shed" in crontab configuration. Use vi to load /mnt/HDA_ROOT/.config/crontab, delete following line, and overwrite.

Some report crontab -e doesn't work which I cannot confirm and have no ideas why.

3.3 Get the Patch

Get all latest patch ASAP especially Security Vulnerabilities Addressed in QTS 4.2.3 Builds 20170121 and 20170124 and Security Vulnerabilities Addressed in QTS 4.2.4 Build 20170313.

3.4 Delete Mining Program and Related

Remember to delete disk_manage.cgi, rcu_shed, rcu_shed.json, and qwatchdogd in /mnt/HDA_ROOT/ at the end. There is no need to keep them.

3.5 Use QNAP Malware Remover

There is a [Malware Remover] in [App Center] in your QTS but not available on QNAP App Center page yet. The latest version 2.1.0 may remove this mining program and related files completely.

You may also download from here which is a direct link to QNAP. You need to unzip the download file and upload the QDK_2.2.14.qpkg in [App Center] in QTS.

[App Center] may be launch in [Main Menu] on upper left corner. [Malware Remover] can be found in [Utilities] category or just search for “malware”.

There is no interactive interface for this program. It just work in the background but you may read messages from it in [Control Panel] → [System Settings] → [System Logs]

Please read Check And Solve If Your QNAP NAS Has been Injected a CPUMiner Program to see samples of detect-and-remove and nothing-has-been-detectd.

Last words

It's not necessary to upgrade your firmware to 4.3.3 if yours is 4.2.x. Just apply the patch.

Please read Synology Security Issue and How-to Harden your NAS if you want to know how to secure your NAS.

Just my two cents.
Last edited by amigoccs on Thu May 04, 2017 11:53 pm, edited 3 times in total.
User avatar
Trexx
Ask me anything
Posts: 5388
Joined: Sat Oct 01, 2011 7:50 am
Location: Minnesota

Re: disk_manage.cgi hogging CPU usage

Post by Trexx »

Thanks for the great write-up.
Paul

Model: TS-877-1600 FW: 4.5.3.x
QTS (SSD): [RAID-1] 2 x 1TB WD Blue m.2's
Data (HDD): [RAID-5] 6 x 3TB HGST DeskStar
VMs (SSD): [RAID-1] 2 x1TB SK Hynix Gold
Ext. (HDD): TR-004 [Raid-5] 4 x 4TB HGST Ultastor
RAM: Kingston HyperX Fury 64GB DDR4-2666
UPS: CP AVR1350

Model:TVS-673 32GB & TS-228a Offline[/color]
-----------------------------------------------------------------------------------------------------------------------------------------
2018 Plex NAS Compatibility Guide | QNAP Plex FAQ | Moogle's QNAP Faq
User avatar
amigoccs
Starting out
Posts: 38
Joined: Sun Aug 11, 2013 5:21 pm
Contact:

Re: disk_manage.cgi hogging CPU usage

Post by amigoccs »

Hi all,

Because QNAP has release Malware Removal 2.1.0 r this issue, I have update my write-up. It's easier to use the app to remove manually.

I also write another post Detail Explain of QNAP Malware Remover 2.1.0 to explain what it contains. It is actually a shell script. There is no x86-64 specific programs. Therefore, you may install and run on any QNAP NAS without worry about x86-64/ARM model and firmware version.

Wish it helps!

Best regards,

Amigo
User avatar
amigoccs
Starting out
Posts: 38
Joined: Sun Aug 11, 2013 5:21 pm
Contact:

Re: disk_manage.cgi hogging CPU usage

Post by amigoccs »

Update: 2.1.1 is released within 15 hours after 2.1.0. It adds schedule scan at 3:00AM everyday.

Detail comparison of the two version please see "Update: 2.1.1 Add To Scan at 3:00AM Everyday" section in the post.

FYI, there is new firmware available for 5.3.3 users. QTS 4.3.3 Build 20170503 provides security patch for:

- This build includes security fixes for multiple PHP vulnerabilities. The version of PHP running on the remote web server has been updated to 5.6.30.
- This build includes security fixes for a password change vulnerability (CVE-2017-7629).
- This build includes security fixes for a command injection vulnerability (CVE-2017-7876).

But I am not sure if it may stops the CPUMiner issue recently, recommend for 4.3.x users. For those who want to stay with 4.2.x, maybe you should check Security Bulletins and Advisories instead.

Just my two cents.
netgear54
New here
Posts: 6
Joined: Wed Feb 04, 2015 4:49 am

Re: disk_manage.cgi hogging CPU usage

Post by netgear54 »

My system was also infected with this minning tool. Looks like the coolprit was the "mighty" PhotoStation (Firmware 4.2.4 Build20170313).
The hacker got access by executing a series of commands using the folowing urls (in the order they were requested):

> [QNAP_Daniel] - content has been removed for security reasons

Now i did install/run the qnap malware remover and it looks like it deleted the files and the cron job added by the above commands, so hope that the changes done by the hacker are removed. In any case lesson learned: QNAP IS A PRIVATE LAN PRODUCT NOT MEANT FOR INTERNET EXPOSURE
User avatar
OneCD
Guru
Posts: 12163
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: disk_manage.cgi hogging CPU usage

Post by OneCD »

Some good info there. :geek:

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Locked

Return to “System & Disk Volume Management”