Linux.Ngioweb分析报告
<!--kg-card-begin: markdown--><h3 id="">背景介绍</h3>
<p>2019年5月27号，360Netlab 未知威胁检测系统发现一个可疑的ELF文件，目前仅有一款杀毒引擎检测识别。通过详细分析，我们确定这是一款Proxy Botnet，并且是Win32.Ngioweb[<a href="https://research.checkpoint.com/ramnits-network-proxy-servers/">1]</a>恶意软件的Linux版本变种，我们将它命名为Linux.Ngioweb。它与Win32.Ngioweb共用了大量代码，不同的是它新增了DGA特性。我们注册了其中一个DGA C2域名(enutofish-pronadimoful-multihitision.org)，并对它进行Sinkhole处理以此来观察Bot连接情况。</p>
<p>此外，我们还观察到大量部署WordPress的Web服务器被植入Linux.Ngioweb 恶意软件。尽管Bot程序由Web容器对应的用户组运行并且权限很小但还是能够正常工作，并被充当Rotating Reverse Proxy[<a href="https://stormproxies.com/rotating_reverse_proxies.html">2]</a>节点。</p>
<p>目前，我们还没有看清楚Linux.Ngioweb攻击者的目的，但我们猜测他可能会监听代理网络流量。</p>
<h3 id="linuxngioweb">Linux.Ngioweb概览</h3>
<p>Linux.Ngioweb Bot样本的主要功能是在受害者的机器上实现Back-Connect Proxy[<a href="https://hide-ip-proxy.com/what-is-a-backconnect-proxy/">3]</a>。攻击者将多个Bot构建为一个Proxies Pool，并通过双层C2协议控制，然后提供Rotating Reverse Proxy Service。</p>
<p><a href="__GHOST_URL__/content/images/2019/06/Linux.Ngioweb-1.png"><img src="__GHOST_URL__/content/images/2019/06/Linux.Ngioweb-1.png" class="kg-image"/></a></p>
<h3 id="linuxngioweb">Linux.Ngioweb逆向分析</h3>
<h4 id="">样本信息</h4>
<ul>
<li>MD5: 827ecf99001fa66de513fe5281ce064d</li>
</ul>
<blockquote>
<p>ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), statically linked, stripped</p>
</blockquote>
<h4 id="">样本对抗技巧</h4>
<ul>
<li>
<p>使用小众的musl libc库<br>
<a href="__GHOST_URL__/content/images/2019/06/1.PNG"><img src="__GHOST_URL__/content/images/2019/06/1.PNG" class="kg-image"/></a></p>
</li>
<li>
<p>将所需函数预存在function table中<br>
<a href="__GHOST_URL__/content/images/2019/06/2.PNG"><img src="__GHOST_URL__/content/images/2019/06/2-3.PNG" class="kg-image"/></a></p>
</li>
<li>
<p>使用Stack Strings Obfuscation技术<br>
<a href="__GHOST_URL__/content/images/2019/06/3.PNG"><img src="__GHOST_URL__/content/images/2019/06/3-2.PNG" class="kg-image"/></a></p>
</li>
<li>
<p>动态生成CRC，AES加密算法所需常量表<br>
<a href="__GHOST_URL__/content/images/2019/06/crypt-1.png"><img src="__GHOST_URL__/content/images/2019/06/crypt-1.png" class="kg-image"/></a></p>
</li>
<li>
<p>使用双层C2协议，其中Stage-2 C2由Stage-1 C2的CONNECT指令确定</p>
</li>
<li>
<p>Stage-2 C2使用双层加密的通信协议</p>
</li>
</ul>
<h4 id="stage1c2">Stage-1 C2协议分析</h4>
<p>在此阶段样本的主要行为是和Stage-1 C2建立通信，根据C2返回的指令进行下一步的操作。</p>
<h6 id="">通信尝试</h6>
<ul>
<li>
<p>每隔60秒尝试和以下硬编码C2 IP建立通信<br>
169.239.128.166:443<br>
185.244.149.73:443</p>
</li>
<li>
<p>每隔73秒尝试和DGA (Domain Generation Algorithm) 生成的域名建立通信。当DGA域名数达到300时，Seed会重置，所以DGA域名总数只有300。<br>
<a href="__GHOST_URL__/content/images/2019/06/4.PNG"><img src="__GHOST_URL__/content/images/2019/06/4-1.PNG" class="kg-image"/></a></p>
</li>
</ul>
<h6 id="dga">DGA实现</h6>
<pre><code class="language-c">uint64_t GenSeed(uint32_t&amp; seed, uint32_t mod)
{
      uint32_t tmp = 0x41C64E6D * seed + 0x3039;
      seed = tmp;
      return tmp % mod;
}
string dga(uint32_t&amp; seed)
{
      char* HeadBuf[] = { &quot;un&quot;, &quot;under&quot;, &quot;re&quot;, &quot;in&quot;, &quot;im&quot;, &quot;il&quot;, &quot;ir&quot;, &quot;en&quot;, &quot;em&quot;,
                          &quot;over&quot;, &quot;mis&quot;, &quot;dis&quot;, &quot;pre&quot;, &quot;post&quot;, &quot;anti&quot;,&quot;inter&quot;,
                          &quot;sub&quot;, &quot;ultra&quot;, &quot;non&quot;, &quot;de&quot;,&quot;pro&quot;, &quot;trans&quot;, &quot;ex&quot;,
                          &quot;macro&quot;, &quot;micro&quot;, &quot;mini&quot;,&quot;mono&quot;, &quot;multi&quot;, &quot;semi&quot;, &quot;co&quot; };

      char* BodyBufA[] = {&quot;able&quot;,&quot;ant&quot;,&quot;ate&quot;,&quot;age&quot;,&quot;ance&quot;,&quot;ancy&quot;,&quot;an&quot;,&quot;ary&quot;,
                          &quot;al&quot;,&quot;en&quot;,&quot;ency&quot;,&quot;er&quot;,&quot;etn&quot;, &quot;ed&quot;, &quot;ese&quot;,&quot;ern&quot;,&quot;ize&quot;,
                          &quot;ify&quot;,&quot;ing&quot;,&quot;ish&quot;,&quot;ity&quot;,&quot;ion&quot;,&quot;ian&quot;,&quot;ism&quot;,&quot;ist&quot;,&quot;ic&quot;,&quot;ical&quot;,
                          &quot;ible&quot;,&quot;ive&quot;,&quot;ite&quot;,&quot;ish&quot;,&quot;ian&quot;,&quot;or&quot;,&quot;ous&quot;,&quot;ure&quot; };

      char* BodyBufB[] = {&quot;dom&quot;,&quot;hood&quot;,&quot;less&quot;,&quot;like&quot;,&quot;ly&quot;,&quot;fy&quot;,&quot;ful&quot;,&quot;ness&quot;,
                          &quot;ment&quot;,&quot;sion&quot;,&quot;ssion&quot;,&quot;ship&quot;,&quot;ty&quot;,&quot;th&quot;,&quot;tion&quot;,&quot;ward&quot; };

      char* TailBuf[] = { &quot;.net&quot;,&quot;.info&quot;,&quot;.com&quot;,&quot;.biz&quot;,&quot;.org&quot;,&quot;.name&quot; };

      string BlockBufA = &quot;aeiou&quot;;
      string BlockBufB = &quot;bcdfghklmnprstvxz&quot;;
      string domain;
      uint32_t dashloop = GenSeed(seed, 3) + 1;
      while (dashloop--)
      {
              domain += HeadBuf[GenSeed(seed, 0x1e)];
              int flag = 0;
              int i = 0;
              if (BlockBufA.find(domain.back()) == string::npos)
                      flag = 1;
              int fillcnt = GenSeed(seed, 0x3) + 4;
              while (fillcnt &gt; i)
              {

                      if (flag + i &amp; 1)
                              domain += BlockBufA[GenSeed(seed, 0x5)];
                      else
                              domain += BlockBufB[GenSeed(seed, 0x11)];
                      i++;
              }
              if (BlockBufA.find(domain.back()) == string::npos)
                      domain += BodyBufA[GenSeed(seed, 0x23)];
              else
                      domain += BodyBufB[GenSeed(seed, 0x10)];
              if (dashloop != 0)
                      domain += &quot;-&quot;;
      }
      return domain += TailBuf[GenSeed(seed, 0x6)];
}

</code></pre>
<h6 id="">通信协议</h6>
<p>此阶段通信是基于HTTP协议，并将参数内容进行了Base64编码。</p>
<h6 id="">数据包概览</h6>
<p><a href="__GHOST_URL__/content/images/2019/06/5.PNG"><img src="__GHOST_URL__/content/images/2019/06/5.PNG" class="kg-image"/></a></p>
<h6 id="">发包解析</h6>
<p>将参数内容通过Base64解码后可以看到以下信息</p>
<p><a href="__GHOST_URL__/content/images/2019/06/6.PNG"><img src="__GHOST_URL__/content/images/2019/06/6-1.PNG" class="kg-image"/></a></p>
<ul>
<li>
<p>id=machine-id[0:15]</p>
<p><a href="__GHOST_URL__/content/images/2019/06/7.PNG"><img src="__GHOST_URL__/content/images/2019/06/7.PNG" class="kg-image"/></a></p>
</li>
<li>
<p>v=x86_64，硬编码，架构</p>
</li>
<li>
<p>sv=5003，硬编码，版本号</p>
</li>
<li>
<p>&amp;qlohmzalwdepupwf,随机16字节数据，算法如下</p>
<p><a href="__GHOST_URL__/content/images/2019/06/8.PNG"><img src="__GHOST_URL__/content/images/2019/06/8.PNG" class="kg-image"/></a></p>
</li>
<li>
<p>User-Agent，硬编码</p>
<pre><code>Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
</code></pre>
</li>
</ul>
<h6 id="">收包解析</h6>
<p><a href="__GHOST_URL__/content/images/2019/06/a.PNG"><img src="__GHOST_URL__/content/images/2019/06/a.PNG" class="kg-image"/></a></p>
<p>支持的指令</p>
<ul>
<li>WAIT</li>
<li>CONNECT</li>
<li>DISCONNECT</li>
<li>CERT</li>
</ul>
<h4 id="stage2c2">Stage-2 C2协议分析</h4>
<p>在此阶段样本的主要行为是和Stage-2的C2建立通信，开启Back-Connect Proxy功能。</p>
<h6 id="">通信协议</h6>
<p>此阶段通信是经过双层加密组合合成，内层为XOR，外层为AES。</p>
<h6 id="">数据包概览</h6>
<p><a href="__GHOST_URL__/content/images/2019/06/b.PNG"><img src="__GHOST_URL__/content/images/2019/06/b.PNG" class="kg-image"/></a></p>
<h6 id="">加密算法</h6>
<p>XOR的Key由随机算法产生</p>
<p><a href="__GHOST_URL__/content/images/2019/06/d.PNG"><img src="__GHOST_URL__/content/images/2019/06/d.PNG" class="kg-image"/></a></p>
<p>算法为</p>
<p><a href="__GHOST_URL__/content/images/2019/06/c.PNG"><img src="__GHOST_URL__/content/images/2019/06/c.PNG" class="kg-image"/></a></p>
<p>AES使用ECB模式，无填充，Key为<strong>qwerasdfzxcqwerasdftyuirfdsdsdss</strong></p>
<h6 id="">数据包结构</h6>
<p>数据包由header和msg俩部分组成</p>
<p>header结构</p>
<pre><code class="language-c">#le-&gt;little endian
#be-&gt;big endian
struct header
{
	uint32_le xorkey;
	uint32_be msgcrc32;
	uint32_be len;
	uint16_be msgcode
	uint16_be magic
};
</code></pre>
<p>msg由chunk构成，样本支持的chunk如下</p>
<table>
<thead>
<tr>
<th>Chunk  Type</th>
<th>Chunk Length</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
<td>BYTE</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>WORD big endian</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
<td>DWORD big endian</td>
</tr>
<tr>
<td>4</td>
<td>8</td>
<td>QWORD big endian</td>
</tr>
<tr>
<td>5</td>
<td>N+4</td>
<td>Bytes array.The first 4 bytes of chunk are the big endian-encoded length (N) of the array</td>
</tr>
</tbody>
</table>
<p>一个msg可以有一个或多个chunk,不同的msg有不同的格式。</p>
<p>样本支持的msg类型分recv和send 两种</p>
<ul>
<li>
<p>recv<br>
<a href="__GHOST_URL__/content/images/2019/06/msgrecv.PNG"><img src="__GHOST_URL__/content/images/2019/06/msgrecv.PNG" class="kg-image"/></a></p>
</li>
<li>
<p>send<br>
<a href="__GHOST_URL__/content/images/2019/06/msgsend.PNG"><img src="__GHOST_URL__/content/images/2019/06/msgsend.PNG" class="kg-image"/></a></p>
</li>
</ul>
<p>汇总见下表</p>
<table>
<thead>
<tr>
<th>msgcode</th>
<th>Driection</th>
<th>Description</th>
<th>Fromat</th>
</tr>
</thead>
<tbody>
<tr>
<td>0x1010</td>
<td>recv</td>
<td>set channel id</td>
<td>3 chunks:(QWORD ConnId, Array IPAddr,WORD Port)</td>
</tr>
<tr>
<td>0x1011</td>
<td>recv</td>
<td>start proxy request</td>
<td>5 chunks:(QWORD RequestId, BYTE reason,BYTE AddrType,Array Addr, WORD port)</td>
</tr>
<tr>
<td>0x1012</td>
<td>recv</td>
<td>close connection</td>
<td>1 chunk:(QWORD ConnId)</td>
</tr>
<tr>
<td>0x10</td>
<td>send</td>
<td>check-in</td>
<td>1 chunk:(QWORD BotId)</td>
</tr>
<tr>
<td>0x11</td>
<td>send</td>
<td>set-channel ack</td>
<td>1 chunk:(DWORD VersionId)</td>
</tr>
<tr>
<td>0x14</td>
<td>send</td>
<td>tcp server started</td>
<td>5 chunks:(DWORD ConnectionId, QWORD RequestId, BYTE AddrType, Array Addr, WORD Port)</td>
</tr>
<tr>
<td>0x15</td>
<td>send</td>
<td>error</td>
<td>2 chunks:(DWORD RequestId,BYTE reason )</td>
</tr>
<tr>
<td>0x16</td>
<td>send</td>
<td>udp server started</td>
<td>5 chunks:(DWORD ConnectionId, QWORD RequestId, BYTE AddrType, Array Addr, WORD Port)</td>
</tr>
</tbody>
</table>
<h6 id="">发包解析样例</h6>
<ul>
<li>
<p>原始数据（数据包结构）</p>
<pre><code> packet[0:31]:
 6c 52 8c 08 3e 80 a9 3c 00 00 00 10 00 10 fa 51 
 04 dd b0 b4 9d 10 ec 42 c3 00 00 00 00 00 00 00
 header		---&gt;packet[0:15]
 	xorkey		---&gt;0x088c526c
 	msgcrc32	---&gt;0x3e80a93c
 	msglen		---&gt;0x00000010
 	msgcode		---&gt;0x0010,check-in 
 	magic		---&gt;0xfa51
 msg		---&gt;packet[16:31]
 	1st chunk
 		chunktype	---&gt;0x4
 		content		---&gt;0xddb0b49d10ec42c3
 
