QNAP NAS users, make sure you check your system
<!--kg-card-begin: markdown--><h3 id="background">Background</h3>
<p>On March 2, 2021, 360Netlab Threat Detection System started to report attacks targeting the widely used QNAP NAS devices via the unauthorized remote command execution vulnerability (CVE-2020-2506 &amp; CVE-2020-2507)<a href="https://www.qnap.com.cn/en/security-advisory/qsa-20-08">[1]</a>, upon successful attack, the attacker will gain root privilege on the device and perform malicious mining activities.</p>
<p>Due to the possible big impact, we contacted and informed the vendor on March 3, and decided to share some information with this quick blog.</p>
<p>Note 1, there is currently no public available PoC for CVE-2020-2506 &amp; CVE-2020-2507, also according to the vendor’s request, we are not disclosing the technical details of the vulnerability in order to protect QNAP NAS users, we speculate that there are still hundreds of thousands of online QNAP NAS devices with the vulnerability.</p>
<p>We named the mining program UnityMiner, we noticed the attacker customized the program by hiding the mining process and the real CPU memory resource usage information, so when the QNAP users check the system usage via the WEB management interface, they cannot see the abnormal system behavior.</p>
<p>Previously We have disclosed another QNAP NAS in-the-wild vulnerability attack here<a href="__GHOST_URL__/in-the-wild-qnap-nas-attacks/">[2]</a>.</p>
<h3 id="vulnerabilityimpact">Vulnerability impact</h3>
<p>Our 360 FirmwareTotal system shows that the following models are affected by the vulnerabilities. The QNAP NAS installed Helpdesk app prior to August 2020 is affected. The following is the list of known models that could be vulnerable.</p>
<pre><code>TVS-X73
TVS-X71U
TVS-X71
TVS-X63
TS-XA82
TS-XA73
TS-XA28A
TS-X89U
TS-X88
TS-X85U
TS-X85
TS-X83XU
TS-X82U
TS-X82S
TS-X82
TS-X80U
TS-X80
TS-X77U
TS-X77
TS-X73U
TS-X72U
TS-X72
TS-X63U
TS-X53U
TS-X53S
TS-X53D
TS-X53BU
TS-X53B
TS-X53A
TS-X53
TS-X51U
TS-X51DU
TS-X51B
TS-X51A
TS-X51
TS-X35A
TS-X28A
TS-KVM
TS-879U
TS-879
TS-870U
TS-870
TS-869U
TS-869
TS-859U
TS-859
TS-809U
TS-809
TS-670
TS-669
TS-659
TS-639
TS-569
TS-559
TS-509
TS-470
TS-469U
TS-469
TS-459U
TS-459
TS-439U
TS-439PROII
TS-439
TS-421U
TS-421
TS-420U
TS-420
TS-419U
TS-419P
TS-412U
TS-412
TS-410
TS-269
TS-259
TS-239PROII
TS-239H
TS-239
TS-221
TS-220
TS-219
TS-212
TS-210
TS-1679U
TS-1279U
TS-1270U
TS-1269U
TS-121
TS-120
TS-119
TS-112
TS-110
TS-1079
SS-839
SS-439
SS-2479U
SS-1879U
SS-1279U
QGD-1600
Mustang-200
IS-400
HS-251
HS-210
</code></pre>
<p>And the following is the Geo breakdown of the devices online by using the 360 Quake cyberspace mapping system, all togetherthere are 4,297,426 QNAP NAS, with 951,486 unique IPs.<br>
<a href="__GHOST_URL__/content/images/2021/03/qnap_distribution_en.png"><img src="__GHOST_URL__/content/images/2021/03/qnap_distribution_en.png" class="kg-image"/></a></p>
<h3 id="briefanalysisoftheminingkit">Brief analysis of the mining kit</h3>
<h4 id="1overview">1. Overview</h4>
<p>The mining program consists of <code>unity_install.sh</code> and <code>Quick.tar.gz</code>. <code>unity_install.sh</code> is used to download &amp; set up &amp; start the mining program and hijack the <code>manaRequest.cgi</code> program in the original device;</p>
<p><code>Quick.tar.gz</code> contains the miner program, the miner configuration file, the miner startup script and the forged <code>manaRequest.cgi</code>.</p>
<p>Unity is the XMRig miner program</p>
<pre><code>Quick
├── config.json
├── manaRequest.cgi
├── start.sh
└── unity
</code></pre>
<h4 id="2unity_installsh">2. unity_install.sh</h4>
<p><strong>Core functions</strong>：</p>
<ul>
<li>Check if unity process exists, kill if it exists</li>
<li>Check the CPU architecture of the device and download the mining kit for the corresponding architecture, currently it only supports ARM64 and AMD64</li>
<li>Set the mining parameters in <code>config.json</code> based on the number of CPU cores, the program makes sure it only uses half of the cores for mining.</li>
<li>Unpack the mining program, set cron and execute the mining script start.sh (once every minute, time interval is set directly to <code>* * * * * *</code>)</li>
</ul>
<h4 id="3startsh">3. start.sh</h4>
<p><strong>Core function</strong>：</p>
<ul>
<li>Checking for unity process and starting it if it does not exist.</li>
<li>Rename the system file <code>/home/httpd/cgi-bin/management/manaRequest.cgi</code> to <code>manaRequests.cgi</code> (this file is responsible for viewing and modifying the system information of the device)</li>
<li>Copy the <code>manaRequest.cgi</code> file from <code>Quick.tar.gz</code> to the <code>/home/httpd/cgi-bin/management/</code> directory, replacing the system's own file with the same name.</li>
</ul>
<h4 id="4configjson">4. config.json</h4>
<p>The group uses its own Pool(Proxy), so the real XMR Wallet cannot be seen. There are 3 groups of mining configurations, user are &quot;xmr2&quot;, pass are &quot;x&quot;, Pool(Proxy) are as follows.</p>
<pre><code>aquamangts.tk:12933
a.aquamangts.tk:12933
b.aquamangts.tk:12933
</code></pre>
<h4 id="5manarequestcgi">5. manaRequest.cgi</h4>
<p><strong>Core function</strong>：</p>
<ul>
<li>Hijack the system's original file of the same name, after receiving HTTP requests, first detect whether there is a unity mining process in the system, if not, then directly transfer the HTTP request to the system's original file of the same name (has been renamed to <code>manaRequests.cgi</code> ) to process, and then end the execution of.</li>
</ul>
<pre><code>count=`ps -fe | grep unity | grep -v &quot;grep&quot;`
if [ &quot;&quot; == &quot;$count&quot; ];then
    /home/httpd/cgi-bin/management/manaRequests.cgi
    exit 0