</code></pre>
</li>
<li>
<p>XOR加密后</p>
<pre><code>6c 52 8c 08 36 0c fb 50 08 8c 52 7c 08 9c a8 3d 
0c 51 e2 d8 95 9c be 2e cb 8c 52 6c 08 8c 52 6c
</code></pre>
</li>
<li>
<p>AES加密后</p>
<pre><code>c1 d3 78 71 2d f6 5b bb  16 ca ff 8b ef 69 bb 26
3b 01 f0 22 70 09 38 dc  e7 06 89 de 2b 55 eb 8e
</code></pre>
</li>
</ul>
<h6 id="">收包解析样例</h6>
<ul>
<li>
<p>原始数据</p>
<pre><code>c5 ad 4a bf 30 C2 3a 43 9b 6e 22 08 73 e0 b9 5d 
3c e6 b7 f0 74 76 53 43 3a 79 0e 82 80 1a c3 84 
ba a4 85 05 4a 63 b1 d6 d1 94 ad 53 be 7a 9a 88
</code></pre>
</li>
<li>
<p>AES解密后</p>
<pre><code>59 8b e5 6d 4a ee bf ef 6d e5 8b 79 7d f5 71 08
69 b8 81 aa 92 ed 65 fb 29 e0 8b 59 6d e1 51 47
19 e1 89 d8 29 e5 8b 59 6d e5 8b 59 6d e5 8b 59
</code></pre>
</li>
<li>
<p>XOR解密后（数据包结构）</p>
<pre><code>  packet[0:47]
    59 8b e5 6d 27 0b 34 b6 00 00 00 20 10 10 fa 51
    04 5d 0a f3 ff 08 ee a2 44 05 00 00 00 04 da 1e
    74 04 02 81 44 00 00 00 00 00 00 00 00 00 00 00

  header		---&gt;packet[0:15]
    xorkey		---&gt;0x6de58b59
    msgcrc32	---&gt;0x270b34b6
    msglen		---&gt;0x00000020
    msgcode		---&gt;0x1010,set channel id
    magic		---&gt;0xfa51

  msg			---&gt;packet[16:47]
    1st chunk
        chunktype	---&gt;0x04
        content		---&gt;0x5d0af3ff08eea244
    2nt chunk
        chunktype	---&gt;0x05
        content		---&gt;len:0x00000004 buf:0xda1e7404
    3rd chunk
        chunktype	---&gt;0x02
        content		---&gt;0x8144
</code></pre>
</li>
</ul>
<h3 id="stage2c2">Stage-2 C2关联分析</h3>
<p>我们通过访问Stage-1 C2 URL (<a href="http://185.244.149.73:443/min.js">http://185.244.149.73:443/min.js</a>) 共得到以下6个Stage-2 C2的地址。</p>
<pre><code>5.135.58.119
5.135.58.121
5.135.58.123
5.135.58.124
91.134.157.11
193.70.73.115
</code></pre>
<p>通过我们的图系统关联test.zip的MD5（9017804333c820e3b4249130fc989e00）得到了更多的URL并对他们进行指纹识别，确认了另外18个存活的Stage-2 C2。</p>
<pre><code>5.135.35.160
5.196.194.209
51.254.57.83
54.36.244.84
54.36.244.85
54.36.244.91
91.121.36.212
91.121.236.219
92.222.151.63
145.239.108.241
163.172.201.184
163.172.202.116
178.33.101.176
178.33.101.177
178.33.101.178
178.33.101.182
188.165.5.123
188.165.163.20
</code></pre>
<p>我们在free-socks.in网站上可以检索到Stage-2 C2 IP地址正在提供Socks5代理服务。</p>
<p><a href="__GHOST_URL__/content/images/2019/06/free-proxy.png"><img src="__GHOST_URL__/content/images/2019/06/free-proxy.png" class="kg-image"/></a></p>
<p>我们测试这些Socks5代理IP均正常工作，同时它们也通过Stage-1 C2协议访问了我们Sinkhole 的C2域名(enutofish-pronadimoful-multihitision.org)，所以可以说明他们都是Linux.Ngioweb Bot。</p>
<pre><code class="language-bash">root@localhost:~# curl --socks5 91.134.157.11:50880 ifconfig.me
31.170.123.49

root@localhost:~# curl --socks5 91.134.157.11:62012 ifconfig.me
208.113.197.88

root@localhost:~# curl --socks5 91.134.157.11:18278 ifconfig.me
45.58.190.100

root@localhost:~# curl --socks5 91.134.157.11:64380 ifconfig.me
72.29.64.29

root@localhost:~# curl --socks5 91.134.157.11:47067 ifconfig.me
54.38.101.17

root@localhost:~# curl --socks5 91.134.157.11:63862 ifconfig.me
88.99.212.97

root@localhost:~# curl --socks5 91.134.157.11:49475 ifconfig.me
23.91.65.240
</code></pre>
<h3 id="ip">被感染的IP信息</h3>
<p>通过Sinkhole C2域名(enutofish-pronadimoful-multihitision.org)，我们目前共观察到有2692个Bot IP。</p>
<p><a href="__GHOST_URL__/content/images/2019/06/bot.png"><img src="__GHOST_URL__/content/images/2019/06/bot.png" class="kg-image"/></a></p>
<p>以下是被感染的IP 国家/地区详细列表</p>
<pre><code>US 1306
BR 156
RU 152
DE 133
FR 102
SG 98
NL 80
GB 66
CA 66
IT 64
VN 42
AU 36
PL 31
TR 28
JP 26
IN 26
ZA 21
ID 19
ES 18
UA 15
</code></pre>
<p>通过对被感染IP指纹识别，我们观察到几乎所有Bot IP都是Web服务器，同时都部署了WordPress程序，但是我们还不能确定攻击者是如何入侵WordPress网站。</p>
<p>我们通过联系一些受感染者用户，并在他们的Web服务器上发现了多种类型的WebShell，这些WebShell都是高度混淆，但是混淆手法，加密方式以及编码特征相似。结合被感染IP访问Sinkhole时序特征，我们猜测攻击者会周期性地对受害者网站WebShell下发指令并运行Linux.Ngioweb程序。</p>
<h3 id="">处置建议</h3>
<p>Linux.Ngioweb攻击者可能会监听代理网络流量，我们建议读者不要使用Stage-2 C2 IP提供的Socks5代理服务。</p>
<p>我们建议WordPress用户备份网站文章数据库(删除wp.service.controller.*等后门用户)，重新安装最新版本WordPress程序，增强用户密码复杂度，增强WebShell检测能力，并禁止PHP命令执行相关函数；</p>
<p>相关安全和执法机构，可以邮件联系netlab[at]360.cn获取被感染的IP地址列表。</p>
<h4 id="">联系我们</h4>
<p>感兴趣的读者，可以在 <a href="https://twitter.com/360Netlab"><strong>twitter</strong></a> 或者在微信公众号 <strong>360Netlab</strong> 上联系我们。</p>
<h4 id="ioclist">IoC list</h4>
<p>样本MD5</p>
<pre><code>827ecf99001fa66de513fe5281ce064d
</code></pre>
<p>Stage-1 C2 (硬编码IP)</p>
<pre><code>169.239.128.166     	South Africa        	ASN 61138           	Zappie Host LLC
185.244.149.73      	Romania             	ASN 60117           	Host Sailor Ltd.
</code></pre>
<p>Stage-2 C2</p>
<pre><code>163.172.201.184     	France              	ASN 12876           	Online S.a.s.
163.172.202.116     	France              	ASN 12876           	Online S.a.s.
5.135.35.160        	France              	ASN 16276           	OVH SAS
5.135.58.119        	France              	ASN 16276           	OVH SAS
5.135.58.121        	France              	ASN 16276           	OVH SAS
5.135.58.123        	France              	ASN 16276           	OVH SAS
5.135.58.124        	France              	ASN 16276           	OVH SAS
5.196.194.209       	France              	ASN 16276           	OVH SAS
51.254.57.83        	France              	ASN 16276           	OVH SAS
54.36.244.84        	France              	ASN 16276           	OVH SAS
54.36.244.85        	France              	ASN 16276           	OVH SAS
54.36.244.91        	France              	ASN 16276           	OVH SAS
91.121.36.212       	France              	ASN 16276           	OVH SAS
91.121.236.219      	France              	ASN 16276           	OVH SAS
91.134.157.11       	France              	ASN 16276           	OVH SAS
92.222.151.63       	France              	ASN 16276           	OVH SAS
145.239.108.241     	Germany             	ASN 16276           	OVH SAS
178.33.101.176      	Ireland             	ASN 16276           	OVH SAS
178.33.101.177      	Ireland             	ASN 16276           	OVH SAS
178.33.101.178      	Ireland             	ASN 16276           	OVH SAS
178.33.101.182      	Ireland             	ASN 16276           	OVH SAS
188.165.5.123       	Ireland             	ASN 16276           	OVH SAS
188.165.163.20      	France              	ASN 16276           	OVH SAS
193.70.73.115       	France              	ASN 16276           	OVH SAS
</code></pre>
<p>Stage-1 C2 (DGA)</p>
<pre><code>enutofish-pronadimoful-multihitision.org
exaraxexese-macrobacaward-exafosuness.net
nonafudazage.name
demigelike.net
emuvufehood.net
subolukobese.biz
inogepicor-prorarurument.biz
overahudulize-unazibezize-overuzozerish.org
imunolance-postodinenetn-antifipuketn.net
antizerolant-monogevudom.info
transavecaful-transinenation-transikaduhern.com
subogonance.info
inoxodusor-misehupukism.info
devikoviward-semibazegily-copaxugage.name
eniguzeless-inecimanable.net
subilebesion-irogipate.biz
colozosion-antigobunaful.name
inudiduty-dezaviness.org
irelizaring-enipulical-monovuxehossion.info
ilenudavous-monoxoxapal-semimihupution.info
ultrapadupize.biz
covategal-dezakedify-enebugassion.name
transivesudom-macropimuship.org
rezolezation-transapupirify-seminecation.name
macrolutoxous-overefimety.name
coxumumage-dexolalite.name
cotexafical-postirutuvian-emimimous.biz
copubuloness-misumusal-disokozian.com
nonecuzuking-enekopofen-imakozity.info
dezohipal-ultrazebebive.name
cosazalike-antifoxirer-subudikic.biz
underotutilism-monoceraretion-underosociful.name
overugiror.net
emuzixucize.biz
disicevament-desizigasion-recadihuful.biz
decehoward-microhikodely-overokerezant.com
microlasokadom-ultralarumous.info
minixecision-iruzaxuhood.net
profusonuty.info
multifipakency-conovofy-prorakikate.com
antiseramoment.info
postavutetn-emedarevous.biz
inolugoty-inidiverible.com
prodipamament.biz
overogobity-imivocurify-disovizution.biz
decozaness-antihazation-overetalovical.net
nonesolafy.com
unihatosancy.name
interiragocern-micropuxotion-transogorion.org
seminamatity-enogibely.name
inosebovion.net
exofifure-postirexument.info
transirirenern-semizafunic-nonivubed.biz
enegizize-microtizobity.name
macrohuseded-multipazaseship.com
imefihured-macrohixuhood.org
microlulition-macrokiguxable.biz
multizesumefy-emebefion.biz
underebelassion-postizoziless.info
dezuvazen.name
decotusion-exexavihood-exevozebant.name
disuzepuly.info
inuviging-antizoluly.biz
multisotiren-ilazufist.org
predepussion.info
inidozadom.name
interikuhaful.info
cozuheming.biz
multiruxuth.org
monozogeced.org
mononoredom.info
postarubixage-monocinamety-overogefesal.com
prebekokian-misadepepive-transilogify.com
monohatodom-cohotiship.com
exebasusion.org
unahodoness-emevuzeward-emuzeduness.com
exemidexous-underiposapite-unegatature.name
interocugopist-misugexadic-ilobipegency.org
monokifomancy-misagefism-macrobepoth.com
antizekussion-minipusaral-copofuxoship.com
relutodom-comakitize.name
multikezusion.org
emopumical-enohecical.org
semitegopish.net
recepatission.info
inoluvary.com
seminitotuful.info
interanubing-emelulotal-transugotuzern.com
subefehity-iledutession.name
ultrapapiten.biz
transuvarusish-prozumoxety.info
transisigern.org
imirotiship-microhopulive-emotomeship.com
presefavution.info
enevifaking.org
misidogive-coxecovor-dexefoxan.name
overazadudom-deliromohood.com
emakanuward.com
emitohage-overasuhorure-antitipenoless.info
ultrasesebible.biz
multihadekite.name
iluvused-iravoxish.info
postobagoly-detovaward-unixohible.biz
underasusogen.com
imovaman-multimihivoship-imeduxian.biz
dedunuguhood.com
prevukition.info
underehugavish.org
misoxomelical-iluxubism.net
microcolacoful-postabitition.name
overurohely-overadolure-iruraluness.org
unurodable-dekipuhic-postuxufous.org
unitucihern-postadagen-imupuduth.org
imukokuship.org
prenubocetion-ultrahahohood.com
monofugition-underefogukic.org
irofetufy.com
irobigelike.org
presifament.biz
overetigution.info
enuvopan-imixesoward-irarupipary.biz
inorofizian.com
monopadecotion-multicecihood-imuzicasion.com
exofosehance-minimezazofy.org
monokacofudom-inuvinable.com
emisucosion-prohosexite-imorekusion.net
semiledoduly.info
multivapufy-promumuly-enonuben.net
subebodency.info
cofexasish-inodehed.net
unutexupify-conofubusion.com
misebonure-iluborize-rezericify.com
exunaxian.info
colanizity-postosecive-nonuresible.info
dedaliward-imipusen-inacaliver.com
refusovize.org
monokuvission-transodigical-semihehamussion.biz
transalavudom-multilavezuhood.net
exusizeward.net
unisimor.name
minipihagaship.com
recusigetion-transubeviful.info
multixizitufy-microtomuly-multixoleward.com
microxulodish-semibahoty.biz
macrokunith-proxobivive.net
preginaxodom.name
transimapeful-cotalision.com
prefinazuly.name
inucasazing-microhesunian-semidikokement.biz
disitirotion-transekarenate.org
unehihify-antimepavable-nonubovafy.net
misunotelike-nonugidant.info
enogosudom-macrogekabive.biz
postozokipetn-microdomobaly.biz
interunavission-ininibecist.org
microhinoler.org
prosihamish-noneguhaness.com
preberekous-microkagibant-imemahal.name
iletegifage.org
emikuraran.biz
overokigoty-ilecavish.net
nonikofucable-postelihuzism-rexecigism.net
imixifure.info
minirabupeness-nonitefuward.org
misasugegify-underazosuzish-exuvexezical.info
multipocihood-monomuhunible.org
nonohacutancy-postuxikitan-microseditoless.info
overasobament.info
overulurotion.biz
disepadely-disuzirovor.net
repetepian-irelucify.biz
enikobadom-postolixement.name
inunatogite-imoboraness.net
irimarefy.net
monohiloless-demodefy.com
previbetian-misunohigate.info
multivunuhance-inabiber.com
semicasinaty-ilibaholy.biz
transupovetn-monozeruduless.biz
debapesetn-underisaxufical-imukugamism.info
multibibetefy.com
exanonish.name
interanulish-imazekalike-unisukugate.info
inokevidage.org
monofipuly-underubihal.net
profobekify-subebobefy-exozufous.name
macrovetecuship-emebudemical-underaxakament.biz
demeficiward-retitisily-macromuvaward.org
monosumuly-ilenusuty-dedabaness.net
exapofaran-postulusadify.com
microhobament-postevofafity.com
rebezusaly-overidirity-ultrahiseness.org
unafacigage-transihicical-prebokity.info
interazution-irudegufy-antinefoly.biz
minizecidish-macrolafukish-depovased.biz
derirepous-cosideship-semibiseless.biz
overupazadity-irativorical.name
coseviness-nonikunant-macrorasihood.net
nonesocern-macrotocipity.info
interuzoputy.info
inicinic-misuluzan-ultrakuxuness.com
sububesebism-ultrabutath.com
misacireship.org
exuxuburan-miniravuhood-exosoxen.info
macrozigahood-monosulopancy.com
unegoping-detunusion-antimuruseful.biz
macrozixaward-semivanimoly-underekutoty.biz
ultratipuxian-inosilission-multiridith.net
microtonagament.info
cobemesion-redacocoful.name
disicogure-seminedasoly.biz
dekacify.net
emegamilike-imupogazance-ultrapanacesion.org
unocelibable-underelatucance.com
irodetolike-imisocatite-inecolafian.com
antikuzucen-irokarance-transitupikible.org
semiralety-macrorobinant-ultrapixutency.biz
transisomuless.name
ilebigument-macroripakesion.org
profebarable.org
nonixigefy-protisumiless.biz
corahicohood.com
pretuvution-disafatutical-irehopuvese.name
miniregath-anticesuty-postudagily.biz
coguvilaship-recakubodom.name
overipugoful-interizihing.org
imipadaness-iralikoward-semitolicoly.info
interupefity-semigiduly.info
macromosoriship.net
antigizepist.net
subuluhic-disomokate.net
irunucudor-macrogocudern-comoxizish.name
underedofobate.net
prolapuzern-progobutiful-dehifasion.org
irucasian-macrofevasion.net
unogoxeness-semixocapency.org
rehofocese.org
exebutian-interomifenism.org
subihefahood-subenopure-ultramoherihood.net
nonezogeward.com
exasavate-minidevilefy-subanevous.biz
enodenission-overucelancy-microvitasission.info
ultrafakitesion-misesuzahical-transanafetion.biz
interinipoly-minimorovor-debininess.com
prenedelission-interugefable-repekosossion.name
postifozible-irololuship.com
unozolasion.org
unobelaness-prepifavety.info
cofukosable.info
iloletible-imakeben.info
ultraronupity.name
minikisision-monobavunism-micronepavage.org
unufepaness-misedepugance.biz
inafolage.com
semifolofic-unaraxal.biz
enerivosism-imenufanist-macrovonahood.org
monobocution.info
cosuzuness-prepurizor-unasulal.name
inopivic-antimaporary-subavocobive.biz
covogidish-iletinassion.biz
defizalike-unodatage-inarabevous.com
unuvirisern-interusalosize-misucakiness.org
ireninenish-multicemath-prezucetussion.biz
interodekive.com
iramilahood-antirotuxary-misobegesion.name
multidafadite-postagoker.org
monobagehance.net
emixuvidite-ilofikency-subolubify.biz
postugihucency-emademify.name
cotefehood-imocakitency.biz
enikavely-inosifuty-postaviraly.info
transabusossion.biz
interitebure.net
unehumugage-ultraburosion.com
subutavahen-inuhabish.org
subifefer-devufoward-probelalance.org
emefimafible.biz
ilibefudom.biz
postemivaxage.net
monofudumossion.info
inuxazodom-macrodexaxahood.org
semibugegetn-monohifutuly.biz
macromohazaship-subonohion-disonixucing.com
emosacekant-cokebohood-nonetakive.biz
interozecifist-antipinukity-multifekemath.net
refedomous-antifaliless.name
ultraxekevohood-nonizerosion-exovigant.name
interarogous-unuculuhood.org
semipulimian.com
monocalacaless.biz
disevolikency-retipegation.biz
cosituxath-misuxunor.info
ultraporader-conapefy-prolobeziless.info
ilucasure.com
reletohite-misosulahood-antitedudom.info
minivucilous-inafafomism.net
monorifutaless-ilocamussion.name
inohufohese-imufilahood-antifidupite.com
emegemaxed-transigifuty-multitumolith.net
exotacible-denitokolike.com
</code></pre>
<!--kg-card-end: markdown-->
背景介绍


2019年5月27号，360Netlab 未知威胁检测系统发现一个可疑的ELF文件，目前仅有一款杀毒引擎检测识别。通过详细分析，我们确定这是一款Proxy Botnet，并且是Win32.Ngioweb[1]恶意软件的Linux版本变种，我们将它命名为Linux.Ngioweb。它与Win32.Ngioweb共用了大量代码，不同的是它新增了DGA特性。我们注册了其中一个DGA C2域名(enutofish-pronadimoful-multihitision.org)，并对它进行Sinkhole处理以此来观察Bot连接情况。


此外，我们还观察到大量部署WordPress的Web服务器被植入Linux.Ngioweb 恶意软件。尽管Bot程序由Web容器对应的用户组运行并且权限很小但还是能够正常工作，并被充当Rotating Reverse Proxy[2]节点。


目前，我们还没有看清楚Linux.Ngioweb攻击者的目的，但我们猜测他可能会监听代理网络流量。



Linux.Ngioweb概览


Linux.Ngioweb Bot样本的主要功能是在受害者的机器上实现Back-Connect Proxy[3]。攻击者将多个Bot构建为一个Proxies Pool，并通过双层C2协议控制，然后提供Rotating Reverse Proxy Service。






Linux.Ngioweb逆向分析


样本信息


 * MD5: 827ecf99001fa66de513fe5281ce064d





ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), statically linked, stripped