fi
</code></pre>
<ul>
<li>If the unity mining process exists on the system, after forwarding the HTTP request to the system's original file of the same name for execution, log the results of the execution (to the <code>.log.log</code> file) and then tamper with the execution results by
<ol>
<li>Subtract 50 from the CPU status data</li>
<li>Delete the unity process information from the execution result</li>
</ol>
</li>
</ul>
<p>So when the user suspects something going on with the device and checks the usage, he will see pretty normal CPU usage and tempc, and all the system processes will look normal.</p>
<h3 id="suggestions">Suggestions</h3>
<p>QNAP NAS users should check and update their firmware promptly.<br>
We recommend that readers monitor and block relevant IPs and URLs mentioned in this blog.</p>
<h3 id="contactus">Contact us</h3>
<p>Readers are always welcomed to reach us on <a href="https://twitter.com/360Netlab"><strong>twitter</strong></a>, or email to netlab at 360<br>
dot cn.</p>
<h3 id="ioc">IoC</h3>
<p>IP:</p>
<pre><code>210.201.136.170     	Taiwan              	ASN9311             	HITRON TECHNOLOGY INC.
</code></pre>
<p>Miner Proxy:</p>
<pre><code>aquamangts.tk:12933
a.aquamangts.tk:12933
b.aquamangts.tk:12933
</code></pre>
<p>URL:</p>
<pre><code>http://c.aquamangts.tk:8080/QFS/install/unity_install.sh
http://c.aquamangts.tk:8080/QFS/arm64/Quick.tar.gz
http://c.aquamangts.tk:8080/QFS/amd64/Quick.tar.gz
</code></pre>
<p>MD5:</p>
<pre><code>0f40086c9e96c9c11232a9175b26c644
1eb01a23a122d077540f83b005abdbfc
97015323b4fd840a40a9d40d2ad4e7af
</code></pre>
<!--kg-card-end: markdown-->
Background


On March 2, 2021, 360Netlab Threat Detection System started to report attacks targeting the widely used QNAP NAS devices via the unauthorized remote command execution vulnerability (CVE-2020-2506 & CVE-2020-2507)[1], upon successful attack, the attacker will gain root privilege on the device and perform malicious mining activities.


Due to the possible big impact, we contacted and informed the vendor on March 3, and decided to share some information with this quick blog.