样本对抗技巧


 * 
   
   
   使用小众的musl libc库
   
   
   

 * 
   
   
   将所需函数预存在function table中
   
   
   

 * 
   
   
   使用Stack Strings Obfuscation技术
   
   
   

 * 
   
   
   动态生成CRC，AES加密算法所需常量表
   
   
   

 * 
   
   
   使用双层C2协议，其中Stage-2 C2由Stage-1 C2的CONNECT指令确定
   

 * 
   
   
   Stage-2 C2使用双层加密的通信协议
   


Stage-1 C2协议分析


在此阶段样本的主要行为是和Stage-1 C2建立通信，根据C2返回的指令进行下一步的操作。


通信尝试


 * 
   
   
   每隔60秒尝试和以下硬编码C2 IP建立通信
   
   169.239.128.166:443
   
   185.244.149.73:443
   

 * 
   
   
   每隔73秒尝试和DGA (Domain Generation Algorithm) 生成的域名建立通信。当DGA域名数达到300时，Seed会重置，所以DGA域名总数只有300。
   
   
   


DGA实现


uint64_t GenSeed(uint32_t& seed, uint32_t mod)
{
      uint32_t tmp = 0x41C64E6D * seed + 0x3039;
      seed = tmp;
      return tmp % mod;
}
string dga(uint32_t& seed)
{
      char* HeadBuf[] = { "un", "under", "re", "in", "im", "il", "ir", "en", "em",
                          "over", "mis", "dis", "pre", "post", "anti","inter",
                          "sub", "ultra", "non", "de","pro", "trans", "ex",
                          "macro", "micro", "mini","mono", "multi", "semi", "co" };

      char* BodyBufA[] = {"able","ant","ate","age","ance","ancy","an","ary",
                          "al","en","ency","er","etn", "ed", "ese","ern","ize",
                          "ify","ing","ish","ity","ion","ian","ism","ist","ic","ical",
                          "ible","ive","ite","ish","ian","or","ous","ure" };

      char* BodyBufB[] = {"dom","hood","less","like","ly","fy","ful","ness",
                          "ment","sion","ssion","ship","ty","th","tion","ward" };

      char* TailBuf[] = { ".net",".info",".com",".biz",".org",".name" };

      string BlockBufA = "aeiou";
      string BlockBufB = "bcdfghklmnprstvxz";
      string domain;
      uint32_t dashloop = GenSeed(seed, 3) + 1;
      while (dashloop--)
      {
              domain += HeadBuf[GenSeed(seed, 0x1e)];
              int flag = 0;
              int i = 0;
              if (BlockBufA.find(domain.back()) == string::npos)
                      flag = 1;
              int fillcnt = GenSeed(seed, 0x3) + 4;
              while (fillcnt > i)
              {

                      if (flag + i & 1)
                              domain += BlockBufA[GenSeed(seed, 0x5)];
                      else
                              domain += BlockBufB[GenSeed(seed, 0x11)];
                      i++;
              }
              if (BlockBufA.find(domain.back()) == string::npos)
                      domain += BodyBufA[GenSeed(seed, 0x23)];
              else
                      domain += BodyBufB[GenSeed(seed, 0x10)];
              if (dashloop != 0)
                      domain += "-";
      }
      return domain += TailBuf[GenSeed(seed, 0x6)];
}




通信协议


此阶段通信是基于HTTP协议，并将参数内容进行了Base64编码。


数据包概览





发包解析


将参数内容通过Base64解码后可以看到以下信息





 * 
   
   
   id=machine-id[0:15]
   
   
   
   

 * 
   
   
   v=x86_64，硬编码，架构
   

 * 
   
   
   sv=5003，硬编码，版本号
   

 * 
   
   
   &qlohmzalwdepupwf,随机16字节数据，算法如下
   
   
   
   

 * 
   
   
   User-Agent，硬编码
   
   
   Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
   
   


收包解析





支持的指令


 * WAIT
 * CONNECT
 * DISCONNECT
 * CERT


Stage-2 C2协议分析


在此阶段样本的主要行为是和Stage-2的C2建立通信，开启Back-Connect Proxy功能。


通信协议


此阶段通信是经过双层加密组合合成，内层为XOR，外层为AES。


数据包概览





加密算法


XOR的Key由随机算法产生





算法为





AES使用ECB模式，无填充，Key为qwerasdfzxcqwerasdftyuirfdsdsdss


数据包结构


数据包由header和msg俩部分组成


header结构


#le->little endian
#be->big endian
struct header
{
	uint32_le xorkey;
	uint32_be msgcrc32;
	uint32_be len;
	uint16_be msgcode
	uint16_be magic
};



msg由chunk构成，样本支持的chunk如下





Chunk Type
Chunk Length
Description




1
1
BYTE


2
2
WORD big endian


3
4
DWORD big endian


4
8
QWORD big endian


5
N+4
Bytes array.The first 4 bytes of chunk are the big endian-encoded length (N) of the array





一个msg可以有一个或多个chunk,不同的msg有不同的格式。


样本支持的msg类型分recv和send 两种


 * 
   
   
   recv
   
   
   

 * 
   
   
   send
   
   
   


汇总见下表





msgcode
Driection
Description
Fromat




0x1010
recv
set channel id
3 chunks:(QWORD ConnId, Array IPAddr,WORD Port)


0x1011
recv
start proxy request
5 chunks:(QWORD RequestId, BYTE reason,BYTE AddrType,Array Addr, WORD port)


0x1012
recv
close connection
1 chunk:(QWORD ConnId)


0x10
send
check-in
1 chunk:(QWORD BotId)


0x11
send
set-channel ack
1 chunk:(DWORD VersionId)


0x14
send
tcp server started
5 chunks:(DWORD ConnectionId, QWORD RequestId, BYTE AddrType, Array Addr, WORD Port)


0x15
send
error
2 chunks:(DWORD RequestId,BYTE reason )


0x16
send
udp server started
5 chunks:(DWORD ConnectionId, QWORD RequestId, BYTE AddrType, Array Addr, WORD Port)





发包解析样例


 * 
   
   
   原始数据（数据包结构）
   
   
    packet[0:31]:
    6c 52 8c 08 3e 80 a9 3c 00 00 00 10 00 10 fa 51 
    04 dd b0 b4 9d 10 ec 42 c3 00 00 00 00 00 00 00
    header		--->packet[0:15]
    	xorkey		--->0x088c526c
    	msgcrc32	--->0x3e80a93c
    	msglen		--->0x00000010
    	msgcode		--->0x0010,check-in 
    	magic		--->0xfa51
    msg		--->packet[16:31]
    	1st chunk
    		chunktype	--->0x4
    		content		--->0xddb0b49d10ec42c3
    
   
   

 * 
   
   
   XOR加密后
   
   
   6c 52 8c 08 36 0c fb 50 08 8c 52 7c 08 9c a8 3d 
   0c 51 e2 d8 95 9c be 2e cb 8c 52 6c 08 8c 52 6c
   
   

 * 
   
   
   AES加密后
   
   
   c1 d3 78 71 2d f6 5b bb  16 ca ff 8b ef 69 bb 26
   3b 01 f0 22 70 09 38 dc  e7 06 89 de 2b 55 eb 8e
   
   


收包解析样例


 * 
   
   
   原始数据
   
   
   c5 ad 4a bf 30 C2 3a 43 9b 6e 22 08 73 e0 b9 5d 
   3c e6 b7 f0 74 76 53 43 3a 79 0e 82 80 1a c3 84 
   ba a4 85 05 4a 63 b1 d6 d1 94 ad 53 be 7a 9a 88
   
   

 * 
   
   
   AES解密后
   
   
   59 8b e5 6d 4a ee bf ef 6d e5 8b 79 7d f5 71 08
   69 b8 81 aa 92 ed 65 fb 29 e0 8b 59 6d e1 51 47
   19 e1 89 d8 29 e5 8b 59 6d e5 8b 59 6d e5 8b 59
   
   

 * 
   
   
   XOR解密后（数据包结构）
   
   
     packet[0:47]
       59 8b e5 6d 27 0b 34 b6 00 00 00 20 10 10 fa 51
       04 5d 0a f3 ff 08 ee a2 44 05 00 00 00 04 da 1e
       74 04 02 81 44 00 00 00 00 00 00 00 00 00 00 00
   
     header		--->packet[0:15]
       xorkey		--->0x6de58b59
       msgcrc32	--->0x270b34b6
       msglen		--->0x00000020
       msgcode		--->0x1010,set channel id
       magic		--->0xfa51
   
     msg			--->packet[16:47]
       1st chunk
           chunktype	--->0x04
           content		--->0x5d0af3ff08eea244
       2nt chunk
           chunktype	--->0x05
           content		--->len:0x00000004 buf:0xda1e7404
       3rd chunk
           chunktype	--->0x02
           content		--->0x8144
   
   



Stage-2 C2关联分析