Note 1, there is currently no public available PoC for CVE-2020-2506 & CVE-2020-2507, also according to the vendor’s request, we are not disclosing the technical details of the vulnerability in order to protect QNAP NAS users, we speculate that there are still hundreds of thousands of online QNAP NAS devices with the vulnerability.


We named the mining program UnityMiner, we noticed the attacker customized the program by hiding the mining process and the real CPU memory resource usage information, so when the QNAP users check the system usage via the WEB management interface, they cannot see the abnormal system behavior.


Previously We have disclosed another QNAP NAS in-the-wild vulnerability attack here[2].



Vulnerability impact


Our 360 FirmwareTotal system shows that the following models are affected by the vulnerabilities. The QNAP NAS installed Helpdesk app prior to August 2020 is affected. The following is the list of known models that could be vulnerable.


TVS-X73
TVS-X71U
TVS-X71
TVS-X63
TS-XA82
TS-XA73
TS-XA28A
TS-X89U
TS-X88
TS-X85U
TS-X85
TS-X83XU
TS-X82U
TS-X82S
TS-X82
TS-X80U
TS-X80
TS-X77U
TS-X77
TS-X73U
TS-X72U
TS-X72
TS-X63U
TS-X53U
TS-X53S
TS-X53D
TS-X53BU
TS-X53B
TS-X53A
TS-X53
TS-X51U
TS-X51DU
TS-X51B
TS-X51A
TS-X51
TS-X35A
TS-X28A
TS-KVM
TS-879U
TS-879
TS-870U
TS-870
TS-869U
TS-869
TS-859U
TS-859
TS-809U
TS-809
TS-670
TS-669
TS-659
TS-639
TS-569
TS-559
TS-509
TS-470
TS-469U
TS-469
TS-459U
TS-459
TS-439U
TS-439PROII
TS-439
TS-421U
TS-421
TS-420U
TS-420
TS-419U
TS-419P
TS-412U
TS-412
TS-410
TS-269
TS-259
TS-239PROII
TS-239H
TS-239
TS-221
TS-220
TS-219
TS-212
TS-210
TS-1679U
TS-1279U
TS-1270U
TS-1269U
TS-121
TS-120
TS-119
TS-112
TS-110
TS-1079
SS-839
SS-439
SS-2479U
SS-1879U
SS-1279U
QGD-1600
Mustang-200
IS-400
HS-251
HS-210



And the following is the Geo breakdown of the devices online by using the 360 Quake cyberspace mapping system, all togetherthere are 4,297,426 QNAP NAS, with 951,486 unique IPs.





Brief analysis of the mining kit


1. Overview


The mining program consists of unity_install.sh and Quick.tar.gz. unity_install.sh is used to download & set up & start the mining program and hijack the manaRequest.cgi program in the original device;


Quick.tar.gz contains the miner program, the miner configuration file, the miner startup script and the forged manaRequest.cgi.


Unity is the XMRig miner program


Quick
├── config.json
├── manaRequest.cgi
├── start.sh
└── unity



2. unity_install.sh


Core functions：


 * Check if unity process exists, kill if it exists
 * Check the CPU architecture of the device and download the mining kit for the corresponding architecture, currently it only supports ARM64 and AMD64
 * Set the mining parameters in config.json based on the number of CPU cores, the program makes sure it only uses half of the cores for mining.
 * Unpack the mining program, set cron and execute the mining script start.sh (once every minute, time interval is set directly to * * * * * *)


3. start.sh


Core function：


 * Checking for unity process and starting it if it does not exist.
 * Rename the system file /home/httpd/cgi-bin/management/manaRequest.cgi to manaRequests.cgi (this file is responsible for viewing and modifying the system information of the device)
 * Copy the manaRequest.cgi file from Quick.tar.gz to the /home/httpd/cgi-bin/management/ directory, replacing the system's own file with the same name.


4. config.json


The group uses its own Pool(Proxy), so the real XMR Wallet cannot be seen. There are 3 groups of mining configurations, user are "xmr2", pass are "x", Pool(Proxy) are as follows.


aquamangts.tk:12933
a.aquamangts.tk:12933
b.aquamangts.tk:12933



5. manaRequest.cgi


Core function：


 * Hijack the system's original file of the same name, after receiving HTTP requests, first detect whether there is a unity mining process in the system, if not, then directly transfer the HTTP request to the system's original file of the same name (has been renamed to manaRequests.cgi ) to process, and then end the execution of.


count=`ps -fe | grep unity | grep -v "grep"`
if [ "" == "$count" ];then
    /home/httpd/cgi-bin/management/manaRequests.cgi
    exit 0
fi



 * If the unity mining process exists on the system, after forwarding the HTTP request to the system's original file of the same name for execution, log the results of the execution (to the .log.log file) and then tamper with the execution results by
   
   1. Subtract 50 from the CPU status data
   2. Delete the unity process information from the execution result
   


So when the user suspects something going on with the device and checks the usage, he will see pretty normal CPU usage and tempc, and all the system processes will look normal.



Suggestions


QNAP NAS users should check and update their firmware promptly.

We recommend that readers monitor and block relevant IPs and URLs mentioned in this blog.



Contact us


Readers are always welcomed to reach us on twitter, or email to netlab at 360

dot cn.



IoC


IP:


210.201.136.170     	Taiwan              	ASN9311             	HITRON TECHNOLOGY INC.



Miner Proxy:


aquamangts.tk:12933
a.aquamangts.tk:12933
b.aquamangts.tk:12933



URL:


http://c.aquamangts.tk:8080/QFS/install/unity_install.sh
http://c.aquamangts.tk:8080/QFS/arm64/Quick.tar.gz
http://c.aquamangts.tk:8080/QFS/amd64/Quick.tar.gz



MD5:


0f40086c9e96c9c11232a9175b26c644
1eb01a23a122d077540f83b005abdbfc
97015323b4fd840a40a9d40d2ad4e7af