我们通过访问Stage-1 C2 URL (http://185.244.149.73:443/min.js) 共得到以下6个Stage-2 C2的地址。


5.135.58.119
5.135.58.121
5.135.58.123
5.135.58.124
91.134.157.11
193.70.73.115



通过我们的图系统关联test.zip的MD5（9017804333c820e3b4249130fc989e00）得到了更多的URL并对他们进行指纹识别，确认了另外18个存活的Stage-2 C2。


5.135.35.160
5.196.194.209
51.254.57.83
54.36.244.84
54.36.244.85
54.36.244.91
91.121.36.212
91.121.236.219
92.222.151.63
145.239.108.241
163.172.201.184
163.172.202.116
178.33.101.176
178.33.101.177
178.33.101.178
178.33.101.182
188.165.5.123
188.165.163.20



我们在free-socks.in网站上可以检索到Stage-2 C2 IP地址正在提供Socks5代理服务。





我们测试这些Socks5代理IP均正常工作，同时它们也通过Stage-1 C2协议访问了我们Sinkhole 的C2域名(enutofish-pronadimoful-multihitision.org)，所以可以说明他们都是Linux.Ngioweb Bot。


root@localhost:~# curl --socks5 91.134.157.11:50880 ifconfig.me
31.170.123.49

root@localhost:~# curl --socks5 91.134.157.11:62012 ifconfig.me
208.113.197.88

root@localhost:~# curl --socks5 91.134.157.11:18278 ifconfig.me
45.58.190.100

root@localhost:~# curl --socks5 91.134.157.11:64380 ifconfig.me
72.29.64.29

root@localhost:~# curl --socks5 91.134.157.11:47067 ifconfig.me
54.38.101.17

root@localhost:~# curl --socks5 91.134.157.11:63862 ifconfig.me
88.99.212.97

root@localhost:~# curl --socks5 91.134.157.11:49475 ifconfig.me
23.91.65.240




被感染的IP信息


通过Sinkhole C2域名(enutofish-pronadimoful-multihitision.org)，我们目前共观察到有2692个Bot IP。





以下是被感染的IP 国家/地区详细列表


US 1306
BR 156
RU 152
DE 133
FR 102
SG 98
NL 80
GB 66
CA 66
IT 64
VN 42
AU 36
PL 31
TR 28
JP 26
IN 26
ZA 21
ID 19
ES 18
UA 15



通过对被感染IP指纹识别，我们观察到几乎所有Bot IP都是Web服务器，同时都部署了WordPress程序，但是我们还不能确定攻击者是如何入侵WordPress网站。


我们通过联系一些受感染者用户，并在他们的Web服务器上发现了多种类型的WebShell，这些WebShell都是高度混淆，但是混淆手法，加密方式以及编码特征相似。结合被感染IP访问Sinkhole时序特征，我们猜测攻击者会周期性地对受害者网站WebShell下发指令并运行Linux.Ngioweb程序。



处置建议


Linux.Ngioweb攻击者可能会监听代理网络流量，我们建议读者不要使用Stage-2 C2 IP提供的Socks5代理服务。


我们建议WordPress用户备份网站文章数据库(删除wp.service.controller.*等后门用户)，重新安装最新版本WordPress程序，增强用户密码复杂度，增强WebShell检测能力，并禁止PHP命令执行相关函数；


相关安全和执法机构，可以邮件联系netlab[at]360.cn获取被感染的IP地址列表。


联系我们


感兴趣的读者，可以在 twitter 或者在微信公众号 360Netlab 上联系我们。


IoC list


样本MD5


827ecf99001fa66de513fe5281ce064d



Stage-1 C2 (硬编码IP)


169.239.128.166     	South Africa        	ASN 61138           	Zappie Host LLC
185.244.149.73      	Romania             	ASN 60117           	Host Sailor Ltd.



Stage-2 C2


163.172.201.184     	France              	ASN 12876           	Online S.a.s.
163.172.202.116     	France              	ASN 12876           	Online S.a.s.
5.135.35.160        	France              	ASN 16276           	OVH SAS
5.135.58.119        	France              	ASN 16276           	OVH SAS
5.135.58.121        	France              	ASN 16276           	OVH SAS
5.135.58.123        	France              	ASN 16276           	OVH SAS
5.135.58.124        	France              	ASN 16276           	OVH SAS
5.196.194.209       	France              	ASN 16276           	OVH SAS
51.254.57.83        	France              	ASN 16276           	OVH SAS
54.36.244.84        	France              	ASN 16276           	OVH SAS
54.36.244.85        	France              	ASN 16276           	OVH SAS
54.36.244.91        	France              	ASN 16276           	OVH SAS
91.121.36.212       	France              	ASN 16276           	OVH SAS
91.121.236.219      	France              	ASN 16276           	OVH SAS
91.134.157.11       	France              	ASN 16276           	OVH SAS
92.222.151.63       	France              	ASN 16276           	OVH SAS
145.239.108.241     	Germany             	ASN 16276           	OVH SAS
178.33.101.176      	Ireland             	ASN 16276           	OVH SAS
178.33.101.177      	Ireland             	ASN 16276           	OVH SAS
178.33.101.178      	Ireland             	ASN 16276           	OVH SAS
178.33.101.182      	Ireland             	ASN 16276           	OVH SAS
188.165.5.123       	Ireland             	ASN 16276           	OVH SAS
188.165.163.20      	France              	ASN 16276           	OVH SAS
193.70.73.115       	France              	ASN 16276           	OVH SAS



Stage-1 C2 (DGA)


enutofish-pronadimoful-multihitision.org
exaraxexese-macrobacaward-exafosuness.net
nonafudazage.name
demigelike.net
emuvufehood.net
subolukobese.biz
inogepicor-prorarurument.biz
overahudulize-unazibezize-overuzozerish.org
imunolance-postodinenetn-antifipuketn.net
antizerolant-monogevudom.info
transavecaful-transinenation-transikaduhern.com
subogonance.info
inoxodusor-misehupukism.info
devikoviward-semibazegily-copaxugage.name
eniguzeless-inecimanable.net
subilebesion-irogipate.biz
colozosion-antigobunaful.name
inudiduty-dezaviness.org
irelizaring-enipulical-monovuxehossion.info
ilenudavous-monoxoxapal-semimihupution.info
ultrapadupize.biz
covategal-dezakedify-enebugassion.name
transivesudom-macropimuship.org
rezolezation-transapupirify-seminecation.name
macrolutoxous-overefimety.name
coxumumage-dexolalite.name
cotexafical-postirutuvian-emimimous.biz
copubuloness-misumusal-disokozian.com
nonecuzuking-enekopofen-imakozity.info
dezohipal-ultrazebebive.name
cosazalike-antifoxirer-subudikic.biz
underotutilism-monoceraretion-underosociful.name
overugiror.net
emuzixucize.biz
disicevament-desizigasion-recadihuful.biz
decehoward-microhikodely-overokerezant.com
microlasokadom-ultralarumous.info
minixecision-iruzaxuhood.net
profusonuty.info
multifipakency-conovofy-prorakikate.com
antiseramoment.info
postavutetn-emedarevous.biz
inolugoty-inidiverible.com
prodipamament.biz
overogobity-imivocurify-disovizution.biz
decozaness-antihazation-overetalovical.net
nonesolafy.com
unihatosancy.name
interiragocern-micropuxotion-transogorion.org
seminamatity-enogibely.name
inosebovion.net
exofifure-postirexument.info
transirirenern-semizafunic-nonivubed.biz
enegizize-microtizobity.name
macrohuseded-multipazaseship.com
imefihured-macrohixuhood.org
microlulition-macrokiguxable.biz
multizesumefy-emebefion.biz
underebelassion-postizoziless.info
dezuvazen.name
decotusion-exexavihood-exevozebant.name
disuzepuly.info
inuviging-antizoluly.biz
multisotiren-ilazufist.org
predepussion.info
inidozadom.name
interikuhaful.info
cozuheming.biz
multiruxuth.org
monozogeced.org
mononoredom.info
postarubixage-monocinamety-overogefesal.com
prebekokian-misadepepive-transilogify.com
monohatodom-cohotiship.com
exebasusion.org
unahodoness-emevuzeward-emuzeduness.com
exemidexous-underiposapite-unegatature.name
interocugopist-misugexadic-ilobipegency.org
monokifomancy-misagefism-macrobepoth.com
antizekussion-minipusaral-copofuxoship.com
relutodom-comakitize.name
multikezusion.org
emopumical-enohecical.org
semitegopish.net
recepatission.info
inoluvary.com
seminitotuful.info
interanubing-emelulotal-transugotuzern.com
subefehity-iledutession.name
ultrapapiten.biz
transuvarusish-prozumoxety.info
transisigern.org
imirotiship-microhopulive-emotomeship.com
presefavution.info
enevifaking.org
misidogive-coxecovor-dexefoxan.name
overazadudom-deliromohood.com
emakanuward.com
emitohage-overasuhorure-antitipenoless.info
ultrasesebible.biz
multihadekite.name
iluvused-iravoxish.info
postobagoly-detovaward-unixohible.biz
underasusogen.com
imovaman-multimihivoship-imeduxian.biz
dedunuguhood.com
prevukition.info
underehugavish.org
misoxomelical-iluxubism.net
microcolacoful-postabitition.name
overurohely-overadolure-iruraluness.org
unurodable-dekipuhic-postuxufous.org
unitucihern-postadagen-imupuduth.org
imukokuship.org
prenubocetion-ultrahahohood.com
monofugition-underefogukic.org
irofetufy.com
irobigelike.org
presifament.biz
overetigution.info
enuvopan-imixesoward-irarupipary.biz
inorofizian.com
monopadecotion-multicecihood-imuzicasion.com
exofosehance-minimezazofy.org
monokacofudom-inuvinable.com
emisucosion-prohosexite-imorekusion.net
semiledoduly.info
multivapufy-promumuly-enonuben.net
subebodency.info
cofexasish-inodehed.net
unutexupify-conofubusion.com
misebonure-iluborize-rezericify.com
exunaxian.info
colanizity-postosecive-nonuresible.info
dedaliward-imipusen-inacaliver.com
refusovize.org
monokuvission-transodigical-semihehamussion.biz
transalavudom-multilavezuhood.net
exusizeward.net
unisimor.name
minipihagaship.com
recusigetion-transubeviful.info
multixizitufy-microtomuly-multixoleward.com
microxulodish-semibahoty.biz
macrokunith-proxobivive.net
preginaxodom.name
transimapeful-cotalision.com
prefinazuly.name
inucasazing-microhesunian-semidikokement.biz
disitirotion-transekarenate.org
unehihify-antimepavable-nonubovafy.net
misunotelike-nonugidant.info
enogosudom-macrogekabive.biz
postozokipetn-microdomobaly.biz
interunavission-ininibecist.org
microhinoler.org
prosihamish-noneguhaness.com
preberekous-microkagibant-imemahal.name
iletegifage.org
emikuraran.biz
overokigoty-ilecavish.net
nonikofucable-postelihuzism-rexecigism.net
imixifure.info
minirabupeness-nonitefuward.org
misasugegify-underazosuzish-exuvexezical.info
multipocihood-monomuhunible.org
nonohacutancy-postuxikitan-microseditoless.info
overasobament.info
overulurotion.biz
disepadely-disuzirovor.net
repetepian-irelucify.biz
enikobadom-postolixement.name
inunatogite-imoboraness.net
irimarefy.net
monohiloless-demodefy.com
previbetian-misunohigate.info
multivunuhance-inabiber.com
semicasinaty-ilibaholy.biz
transupovetn-monozeruduless.biz
debapesetn-underisaxufical-imukugamism.info
multibibetefy.com
exanonish.name
interanulish-imazekalike-unisukugate.info
inokevidage.org
monofipuly-underubihal.net
profobekify-subebobefy-exozufous.name
macrovetecuship-emebudemical-underaxakament.biz
demeficiward-retitisily-macromuvaward.org
monosumuly-ilenusuty-dedabaness.net
exapofaran-postulusadify.com
microhobament-postevofafity.com
rebezusaly-overidirity-ultrahiseness.org
unafacigage-transihicical-prebokity.info
interazution-irudegufy-antinefoly.biz
minizecidish-macrolafukish-depovased.biz
derirepous-cosideship-semibiseless.biz
overupazadity-irativorical.name
coseviness-nonikunant-macrorasihood.net
nonesocern-macrotocipity.info
interuzoputy.info
inicinic-misuluzan-ultrakuxuness.com
sububesebism-ultrabutath.com
misacireship.org
exuxuburan-miniravuhood-exosoxen.info
macrozigahood-monosulopancy.com
unegoping-detunusion-antimuruseful.biz
macrozixaward-semivanimoly-underekutoty.biz
ultratipuxian-inosilission-multiridith.net
microtonagament.info
cobemesion-redacocoful.name
disicogure-seminedasoly.biz
dekacify.net
emegamilike-imupogazance-ultrapanacesion.org
unocelibable-underelatucance.com
irodetolike-imisocatite-inecolafian.com
antikuzucen-irokarance-transitupikible.org
semiralety-macrorobinant-ultrapixutency.biz
transisomuless.name
ilebigument-macroripakesion.org
profebarable.org
nonixigefy-protisumiless.biz
corahicohood.com
pretuvution-disafatutical-irehopuvese.name
miniregath-anticesuty-postudagily.biz
coguvilaship-recakubodom.name
overipugoful-interizihing.org
imipadaness-iralikoward-semitolicoly.info
interupefity-semigiduly.info
macromosoriship.net
antigizepist.net
subuluhic-disomokate.net
irunucudor-macrogocudern-comoxizish.name
underedofobate.net
prolapuzern-progobutiful-dehifasion.org
irucasian-macrofevasion.net
unogoxeness-semixocapency.org
rehofocese.org
exebutian-interomifenism.org
subihefahood-subenopure-ultramoherihood.net
nonezogeward.com
exasavate-minidevilefy-subanevous.biz
enodenission-overucelancy-microvitasission.info
ultrafakitesion-misesuzahical-transanafetion.biz
interinipoly-minimorovor-debininess.com
prenedelission-interugefable-repekosossion.name
postifozible-irololuship.com
unozolasion.org
unobelaness-prepifavety.info
cofukosable.info
iloletible-imakeben.info
ultraronupity.name
minikisision-monobavunism-micronepavage.org
unufepaness-misedepugance.biz
inafolage.com
semifolofic-unaraxal.biz
enerivosism-imenufanist-macrovonahood.org
monobocution.info
cosuzuness-prepurizor-unasulal.name
inopivic-antimaporary-subavocobive.biz
covogidish-iletinassion.biz
defizalike-unodatage-inarabevous.com
unuvirisern-interusalosize-misucakiness.org
ireninenish-multicemath-prezucetussion.biz
interodekive.com
iramilahood-antirotuxary-misobegesion.name
multidafadite-postagoker.org
monobagehance.net
emixuvidite-ilofikency-subolubify.biz
postugihucency-emademify.name
cotefehood-imocakitency.biz
enikavely-inosifuty-postaviraly.info
transabusossion.biz
interitebure.net
unehumugage-ultraburosion.com
subutavahen-inuhabish.org
subifefer-devufoward-probelalance.org
emefimafible.biz
ilibefudom.biz
postemivaxage.net
monofudumossion.info
inuxazodom-macrodexaxahood.org
semibugegetn-monohifutuly.biz
macromohazaship-subonohion-disonixucing.com
emosacekant-cokebohood-nonetakive.biz
interozecifist-antipinukity-multifekemath.net
refedomous-antifaliless.name
ultraxekevohood-nonizerosion-exovigant.name
interarogous-unuculuhood.org
semipulimian.com
monocalacaless.biz
disevolikency-retipegation.biz
cosituxath-misuxunor.info
ultraporader-conapefy-prolobeziless.info
ilucasure.com
reletohite-misosulahood-antitedudom.info
minivucilous-inafafomism.net
monorifutaless-ilocamussion.name
inohufohese-imufilahood-antifidupite.com
emegemaxed-transigifuty-multitumolith.net
exotacible-denitokolike.com


{"version":"0.3.1","atoms":[],"cards":[["markdown",{"markdown":"### 背景介绍\n2019年5月27号，360Netlab 未知威胁检测系统发现一个可疑的ELF文件，目前仅有一款杀毒引擎检测识别。通过详细分析，我们确定这是一款Proxy Botnet，并且是Win32.Ngioweb[[1\\]](https://research.checkpoint.com/ramnits-network-proxy-servers/)恶意软件的Linux版本变种，我们将它命名为Linux.Ngioweb。它与Win32.Ngioweb共用了大量代码，不同的是它新增了DGA特性。我们注册了其中一个DGA C2域名(enutofish-pronadimoful-multihitision.org)，并对它进行Sinkhole处理以此来观察Bot连接情况。\n\n此外，我们还观察到大量部署WordPress的Web服务器被植入Linux.Ngioweb 恶意软件。尽管Bot程序由Web容器对应的用户组运行并且权限很小但还是能够正常工作，并被充当Rotating Reverse Proxy[[2\\]](https://stormproxies.com/rotating_reverse_proxies.html)节点。\n\n目前，我们还没有看清楚Linux.Ngioweb攻击者的目的，但我们猜测他可能会监听代理网络流量。\n\n\n### Linux.Ngioweb概览\n\nLinux.Ngioweb Bot样本的主要功能是在受害者的机器上实现Back-Connect Proxy[[3\\]](https://hide-ip-proxy.com/what-is-a-backconnect-proxy/)。攻击者将多个Bot构建为一个Proxies Pool，并通过双层C2协议控制，然后提供Rotating Reverse Proxy Service。\n\n<a href=\"__GHOST_URL__/content/images/2019/06/Linux.Ngioweb-1.png\"><img src=\"__GHOST_URL__/content/images/2019/06/Linux.Ngioweb-1.png\" class=\"kg-image\"/></a>\n\n### Linux.Ngioweb逆向分析\n#### 样本信息\n * MD5: 827ecf99001fa66de513fe5281ce064d\n > ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), statically linked, stripped\n \n \n#### 样本对抗技巧\n- 使用小众的musl libc库\n  <a href=\"__GHOST_URL__/content/images/2019/06/1.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/1.PNG\" class=\"kg-image\"/></a>\n\n- 将所需函数预存在function table中\n  <a href=\"__GHOST_URL__/content/images/2019/06/2.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/2-3.PNG\" class=\"kg-image\"/></a>\n\n- 使用Stack Strings Obfuscation技术\n  <a href=\"__GHOST_URL__/content/images/2019/06/3.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/3-2.PNG\" class=\"kg-image\"/></a>\n\n\n- 动态生成CRC，AES加密算法所需常量表\n   <a href=\"__GHOST_URL__/content/images/2019/06/crypt-1.png\"><img src=\"__GHOST_URL__/content/images/2019/06/crypt-1.png\" class=\"kg-image\"/></a>\n\n- 使用双层C2协议，其中Stage-2 C2由Stage-1 C2的CONNECT指令确定\n\n- Stage-2 C2使用双层加密的通信协议\n\n#### Stage-1 C2协议分析\n\n在此阶段样本的主要行为是和Stage-1 C2建立通信，根据C2返回的指令进行下一步的操作。\n\n###### 通信尝试\n\n* 每隔60秒尝试和以下硬编码C2 IP建立通信\n    169.239.128.166:443 \n    185.244.149.73:443\n\n* 每隔73秒尝试和DGA (Domain Generation Algorithm) 生成的域名建立通信。当DGA域名数达到300时，Seed会重置，所以DGA域名总数只有300。\n  <a href=\"__GHOST_URL__/content/images/2019/06/4.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/4-1.PNG\" class=\"kg-image\"/></a>\n\n\n###### DGA实现\n  ```c\nuint64_t GenSeed(uint32_t& seed, uint32_t mod)\n{\n        uint32_t tmp = 0x41C64E6D * seed + 0x3039;\n        seed = tmp;\n        return tmp % mod;\n}\nstring dga(uint32_t& seed)\n{\n        char* HeadBuf[] = { \"un\", \"under\", \"re\", \"in\", \"im\", \"il\", \"ir\", \"en\", \"em\",\n                            \"over\", \"mis\", \"dis\", \"pre\", \"post\", \"anti\",\"inter\",\n                            \"sub\", \"ultra\", \"non\", \"de\",\"pro\", \"trans\", \"ex\",\n                            \"macro\", \"micro\", \"mini\",\"mono\", \"multi\", \"semi\", \"co\" };\n\n        char* BodyBufA[] = {\"able\",\"ant\",\"ate\",\"age\",\"ance\",\"ancy\",\"an\",\"ary\",\n                            \"al\",\"en\",\"ency\",\"er\",\"etn\", \"ed\", \"ese\",\"ern\",\"ize\",\n                            \"ify\",\"ing\",\"ish\",\"ity\",\"ion\",\"ian\",\"ism\",\"ist\",\"ic\",\"ical\",\n                            \"ible\",\"ive\",\"ite\",\"ish\",\"ian\",\"or\",\"ous\",\"ure\" };\n\n        char* BodyBufB[] = {\"dom\",\"hood\",\"less\",\"like\",\"ly\",\"fy\",\"ful\",\"ness\",\n                            \"ment\",\"sion\",\"ssion\",\"ship\",\"ty\",\"th\",\"tion\",\"ward\" };\n\n        char* TailBuf[] = { \".net\",\".info\",\".com\",\".biz\",\".org\",\".name\" };\n\n        string BlockBufA = \"aeiou\";\n        string BlockBufB = \"bcdfghklmnprstvxz\";\n        string domain;\n        uint32_t dashloop = GenSeed(seed, 3) + 1;\n        while (dashloop--)\n        {\n                domain += HeadBuf[GenSeed(seed, 0x1e)];\n                int flag = 0;\n                int i = 0;\n                if (BlockBufA.find(domain.back()) == string::npos)\n                        flag = 1;\n                int fillcnt = GenSeed(seed, 0x3) + 4;\n                while (fillcnt > i)\n                {\n\n                        if (flag + i & 1)\n                                domain += BlockBufA[GenSeed(seed, 0x5)];\n                        else\n                                domain += BlockBufB[GenSeed(seed, 0x11)];\n                        i++;\n                }\n                if (BlockBufA.find(domain.back()) == string::npos)\n                        domain += BodyBufA[GenSeed(seed, 0x23)];\n                else\n                        domain += BodyBufB[GenSeed(seed, 0x10)];\n                if (dashloop != 0)\n                        domain += \"-\";\n        }\n        return domain += TailBuf[GenSeed(seed, 0x6)];\n}\n\n  ```\n\n  \n\n###### 通信协议\n\n此阶段通信是基于HTTP协议，并将参数内容进行了Base64编码。\n\n###### 数据包概览\n\n<a href=\"__GHOST_URL__/content/images/2019/06/5.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/5.PNG\" class=\"kg-image\"/></a>\n\n###### 发包解析\n\n将参数内容通过Base64解码后可以看到以下信息\n\n<a href=\"__GHOST_URL__/content/images/2019/06/6.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/6-1.PNG\" class=\"kg-image\"/></a>\n\n* id=machine-id[0:15]\n\n  <a href=\"__GHOST_URL__/content/images/2019/06/7.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/7.PNG\" class=\"kg-image\"/></a>\n\n* v=x86_64，硬编码，架构\n\n* sv=5003，硬编码，版本号\n\n* &qlohmzalwdepupwf,随机16字节数据，算法如下 \n\n  <a href=\"__GHOST_URL__/content/images/2019/06/8.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/8.PNG\" class=\"kg-image\"/></a>\n\n* User-Agent，硬编码\n\n  ```\n  Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0\n  ```\n\n###### 收包解析\n\n<a href=\"__GHOST_URL__/content/images/2019/06/a.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/a.PNG\" class=\"kg-image\"/></a>\n\n支持的指令\n\n* WAIT\n* CONNECT\n* DISCONNECT\n* CERT\n\n#### Stage-2 C2协议分析\n\n在此阶段样本的主要行为是和Stage-2的C2建立通信，开启Back-Connect Proxy功能。\n\n###### 通信协议\n\n此阶段通信是经过双层加密组合合成，内层为XOR，外层为AES。\n\n###### 数据包概览\n\n<a href=\"__GHOST_URL__/content/images/2019/06/b.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/b.PNG\" class=\"kg-image\"/></a>\n\n###### 加密算法\n\nXOR的Key由随机算法产生\n\n<a href=\"__GHOST_URL__/content/images/2019/06/d.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/d.PNG\" class=\"kg-image\"/></a>\n\n\n算法为\n\n<a href=\"__GHOST_URL__/content/images/2019/06/c.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/c.PNG\" class=\"kg-image\"/></a>\n\nAES使用ECB模式，无填充，Key为**qwerasdfzxcqwerasdftyuirfdsdsdss**\n\n\n###### 数据包结构\n数据包由header和msg俩部分组成\n\nheader结构\n\n```c\n#le->little endian\n#be->big endian\nstruct header\n{\n\tuint32_le xorkey;\n\tuint32_be msgcrc32;\n\tuint32_be len;\n\tuint16_be msgcode\n\tuint16_be magic\n};\n```\n\n\nmsg由chunk构成，样本支持的chunk如下\n\n| Chunk  Type | Chunk Length | Description                                                  |\n| ----------- | ------------ | ------------------------------------------------------------ |\n| 1           | 1            | BYTE                                                         |\n| 2           | 2            | WORD big endian                                              |\n| 3           | 4            | DWORD big endian                                             |\n| 4           | 8            | QWORD big endian                                             |\n| 5           | N+4          | Bytes array.The first 4 bytes of chunk are the big endian-encoded length (N) of the array |\n\n一个msg可以有一个或多个chunk,不同的msg有不同的格式。\n\n样本支持的msg类型分recv和send 两种\n\n* recv\n  <a href=\"__GHOST_URL__/content/images/2019/06/msgrecv.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/msgrecv.PNG\" class=\"kg-image\"/></a>\n  \n* send\n  <a href=\"__GHOST_URL__/content/images/2019/06/msgsend.PNG\"><img src=\"__GHOST_URL__/content/images/2019/06/msgsend.PNG\" class=\"kg-image\"/></a>\n\n汇总见下表\n| msgcode | Driection | Description         | Fromat                                                       |\n| ------- | --------- | ------------------- | ------------------------------------------------------------ |\n| 0x1010  | recv      | set channel id      | 3 chunks:(QWORD ConnId, Array IPAddr,WORD Port)              |\n| 0x1011  | recv      | start proxy request | 5 chunks:(QWORD RequestId, BYTE reason,BYTE AddrType,Array Addr, WORD port) |\n| 0x1012  | recv      | close connection    | 1 chunk:(QWORD ConnId)                                       |\n| 0x10    | send      | check-in            | 1 chunk:(QWORD BotId)                                        |\n| 0x11    | send      | set-channel ack     | 1 chunk:(DWORD VersionId)                                    |\n| 0x14    | send      | tcp server started  | 5 chunks:(DWORD ConnectionId, QWORD RequestId, BYTE AddrType, Array Addr, WORD Port) |\n| 0x15    | send      | error               | 2 chunks:(DWORD RequestId,BYTE reason )                      |\n| 0x16    | send      | udp server started  | 5 chunks:(DWORD ConnectionId, QWORD RequestId, BYTE AddrType, Array Addr, WORD Port) |\n\n###### 发包解析样例\n\n* 原始数据（数据包结构）\n\n  ```\n   packet[0:31]:\n   6c 52 8c 08 3e 80 a9 3c 00 00 00 10 00 10 fa 51 \n   04 dd b0 b4 9d 10 ec 42 c3 00 00 00 00 00 00 00\n   header\t\t--->packet[0:15]\n   \txorkey\t\t--->0x088c526c\n   \tmsgcrc32\t--->0x3e80a93c\n   \tmsglen\t\t--->0x00000010\n   \tmsgcode\t\t--->0x0010,check-in \n   \tmagic\t\t--->0xfa51\n   msg\t\t--->packet[16:31]\n   \t1st chunk\n   \t\tchunktype\t--->0x4\n   \t\tcontent\t\t--->0xddb0b49d10ec42c3\n   \n  ```\n\n* XOR加密后\n\n  ```\n  6c 52 8c 08 36 0c fb 50 08 8c 52 7c 08 9c a8 3d \n  0c 51 e2 d8 95 9c be 2e cb 8c 52 6c 08 8c 52 6c\n  ```\n\n* AES加密后\n\n  ```\n  c1 d3 78 71 2d f6 5b bb  16 ca ff 8b ef 69 bb 26\n  3b 01 f0 22 70 09 38 dc  e7 06 89 de 2b 55 eb 8e\n  ```\n\n###### 收包解析样例\n\n* 原始数据\n\n  ```\n  c5 ad 4a bf 30 C2 3a 43 9b 6e 22 08 73 e0 b9 5d \n  3c e6 b7 f0 74 76 53 43 3a 79 0e 82 80 1a c3 84 \n  ba a4 85 05 4a 63 b1 d6 d1 94 ad 53 be 7a 9a 88\n  ```\n\n* AES解密后\n\n  ```\n  59 8b e5 6d 4a ee bf ef 6d e5 8b 79 7d f5 71 08\n  69 b8 81 aa 92 ed 65 fb 29 e0 8b 59 6d e1 51 47\n  19 e1 89 d8 29 e5 8b 59 6d e5 8b 59 6d e5 8b 59\n  ```\n\n* XOR解密后（数据包结构）\n\n  ```\n    packet[0:47]\n      59 8b e5 6d 27 0b 34 b6 00 00 00 20 10 10 fa 51\n      04 5d 0a f3 ff 08 ee a2 44 05 00 00 00 04 da 1e\n      74 04 02 81 44 00 00 00 00 00 00 00 00 00 00 00\n\n    header\t\t--->packet[0:15]\n      xorkey\t\t--->0x6de58b59\n      msgcrc32\t--->0x270b34b6\n      msglen\t\t--->0x00000020\n      msgcode\t\t--->0x1010,set channel id\n      magic\t\t--->0xfa51\n\n    msg\t\t\t--->packet[16:47]\n      1st chunk\n          chunktype\t--->0x04\n          content\t\t--->0x5d0af3ff08eea244\n      2nt chunk\n          chunktype\t--->0x05\n          content\t\t--->len:0x00000004 buf:0xda1e7404\n      3rd chunk\n          chunktype\t--->0x02\n          content\t\t--->0x8144\n  ```\n\n### Stage-2 C2关联分析\n\n我们通过访问Stage-1 C2 URL (http://185.244.149.73:443/min.js) 共得到以下6个Stage-2 C2的地址。\n```\n5.135.58.119\n5.135.58.121\n5.135.58.123\n5.135.58.124\n91.134.157.11\n193.70.73.115\n```\n通过我们的图系统关联test.zip的MD5（9017804333c820e3b4249130fc989e00）得到了更多的URL并对他们进行指纹识别，确认了另外18个存活的Stage-2 C2。\n\n```\n5.135.35.160\n5.196.194.209\n51.254.57.83\n54.36.244.84\n54.36.244.85\n54.36.244.91\n91.121.36.212\n91.121.236.219\n92.222.151.63\n145.239.108.241\n163.172.201.184\n163.172.202.116\n178.33.101.176\n178.33.101.177\n178.33.101.178\n178.33.101.182\n188.165.5.123\n188.165.163.20\n```\n\n我们在free-socks.in网站上可以检索到Stage-2 C2 IP地址正在提供Socks5代理服务。\n\n<a href=\"__GHOST_URL__/content/images/2019/06/free-proxy.png\"><img src=\"__GHOST_URL__/content/images/2019/06/free-proxy.png\" class=\"kg-image\"/></a>\n\n我们测试这些Socks5代理IP均正常工作，同时它们也通过Stage-1 C2协议访问了我们Sinkhole 的C2域名(enutofish-pronadimoful-multihitision.org)，所以可以说明他们都是Linux.Ngioweb Bot。\n\n```bash\nroot@localhost:~# curl --socks5 91.134.157.11:50880 ifconfig.me\n31.170.123.49\n\nroot@localhost:~# curl --socks5 91.134.157.11:62012 ifconfig.me\n208.113.197.88\n\nroot@localhost:~# curl --socks5 91.134.157.11:18278 ifconfig.me\n45.58.190.100\n\nroot@localhost:~# curl --socks5 91.134.157.11:64380 ifconfig.me\n72.29.64.29\n\nroot@localhost:~# curl --socks5 91.134.157.11:47067 ifconfig.me\n54.38.101.17\n\nroot@localhost:~# curl --socks5 91.134.157.11:63862 ifconfig.me\n88.99.212.97\n\nroot@localhost:~# curl --socks5 91.134.157.11:49475 ifconfig.me\n23.91.65.240\n```\n\n\n\n### 被感染的IP信息\n\n通过Sinkhole C2域名(enutofish-pronadimoful-multihitision.org)，我们目前共观察到有2692个Bot IP。\n\n<a href=\"__GHOST_URL__/content/images/2019/06/bot.png\"><img src=\"__GHOST_URL__/content/images/2019/06/bot.png\" class=\"kg-image\"/></a>\n\n\n以下是被感染的IP 国家/地区详细列表\n\n```\nUS 1306\nBR 156\nRU 152\nDE 133\nFR 102\nSG 98\nNL 80\nGB 66\nCA 66\nIT 64\nVN 42\nAU 36\nPL 31\nTR 28\nJP 26\nIN 26\nZA 21\nID 19\nES 18\nUA 15\n```\n\n通过对被感染IP指纹识别，我们观察到几乎所有Bot IP都是Web服务器，同时都部署了WordPress程序，但是我们还不能确定攻击者是如何入侵WordPress网站。\n\n我们通过联系一些受感染者用户，并在他们的Web服务器上发现了多种类型的WebShell，这些WebShell都是高度混淆，但是混淆手法，加密方式以及编码特征相似。结合被感染IP访问Sinkhole时序特征，我们猜测攻击者会周期性地对受害者网站WebShell下发指令并运行Linux.Ngioweb程序。\n\n\n\n### 处置建议\n\nLinux.Ngioweb攻击者可能会监听代理网络流量，我们建议读者不要使用Stage-2 C2 IP提供的Socks5代理服务。\n\n我们建议WordPress用户备份网站文章数据库(删除wp.service.controller.*等后门用户)，重新安装最新版本WordPress程序，增强用户密码复杂度，增强WebShell检测能力，并禁止PHP命令执行相关函数；\n\n相关安全和执法机构，可以邮件联系netlab[at]360.cn获取被感染的IP地址列表。\n\n\n\n####联系我们\n感兴趣的读者，可以在 [**twitter**](https://twitter.com/360Netlab) 或者在微信公众号 **360Netlab** 上联系我们。\n\n\n\n#### IoC list\n\n样本MD5\n\n```\n827ecf99001fa66de513fe5281ce064d\n```\n\n\n\nStage-1 C2 (硬编码IP)\n\n```\n169.239.128.166     \tSouth Africa        \tASN 61138           \tZappie Host LLC\n185.244.149.73      \tRomania             \tASN 60117           \tHost Sailor Ltd.\n```\n\n\n\nStage-2 C2\n\n```\n163.172.201.184     \tFrance              \tASN 12876           \tOnline S.a.s.\n163.172.202.116     \tFrance              \tASN 12876           \tOnline S.a.s.\n5.135.35.160        \tFrance              \tASN 16276           \tOVH SAS\n5.135.58.119        \tFrance              \tASN 16276           \tOVH SAS\n5.135.58.121        \tFrance              \tASN 16276           \tOVH SAS\n5.135.58.123        \tFrance              \tASN 16276           \tOVH SAS\n5.135.58.124        \tFrance              \tASN 16276           \tOVH SAS\n5.196.194.209       \tFrance              \tASN 16276           \tOVH SAS\n51.254.57.83        \tFrance              \tASN 16276           \tOVH SAS\n54.36.244.84        \tFrance              \tASN 16276           \tOVH SAS\n54.36.244.85        \tFrance              \tASN 16276           \tOVH SAS\n54.36.244.91        \tFrance              \tASN 16276           \tOVH SAS\n91.121.36.212       \tFrance              \tASN 16276           \tOVH SAS\n91.121.236.219      \tFrance              \tASN 16276           \tOVH SAS\n91.134.157.11       \tFrance              \tASN 16276           \tOVH SAS\n92.222.151.63       \tFrance              \tASN 16276           \tOVH SAS\n145.239.108.241     \tGermany             \tASN 16276           \tOVH SAS\n178.33.101.176      \tIreland             \tASN 16276           \tOVH SAS\n178.33.101.177      \tIreland             \tASN 16276           \tOVH SAS\n178.33.101.178      \tIreland             \tASN 16276           \tOVH SAS\n178.33.101.182      \tIreland             \tASN 16276           \tOVH SAS\n188.165.5.123       \tIreland             \tASN 16276           \tOVH SAS\n188.165.163.20      \tFrance              \tASN 16276           \tOVH SAS\n193.70.73.115       \tFrance              \tASN 16276           \tOVH SAS\n```\n\n\n\nStage-1 C2 (DGA)\n\n```\nenutofish-pronadimoful-multihitision.org\nexaraxexese-macrobacaward-exafosuness.net\nnonafudazage.name\ndemigelike.net\nemuvufehood.net\nsubolukobese.biz\ninogepicor-prorarurument.biz\noverahudulize-unazibezize-overuzozerish.org\nimunolance-postodinenetn-antifipuketn.net\nantizerolant-monogevudom.info\ntransavecaful-transinenation-transikaduhern.com\nsubogonance.info\ninoxodusor-misehupukism.info\ndevikoviward-semibazegily-copaxugage.name\neniguzeless-inecimanable.net\nsubilebesion-irogipate.biz\ncolozosion-antigobunaful.name\ninudiduty-dezaviness.org\nirelizaring-enipulical-monovuxehossion.info\nilenudavous-monoxoxapal-semimihupution.info\nultrapadupize.biz\ncovategal-dezakedify-enebugassion.name\ntransivesudom-macropimuship.org\nrezolezation-transapupirify-seminecation.name\nmacrolutoxous-overefimety.name\ncoxumumage-dexolalite.name\ncotexafical-postirutuvian-emimimous.biz\ncopubuloness-misumusal-disokozian.com\nnonecuzuking-enekopofen-imakozity.info\ndezohipal-ultrazebebive.name\ncosazalike-antifoxirer-subudikic.biz\nunderotutilism-monoceraretion-underosociful.name\noverugiror.net\nemuzixucize.biz\ndisicevament-desizigasion-recadihuful.biz\ndecehoward-microhikodely-overokerezant.com\nmicrolasokadom-ultralarumous.info\nminixecision-iruzaxuhood.net\nprofusonuty.info\nmultifipakency-conovofy-prorakikate.com\nantiseramoment.info\npostavutetn-emedarevous.biz\ninolugoty-inidiverible.com\nprodipamament.biz\noverogobity-imivocurify-disovizution.biz\ndecozaness-antihazation-overetalovical.net\nnonesolafy.com\nunihatosancy.name\ninteriragocern-micropuxotion-transogorion.org\nseminamatity-enogibely.name\ninosebovion.net\nexofifure-postirexument.info\ntransirirenern-semizafunic-nonivubed.biz\nenegizize-microtizobity.name\nmacrohuseded-multipazaseship.com\nimefihured-macrohixuhood.org\nmicrolulition-macrokiguxable.biz\nmultizesumefy-emebefion.biz\nunderebelassion-postizoziless.info\ndezuvazen.name\ndecotusion-exexavihood-exevozebant.name\ndisuzepuly.info\ninuviging-antizoluly.biz\nmultisotiren-ilazufist.org\npredepussion.info\ninidozadom.name\ninterikuhaful.info\ncozuheming.biz\nmultiruxuth.org\nmonozogeced.org\nmononoredom.info\npostarubixage-monocinamety-overogefesal.com\nprebekokian-misadepepive-transilogify.com\nmonohatodom-cohotiship.com\nexebasusion.org\nunahodoness-emevuzeward-emuzeduness.com\nexemidexous-underiposapite-unegatature.name\ninterocugopist-misugexadic-ilobipegency.org\nmonokifomancy-misagefism-macrobepoth.com\nantizekussion-minipusaral-copofuxoship.com\nrelutodom-comakitize.name\nmultikezusion.org\nemopumical-enohecical.org\nsemitegopish.net\nrecepatission.info\ninoluvary.com\nseminitotuful.info\ninteranubing-emelulotal-transugotuzern.com\nsubefehity-iledutession.name\nultrapapiten.biz\ntransuvarusish-prozumoxety.info\ntransisigern.org\nimirotiship-microhopulive-emotomeship.com\npresefavution.info\nenevifaking.org\nmisidogive-coxecovor-dexefoxan.name\noverazadudom-deliromohood.com\nemakanuward.com\nemitohage-overasuhorure-antitipenoless.info\nultrasesebible.biz\nmultihadekite.name\niluvused-iravoxish.info\npostobagoly-detovaward-unixohible.biz\nunderasusogen.com\nimovaman-multimihivoship-imeduxian.biz\ndedunuguhood.com\nprevukition.info\nunderehugavish.org\nmisoxomelical-iluxubism.net\nmicrocolacoful-postabitition.name\noverurohely-overadolure-iruraluness.org\nunurodable-dekipuhic-postuxufous.org\nunitucihern-postadagen-imupuduth.org\nimukokuship.org\nprenubocetion-ultrahahohood.com\nmonofugition-underefogukic.org\nirofetufy.com\nirobigelike.org\npresifament.biz\noveretigution.info\nenuvopan-imixesoward-irarupipary.biz\ninorofizian.com\nmonopadecotion-multicecihood-imuzicasion.com\nexofosehance-minimezazofy.org\nmonokacofudom-inuvinable.com\nemisucosion-prohosexite-imorekusion.net\nsemiledoduly.info\nmultivapufy-promumuly-enonuben.net\nsubebodency.info\ncofexasish-inodehed.net\nunutexupify-conofubusion.com\nmisebonure-iluborize-rezericify.com\nexunaxian.info\ncolanizity-postosecive-nonuresible.info\ndedaliward-imipusen-inacaliver.com\nrefusovize.org\nmonokuvission-transodigical-semihehamussion.biz\ntransalavudom-multilavezuhood.net\nexusizeward.net\nunisimor.name\nminipihagaship.com\nrecusigetion-transubeviful.info\nmultixizitufy-microtomuly-multixoleward.com\nmicroxulodish-semibahoty.biz\nmacrokunith-proxobivive.net\npreginaxodom.name\ntransimapeful-cotalision.com\nprefinazuly.name\ninucasazing-microhesunian-semidikokement.biz\ndisitirotion-transekarenate.org\nunehihify-antimepavable-nonubovafy.net\nmisunotelike-nonugidant.info\nenogosudom-macrogekabive.biz\npostozokipetn-microdomobaly.biz\ninterunavission-ininibecist.org\nmicrohinoler.org\nprosihamish-noneguhaness.com\npreberekous-microkagibant-imemahal.name\niletegifage.org\nemikuraran.biz\noverokigoty-ilecavish.net\nnonikofucable-postelihuzism-rexecigism.net\nimixifure.info\nminirabupeness-nonitefuward.org\nmisasugegify-underazosuzish-exuvexezical.info\nmultipocihood-monomuhunible.org\nnonohacutancy-postuxikitan-microseditoless.info\noverasobament.info\noverulurotion.biz\ndisepadely-disuzirovor.net\nrepetepian-irelucify.biz\nenikobadom-postolixement.name\ninunatogite-imoboraness.net\nirimarefy.net\nmonohiloless-demodefy.com\nprevibetian-misunohigate.info\nmultivunuhance-inabiber.com\nsemicasinaty-ilibaholy.biz\ntransupovetn-monozeruduless.biz\ndebapesetn-underisaxufical-imukugamism.info\nmultibibetefy.com\nexanonish.name\ninteranulish-imazekalike-unisukugate.info\ninokevidage.org\nmonofipuly-underubihal.net\nprofobekify-subebobefy-exozufous.name\nmacrovetecuship-emebudemical-underaxakament.biz\ndemeficiward-retitisily-macromuvaward.org\nmonosumuly-ilenusuty-dedabaness.net\nexapofaran-postulusadify.com\nmicrohobament-postevofafity.com\nrebezusaly-overidirity-ultrahiseness.org\nunafacigage-transihicical-prebokity.info\ninterazution-irudegufy-antinefoly.biz\nminizecidish-macrolafukish-depovased.biz\nderirepous-cosideship-semibiseless.biz\noverupazadity-irativorical.name\ncoseviness-nonikunant-macrorasihood.net\nnonesocern-macrotocipity.info\ninteruzoputy.info\ninicinic-misuluzan-ultrakuxuness.com\nsububesebism-ultrabutath.com\nmisacireship.org\nexuxuburan-miniravuhood-exosoxen.info\nmacrozigahood-monosulopancy.com\nunegoping-detunusion-antimuruseful.biz\nmacrozixaward-semivanimoly-underekutoty.biz\nultratipuxian-inosilission-multiridith.net\nmicrotonagament.info\ncobemesion-redacocoful.name\ndisicogure-seminedasoly.biz\ndekacify.net\nemegamilike-imupogazance-ultrapanacesion.org\nunocelibable-underelatucance.com\nirodetolike-imisocatite-inecolafian.com\nantikuzucen-irokarance-transitupikible.org\nsemiralety-macrorobinant-ultrapixutency.biz\ntransisomuless.name\nilebigument-macroripakesion.org\nprofebarable.org\nnonixigefy-protisumiless.biz\ncorahicohood.com\npretuvution-disafatutical-irehopuvese.name\nminiregath-anticesuty-postudagily.biz\ncoguvilaship-recakubodom.name\noveripugoful-interizihing.org\nimipadaness-iralikoward-semitolicoly.info\ninterupefity-semigiduly.info\nmacromosoriship.net\nantigizepist.net\nsubuluhic-disomokate.net\nirunucudor-macrogocudern-comoxizish.name\nunderedofobate.net\nprolapuzern-progobutiful-dehifasion.org\nirucasian-macrofevasion.net\nunogoxeness-semixocapency.org\nrehofocese.org\nexebutian-interomifenism.org\nsubihefahood-subenopure-ultramoherihood.net\nnonezogeward.com\nexasavate-minidevilefy-subanevous.biz\nenodenission-overucelancy-microvitasission.info\nultrafakitesion-misesuzahical-transanafetion.biz\ninterinipoly-minimorovor-debininess.com\nprenedelission-interugefable-repekosossion.name\npostifozible-irololuship.com\nunozolasion.org\nunobelaness-prepifavety.info\ncofukosable.info\niloletible-imakeben.info\nultraronupity.name\nminikisision-monobavunism-micronepavage.org\nunufepaness-misedepugance.biz\ninafolage.com\nsemifolofic-unaraxal.biz\nenerivosism-imenufanist-macrovonahood.org\nmonobocution.info\ncosuzuness-prepurizor-unasulal.name\ninopivic-antimaporary-subavocobive.biz\ncovogidish-iletinassion.biz\ndefizalike-unodatage-inarabevous.com\nunuvirisern-interusalosize-misucakiness.org\nireninenish-multicemath-prezucetussion.biz\ninterodekive.com\niramilahood-antirotuxary-misobegesion.name\nmultidafadite-postagoker.org\nmonobagehance.net\nemixuvidite-ilofikency-subolubify.biz\npostugihucency-emademify.name\ncotefehood-imocakitency.biz\nenikavely-inosifuty-postaviraly.info\ntransabusossion.biz\ninteritebure.net\nunehumugage-ultraburosion.com\nsubutavahen-inuhabish.org\nsubifefer-devufoward-probelalance.org\nemefimafible.biz\nilibefudom.biz\npostemivaxage.net\nmonofudumossion.info\ninuxazodom-macrodexaxahood.org\nsemibugegetn-monohifutuly.biz\nmacromohazaship-subonohion-disonixucing.com\nemosacekant-cokebohood-nonetakive.biz\ninterozecifist-antipinukity-multifekemath.net\nrefedomous-antifaliless.name\nultraxekevohood-nonizerosion-exovigant.name\ninterarogous-unuculuhood.org\nsemipulimian.com\nmonocalacaless.biz\ndisevolikency-retipegation.biz\ncosituxath-misuxunor.info\nultraporader-conapefy-prolobeziless.info\nilucasure.com\nreletohite-misosulahood-antitedudom.info\nminivucilous-inafafomism.net\nmonorifutaless-ilocamussion.name\ninohufohese-imufilahood-antifidupite.com\nemegemaxed-transigifuty-multitumolith.net\nexotacible-denitokolike.com\n```\n\n"}]],"markups":[],"sections":[[10,0],[1,"p",[]]],"ghostVersion":"3.0"}