{"version":"0.3.1","atoms":[],"cards":[["markdown",{"markdown":"### Background\nOn March 2, 2021, 360Netlab Threat Detection System started to report attacks targeting the widely used QNAP NAS devices via the unauthorized remote command execution vulnerability (CVE-2020-2506 & CVE-2020-2507)[[1]](https://www.qnap.com.cn/en/security-advisory/qsa-20-08), upon successful attack, the attacker will gain root privilege on the device and perform malicious mining activities.\n\nDue to the possible big impact, we contacted and informed the vendor on March 3, and decided to share some information with this quick blog.\n\nNote 1, there is currently no public available PoC for CVE-2020-2506 & CVE-2020-2507, also according to the vendor’s request, we are not disclosing the technical details of the vulnerability in order to protect QNAP NAS users, we speculate that there are still hundreds of thousands of online QNAP NAS devices with the vulnerability.\n\nWe named the mining program UnityMiner, we noticed the attacker customized the program by hiding the mining process and the real CPU memory resource usage information, so when the QNAP users check the system usage via the WEB management interface, they cannot see the abnormal system behavior.\n\nPreviously We have disclosed another QNAP NAS in-the-wild vulnerability attack here[[2]](__GHOST_URL__/in-the-wild-qnap-nas-attacks/).\n\n### Vulnerability impact\nOur 360 FirmwareTotal system shows that the following models are affected by the vulnerabilities. The QNAP NAS installed Helpdesk app prior to August 2020 is affected. The following is the list of known models that could be vulnerable.\n```\nTVS-X73\nTVS-X71U\nTVS-X71\nTVS-X63\nTS-XA82\nTS-XA73\nTS-XA28A\nTS-X89U\nTS-X88\nTS-X85U\nTS-X85\nTS-X83XU\nTS-X82U\nTS-X82S\nTS-X82\nTS-X80U\nTS-X80\nTS-X77U\nTS-X77\nTS-X73U\nTS-X72U\nTS-X72\nTS-X63U\nTS-X53U\nTS-X53S\nTS-X53D\nTS-X53BU\nTS-X53B\nTS-X53A\nTS-X53\nTS-X51U\nTS-X51DU\nTS-X51B\nTS-X51A\nTS-X51\nTS-X35A\nTS-X28A\nTS-KVM\nTS-879U\nTS-879\nTS-870U\nTS-870\nTS-869U\nTS-869\nTS-859U\nTS-859\nTS-809U\nTS-809\nTS-670\nTS-669\nTS-659\nTS-639\nTS-569\nTS-559\nTS-509\nTS-470\nTS-469U\nTS-469\nTS-459U\nTS-459\nTS-439U\nTS-439PROII\nTS-439\nTS-421U\nTS-421\nTS-420U\nTS-420\nTS-419U\nTS-419P\nTS-412U\nTS-412\nTS-410\nTS-269\nTS-259\nTS-239PROII\nTS-239H\nTS-239\nTS-221\nTS-220\nTS-219\nTS-212\nTS-210\nTS-1679U\nTS-1279U\nTS-1270U\nTS-1269U\nTS-121\nTS-120\nTS-119\nTS-112\nTS-110\nTS-1079\nSS-839\nSS-439\nSS-2479U\nSS-1879U\nSS-1279U\nQGD-1600\nMustang-200\nIS-400\nHS-251\nHS-210\n```\n\nAnd the following is the Geo breakdown of the devices online by using the 360 Quake cyberspace mapping system, all togetherthere are 4,297,426 QNAP NAS, with 951,486 unique IPs.\n<a href=\"__GHOST_URL__/content/images/2021/03/qnap_distribution_en.png\"><img src=\"__GHOST_URL__/content/images/2021/03/qnap_distribution_en.png\" class=\"kg-image\"/></a>\n\n### Brief analysis of the mining kit\n\n#### 1. Overview\nThe mining program consists of `unity_install.sh` and `Quick.tar.gz`. `unity_install.sh` is used to download & set up & start the mining program and hijack the `manaRequest.cgi` program in the original device; \n\n`Quick.tar.gz` contains the miner program, the miner configuration file, the miner startup script and the forged `manaRequest.cgi`.\n\nUnity is the XMRig miner program\n\n```\nQuick\n├── config.json\n├── manaRequest.cgi\n├── start.sh\n└── unity\n```\n\n\n#### 2. unity_install.sh\n\n**Core functions**：\n- Check if unity process exists, kill if it exists\n- Check the CPU architecture of the device and download the mining kit for the corresponding architecture, currently it only supports ARM64 and AMD64\n- Set the mining parameters in `config.json` based on the number of CPU cores, the program makes sure it only uses half of the cores for mining.\n- Unpack the mining program, set cron and execute the mining script start.sh (once every minute, time interval is set directly to `* * * * * *`)\n\n#### 3. start.sh\n\n**Core function**：\n- Checking for unity process and starting it if it does not exist.\n- Rename the system file `/home/httpd/cgi-bin/management/manaRequest.cgi` to `manaRequests.cgi` (this file is responsible for viewing and modifying the system information of the device)\n- Copy the `manaRequest.cgi` file from `Quick.tar.gz` to the `/home/httpd/cgi-bin/management/` directory, replacing the system's own file with the same name.\n\n#### 4. config.json\n\nThe group uses its own Pool(Proxy), so the real XMR Wallet cannot be seen. There are 3 groups of mining configurations, user are \"xmr2\", pass are \"x\", Pool(Proxy) are as follows.\n\n```\naquamangts.tk:12933\na.aquamangts.tk:12933\nb.aquamangts.tk:12933\n```\n\n#### 5. manaRequest.cgi\n\n**Core function**：\n- Hijack the system's original file of the same name, after receiving HTTP requests, first detect whether there is a unity mining process in the system, if not, then directly transfer the HTTP request to the system's original file of the same name (has been renamed to `manaRequests.cgi` ) to process, and then end the execution of.\n```\ncount=`ps -fe | grep unity | grep -v \"grep\"`\nif [ \"\" == \"$count\" ];then\n    /home/httpd/cgi-bin/management/manaRequests.cgi\n    exit 0\nfi\n```\n\n- If the unity mining process exists on the system, after forwarding the HTTP request to the system's original file of the same name for execution, log the results of the execution (to the `.log.log` file) and then tamper with the execution results by\n    1. Subtract 50 from the CPU status data\n    2. Delete the unity process information from the execution result\n\nSo when the user suspects something going on with the device and checks the usage, he will see pretty normal CPU usage and tempc, and all the system processes will look normal.\n\n### Suggestions\nQNAP NAS users should check and update their firmware promptly.\nWe recommend that readers monitor and block relevant IPs and URLs mentioned in this blog.\n\n### Contact us\nReaders are always welcomed to reach us on [**twitter**](https://twitter.com/360Netlab), or email to netlab at 360\ndot cn.\n\n\n### IoC\nIP:\n```\n210.201.136.170     \tTaiwan              \tASN9311             \tHITRON TECHNOLOGY INC.\n```\n\nMiner Proxy:\n```\naquamangts.tk:12933\na.aquamangts.tk:12933\nb.aquamangts.tk:12933\n```\n\nURL:\n```\nhttp://c.aquamangts.tk:8080/QFS/install/unity_install.sh\nhttp://c.aquamangts.tk:8080/QFS/arm64/Quick.tar.gz\nhttp://c.aquamangts.tk:8080/QFS/amd64/Quick.tar.gz\n```\n\nMD5:\n```\n0f40086c9e96c9c11232a9175b26c644\n1eb01a23a122d077540f83b005abdbfc\n97015323b4fd840a40a9d40d2ad4e7af\n```\n"}]],"markups":[],"sections":[[10,0],[1,"p",[]]],"ghostVersion":"3.0"}