The Gafgyt variant vbot seen in its 31 campaigns
<!--kg-card-begin: markdown--><h2 id="overview">Overview</h2>
<p>Gafgyt botnets have a long history of infecting Linux devices to launch DDoS attacks. While dozens of variants have been detected, new variants are constantly emerging with changes in terms of register message, exploits, and attacking methods. On the other hand, their new botnets are usually short lived, with most of the C2s watched keeping active for only a few days. In this blog, I will introduce such a sort of variant. The key findings are as follow:</p>
<ol>
<li>This variant was active from mid-April to mid-June. In total 31 campaigns for this variant were detected, from which 572 samples were captured. They were spread to build 19 botnets.</li>
<li>This variant evolved through 2 versions. Both have a characteristic register message template “ver:%f:%s:%d” that includes a rarely seen format specifier “%f”.</li>
<li>Mirai code was heavily used in both versions, which makes it possible analyze them with the extracted Mirai configurations.</li>
<li>The same infrastructures, e.g., download servers, and filenames were observed being used in other families of botnet campaigns.<br>
This variant was named as vbot because vbot is found being used in an unstripped sample by the author. Accordingly the 2 versions are named as vbot1 and vbot2 in this blog.</li>
</ol>
<h2 id="vbot1">vbot1</h2>
<p>Only 1 vbot1 campaign was seen, with 26 samples captured, as shown by the following honeypot records.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig1.png" alt="fig1" loading="lazy"></p>
<p>All samples share the same C2 <code>185.225.19.200:2017</code>. Since in Gafgyt it’s common that the same source code will be compiled into binaries for different processor architectures, for simplicity, the following analysis is based on the unstripped ARM sample of <code>f696375452d08eecbde14d64c74acdde</code>. Compared with previous variants, vbot1 has a more concise main() function because most of its code was moved into 2 new functions named init_vbot() and main_c2_handler().<br>
<img src="__GHOST_URL__/content/images/2020/07/fig3.png" alt="fig3" loading="lazy"><br>
The function name init_vbot indicates that the author code named their botnet as vbot. It's responsible for initializing things including watchdog, configurations, and scanner. C2 communications are done in main_c2_handler(), where a loop of connection, registration and receiving command can be found, as shown below.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig4.png" alt="fig4" loading="lazy"></p>
<p>The characteristic register message template <code>“ver:%f:%s:%d”</code> is used in the registration block that tightly follows the connection block. From the unstripped symbols we can show that the 3 specifiers separately represent version, bot type and arch. The analyzed sample has version of 4.1.<br>
Actually it’s just the rarely seen specifier <code>“%f”</code> that caused my attention to this variant because as far as I knew “%f” was not supported by Gafgyt. The original authors borrowed the design of C library functions <code>printf</code> and <code>sprintf</code>, and implemented a new function named <code>sockprintf</code> which can generate message according to the assigned string format and send it to the C2. A custom yet simple format controls is done inside sockprintf with “%f” not implemented. That function has been kept by most Gafgyt variants. When firstly encountering vbot’s register template, I imagined a new version of sockprintf. However, that’s obviously not true. To reuse sockprintf but avoid complex programming, vbot author turned to sprintf to generate the expected message then passed it to sockprintf with the supported specifier <code>“%s”</code>.<br>
Similar to many Gafgyt variants, Mirai code can be found in vbot1. Due to its tight connection with the encrypted configurations, the borrowed code can be well analyzed with the extracted configurations. If you don’t know how to extract, please go to our VB2018 <a href="https://www.virusbulletin.com/uploads/pdf/magazine/2018/VB2018-Liu-Wang.pdf">paper</a>. The extracted configurations are shown below, with items annotated with its owner modules.<br>
<img src="__GHOST_URL__/content/images/2020/07/fig5.png" alt="fig5" loading="lazy"><br>
The commands are hidden in configurations. Except for attacking methods, vbot1 also supports remote update with the command <code>UPDATE</code>. Another worth mentioning feature is persistence mechanism, which is done by modifying crontab.</p>
<p>It’s strange that vbot1 was spread only once. After its campaign was firstly detected, 35 hours, or 1.5 days, later the first vbot2 campaign was seen from the same download server. Obviously the operators wanted to replace vbot1 with vbot2. The reason might be its buggy registration which always sends a 191-byte register message back to its C2 but only 18 bytes there are really useful, as shown by the following figure.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig2.png" alt="fig2" loading="lazy"></p>
<h2 id="vbot2">vbot2</h2>
<p>In total 30 vbot2 campaigns were seen from April 16 to June 12, 2020, with 546 samples captured from 12 download servers. From those samples 13 C2 servers were checked. Detailed analysis shows except the registration code, vbot2 actually differs a lot from vbot1 in terms of code structure, attacking methods and Mirai configuration. The following analysis is based on the x86 sample <code>f5b0ebebc924e69e34a4ddd145916594</code>. It’s stripped but key function names have been manually restored.<br>
Different from vbot1 but similar to many other variants, vbot2's C2 communications are done in main(), as shown below.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig6.png" alt="fig6" loading="lazy"></p>
<p>Nearly the same registration block as vbot1 can be found, with the 3 specifiers holding the same semantics. The analyzed sample has version of 1.5. The loop composed of “loc_804B80B -&gt; REGISTRATION -&gt; loc_804B863” is very similar to previous Gafgyt variants in terms of CFG node number and semantics. The blocks are separately responsible for establishing connection, registration, and receiving commands.<br>
5 attacking methods were checked. All of them have been seen in other variants.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig7.png" alt="fig7" loading="lazy"></p>
<p>Some vbot2 samples, e.g., <code>e36d96a74236038a348cfd667ca83528</code>, have slightly different attacking method names, as shown below.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig8.png" alt="fig8" loading="lazy"></p>
<p>2 Mirai configurations were found. The only difference lies in the 0x28 item, as shown by the following 2 figures.</p>
<p><img src="__GHOST_URL__/content/images/2020/07/fig9-1.png" alt="fig9-1" loading="lazy"><br>
<img src="__GHOST_URL__/content/images/2020/07/fig10.png" alt="fig10" loading="lazy"></p>
<p>From the annotations we can see the Mirai code was mainly used in modules of watchdog, killer, scanner and rand alpha string generation. Since the 0x28 item corresponds to a message to be written to the STDOUT, and the second unprintable 0x28 item is probably caused by a typo from the author.<br>
With the extracted configurations the differences from vbot1 are obvious. They are:</p>
<ol>
<li>vbot2 has different attacking methods from vbot1.</li>
<li>While vbot1 hides commands in its configuration, vbot2 directly uses them.</li>
<li>No remote update and persistence mechanism were found in vbot2.</li>
</ol>
<p>Although those great differences suggest that vbot1 and vbot2 were actually derived from different code bases, I still think they were written by the same author(s) because:</p>
<ol>
<li>The shared register message template and registration implementation are unique enough.</li>
<li>The first vbot2 campaign shared the same download and C2 server as vbot1 within a relatively short period of time (1.5 days).</li>
</ol>
<h2 id="vbotandtherhombusmalware">vbot and the RHOMBUS malware</h2>
<p>While the filename RHOMBUS was seen 4 times in vbot campaigns, its use in Gafgyt campaigns was much earlier<a href="https://twitter.com/_odisseus/status/1232957932121313281">[1]</a>, with the variant called RHOMBUS analysed in <a href="https://old.reddit.com/r/LinuxMalware/comments/fh3zar/memo_rhombus_an_elf_bot_installerdropper/">[2]</a><a href="https://blog.apnic.net/2020/05/22/rhombus-a-new-iot-malware/">[3]</a>. Here I make a simple comparison. In the blogged RHOMBUS malware dropper mechanism was found, with the dropper having the persistence ability across restart by modifying crontab. The dropped binaries, e.g., <code>269029c1554b13c3eccfaacf0196ff72</code> and <code>ba42665872ea41e3d2edd8978bc38c24</code>, actually belong to another Gafgyt variant that also heavily borrowed code from Mirai, as shown by the below figure.<br>
<img src="__GHOST_URL__/content/images/2020/07/fig11.png" alt="fig11" loading="lazy"><br>
From the above configuration we can see that obvious similarities exist between the RHOMBUS dropped binaries and vbot1. I think the most possibility is that vbot1 evolved from RHOMBUS malware with the following modifications:</p>
<ol>
<li>The dropper’s persistence mechanism was grafted to its payload. That’s why persistence items could be found in vbot1 configuration but not in the above figure.</li>
<li>The register template was updated.</li>
<li>c2 communications were moved to the so called main_c2_handler() function.</li>
</ol>
<p>Other key points about RHOMBUS malware include:</p>
<ol>
<li>The register message template is &quot;jm:_:%d&quot; or jm:%s:%d.</li>
<li>Similar to many Gafgyt variants, C2 communications were done in main().</li>
<li>The Gafgyt characteristic function initConnection() was removed with its code broken down into snippets that can be found in main().</li>
</ol>
<h2 id="conclusion">Conclusion</h2>
<p>I have introduced a short lived Gafgyt variant vbot. During its 2 month life, 31 campaigns were seen to build 19 botnets. From vbot we can learn that it’s easy for Linux IoT botnet authors to quickly write new variants, which might be due to the fact that dozens of Gafgyt and Mirai source has been leaked online. Once a new variant is written, the behind operators usually will spread it over and over with different campaigns to build multiple botnets. Such patterns have also been observed in other variants and families, e.g., Mirai. To fight such sort of fast emerging while short living botnets, automatic IoC extraction would play an import role for quick blocking or tracking. In VB2020 conference to be held in October, I will give a <a href="https://www.virusbulletin.com/conference/vb2020/abstracts/lightweight-emulation-based-ioc-extraction-gafgyt-botnets">talk</a> on that topic. I hope it will help you fight against Gafgyt botnets better.</p>
<h2 id="ioc">IoC</h2>
<h3 id="downloadservers">download servers</h3>
<pre><code>104.244.75.12
142.11.194.209
185.172.110.248
185.172.110.249
185.225.19.200
192.119.66.66
192.129.188.98
205.185.123.101
23.254.164.76
45.84.196.148
50.115.173.131
85.92.108.211
</code></pre>
<h3 id="vbot1md5">vbot1 MD5</h3>
<pre><code>2a141cd2930536f74f51fb57adbb0236
8717baf17660d8e96813ccd99f32c0be
cc559b487e1ec18727f37006bd3395e0
f666c3398601cd1b017f8d4556cabbbc
6fb6aaa253c165636ee63a4fdcdb1b9e
f422707ac869240bfeea648b6f9b90ad
36997fd129a5ff09311da94c3814379c
790ae71c097662bf6efba92d2d633076
e420df68941cc7ce2d8dd4ba92fd360e
3e36440871a6e39ee87e6d7d1a42155a
ae50829a02e5265c590f2fff35e64c52
09ab7435c76df627a813fb75db15ce5d
43ee98318945a475b555045aed4f0e01
e4db8addb5123021e358576157e5e1c0
4147fb0fe442173558f86fe37728ecae
846d6ad9ea86e331f2e071eac6a269de
40b1bf1e415ae508f8a5b831c2f4e994
f696375452d08eecbde14d64c74acdde
98b07b087b98b8d679c9938b16ae4df3
aea960687f0e43b465198be7ffafcf82
3d596d37fe6536a2c759923d920f3e08
52c462f3b22646774219f91bfb44ae66
d2c273e758fd4ac2759ca1d63aafcf6c
bbee73ed05730ad95df7a77241207ea5
0f492673eb249fa1209512575040f62d
0e59d4a40bba390314ffa0713b18441c
</code></pre>
<h3 id="vbot1c2">vbot1 C2</h3>
<pre><code>185.225.19.200 -port 2017
</code></pre>
<h3 id="vbot2md5">vbot2 MD5</h3>
<pre><code>efabd7e734490b9ad12812982347f237
614581bba324c3550a18268a8cb9c221
86310b514c55d31db288a2bb2c1e6114
76d9c69036f1eaac8f7a90eba3a36bfc
e36d96a74236038a348cfd667ca83528
d45da804fd35cf502bf942ebfeb64064
90a633f30bdbb2b80642bb229d1605d1
c4391301645cc9df4da3657f4c88f7dc
8bef47e420d0cdf8d0ee69a5d1f5b74c
4c8cdcbaf16f39a461b0bf7052fe1ec3
d936a9226fbbe97993bbe604c8cd5458
125b99cc79808679a7461f1841fd80a5
3b7da3d39db6ec08373c1e4af79aff85
23f764f5f918746b9ffff952dd25cc21
6f24268273573fd5f07cacb00031f1a0
ecae928b4e4093489bd221986da39aba
d883d5a2bedf0c3a3da79358c06fa429
3e26626d4563f3199fde498d0ff9fe32
11c1d777b18ffc0f23d2435fdb4645dc
...
</code></pre>
<h3 id="vbot2c2">vbot2 C2</h3>
<pre><code>104.244.75.12_666
142.11.194.209_1337
142.11.194.209_17911
142.11.194.209_34
142.11.194.209_44
184.172.110.248_666
184.172.110.249_666
185.172.110.248_323
185.172.110.248_666
185.225.19.200_666
192.119.66.66_7331
192.129.188.98_323
205.185.123.101_666
23.254.164.76_107
23.254.164.76_33
23.254.164.76_89
45.84.196.148_1227
50.115.173.131_111
85.92.108.211_1447
</code></pre>
<!--kg-card-end: markdown-->
Overview


Gafgyt botnets have a long history of infecting Linux devices to launch DDoS attacks. While dozens of variants have been detected, new variants are constantly emerging with changes in terms of register message, exploits, and attacking methods. On the other hand, their new botnets are usually short lived, with most of the C2s watched keeping active for only a few days. In this blog, I will introduce such a sort of variant. The key findings are as follow:


 1. This variant was active from mid-April to mid-June. In total 31 campaigns for this variant were detected, from which 572 samples were captured. They were spread to build 19 botnets.
 2. This variant evolved through 2 versions. Both have a characteristic register message template “ver:%f:%s:%d” that includes a rarely seen format specifier “%f”.
 3. Mirai code was heavily used in both versions, which makes it possible analyze them with the extracted Mirai configurations.
 4. The same infrastructures, e.g., download servers, and filenames were observed being used in other families of botnet campaigns.
    
    This variant was named as vbot because vbot is found being used in an unstripped sample by the author. Accordingly the 2 versions are named as vbot1 and vbot2 in this blog.



vbot1


Only 1 vbot1 campaign was seen, with 26 samples captured, as shown by the following honeypot records.





All samples share the same C2 185.225.19.200:2017. Since in Gafgyt it’s common that the same source code will be compiled into binaries for different processor architectures, for simplicity, the following analysis is based on the unstripped ARM sample of f696375452d08eecbde14d64c74acdde. Compared with previous variants, vbot1 has a more concise main() function because most of its code was moved into 2 new functions named init_vbot() and main_c2_handler().



The function name init_vbot indicates that the author code named their botnet as vbot. It's responsible for initializing things including watchdog, configurations, and scanner. C2 communications are done in main_c2_handler(), where a loop of connection, registration and receiving command can be found, as shown below.





The characteristic register message template “ver:%f:%s:%d” is used in the registration block that tightly follows the connection block. From the unstripped symbols we can show that the 3 specifiers separately represent version, bot type and arch. The analyzed sample has version of 4.1.

Actually it’s just the rarely seen specifier “%f” that caused my attention to this variant because as far as I knew “%f” was not supported by Gafgyt. The original authors borrowed the design of C library functions printf and sprintf, and implemented a new function named sockprintf which can generate message according to the assigned string format and send it to the C2. A custom yet simple format controls is done inside sockprintf with “%f” not implemented. That function has been kept by most Gafgyt variants. When firstly encountering vbot’s register template, I imagined a new version of sockprintf. However, that’s obviously not true. To reuse sockprintf but avoid complex programming, vbot author turned to sprintf to generate the expected message then passed it to sockprintf with the supported specifier “%s”.

Similar to many Gafgyt variants, Mirai code can be found in vbot1. Due to its tight connection with the encrypted configurations, the borrowed code can be well analyzed with the extracted configurations. If you don’t know how to extract, please go to our VB2018 paper. The extracted configurations are shown below, with items annotated with its owner modules.



The commands are hidden in configurations. Except for attacking methods, vbot1 also supports remote update with the command UPDATE. Another worth mentioning feature is persistence mechanism, which is done by modifying crontab.


It’s strange that vbot1 was spread only once. After its campaign was firstly detected, 35 hours, or 1.5 days, later the first vbot2 campaign was seen from the same download server. Obviously the operators wanted to replace vbot1 with vbot2. The reason might be its buggy registration which always sends a 191-byte register message back to its C2 but only 18 bytes there are really useful, as shown by the following figure.






vbot2


In total 30 vbot2 campaigns were seen from April 16 to June 12, 2020, with 546 samples captured from 12 download servers. From those samples 13 C2 servers were checked. Detailed analysis shows except the registration code, vbot2 actually differs a lot from vbot1 in terms of code structure, attacking methods and Mirai configuration. The following analysis is based on the x86 sample f5b0ebebc924e69e34a4ddd145916594. It’s stripped but key function names have been manually restored.

Different from vbot1 but similar to many other variants, vbot2's C2 communications are done in main(), as shown below.





Nearly the same registration block as vbot1 can be found, with the 3 specifiers holding the same semantics. The analyzed sample has version of 1.5. The loop composed of “loc_804B80B -> REGISTRATION -> loc_804B863” is very similar to previous Gafgyt variants in terms of CFG node number and semantics. The blocks are separately responsible for establishing connection, registration, and receiving commands.

5 attacking methods were checked. All of them have been seen in other variants.





Some vbot2 samples, e.g., e36d96a74236038a348cfd667ca83528, have slightly different attacking method names, as shown below.





2 Mirai configurations were found. The only difference lies in the 0x28 item, as shown by the following 2 figures.







From the annotations we can see the Mirai code was mainly used in modules of watchdog, killer, scanner and rand alpha string generation. Since the 0x28 item corresponds to a message to be written to the STDOUT, and the second unprintable 0x28 item is probably caused by a typo from the author.

With the extracted configurations the differences from vbot1 are obvious. They are:


 1. vbot2 has different attacking methods from vbot1.
 2. While vbot1 hides commands in its configuration, vbot2 directly uses them.
 3. No remote update and persistence mechanism were found in vbot2.


Although those great differences suggest that vbot1 and vbot2 were actually derived from different code bases, I still think they were written by the same author(s) because:


 1. The shared register message template and registration implementation are unique enough.
 2. The first vbot2 campaign shared the same download and C2 server as vbot1 within a relatively short period of time (1.5 days).



vbot and the RHOMBUS malware


While the filename RHOMBUS was seen 4 times in vbot campaigns, its use in Gafgyt campaigns was much earlier[1], with the variant called RHOMBUS analysed in [2][3]. Here I make a simple comparison. In the blogged RHOMBUS malware dropper mechanism was found, with the dropper having the persistence ability across restart by modifying crontab. The dropped binaries, e.g., 269029c1554b13c3eccfaacf0196ff72 and ba42665872ea41e3d2edd8978bc38c24, actually belong to another Gafgyt variant that also heavily borrowed code from Mirai, as shown by the below figure.



From the above configuration we can see that obvious similarities exist between the RHOMBUS dropped binaries and vbot1. I think the most possibility is that vbot1 evolved from RHOMBUS malware with the following modifications:


 1. The dropper’s persistence mechanism was grafted to its payload. That’s why persistence items could be found in vbot1 configuration but not in the above figure.
 2. The register template was updated.
 3. c2 communications were moved to the so called main_c2_handler() function.


Other key points about RHOMBUS malware include:


 1. The register message template is "jm:_:%d" or jm:%s:%d.
 2. Similar to many Gafgyt variants, C2 communications were done in main().
 3. The Gafgyt characteristic function initConnection() was removed with its code broken down into snippets that can be found in main().



Conclusion


I have introduced a short lived Gafgyt variant vbot. During its 2 month life, 31 campaigns were seen to build 19 botnets. From vbot we can learn that it’s easy for Linux IoT botnet authors to quickly write new variants, which might be due to the fact that dozens of Gafgyt and Mirai source has been leaked online. Once a new variant is written, the behind operators usually will spread it over and over with different campaigns to build multiple botnets. Such patterns have also been observed in other variants and families, e.g., Mirai. To fight such sort of fast emerging while short living botnets, automatic IoC extraction would play an import role for quick blocking or tracking. In VB2020 conference to be held in October, I will give a talk on that topic. I hope it will help you fight against Gafgyt botnets better.



IoC



download servers


104.244.75.12
142.11.194.209
185.172.110.248
185.172.110.249
185.225.19.200
192.119.66.66
192.129.188.98
205.185.123.101
23.254.164.76
45.84.196.148
50.115.173.131
85.92.108.211




vbot1 MD5


2a141cd2930536f74f51fb57adbb0236
8717baf17660d8e96813ccd99f32c0be
cc559b487e1ec18727f37006bd3395e0
f666c3398601cd1b017f8d4556cabbbc
6fb6aaa253c165636ee63a4fdcdb1b9e
f422707ac869240bfeea648b6f9b90ad
36997fd129a5ff09311da94c3814379c
790ae71c097662bf6efba92d2d633076
e420df68941cc7ce2d8dd4ba92fd360e
3e36440871a6e39ee87e6d7d1a42155a
ae50829a02e5265c590f2fff35e64c52
09ab7435c76df627a813fb75db15ce5d
43ee98318945a475b555045aed4f0e01
e4db8addb5123021e358576157e5e1c0
4147fb0fe442173558f86fe37728ecae
846d6ad9ea86e331f2e071eac6a269de
40b1bf1e415ae508f8a5b831c2f4e994
f696375452d08eecbde14d64c74acdde
98b07b087b98b8d679c9938b16ae4df3
aea960687f0e43b465198be7ffafcf82
3d596d37fe6536a2c759923d920f3e08
52c462f3b22646774219f91bfb44ae66
d2c273e758fd4ac2759ca1d63aafcf6c
bbee73ed05730ad95df7a77241207ea5
0f492673eb249fa1209512575040f62d
0e59d4a40bba390314ffa0713b18441c




vbot1 C2


185.225.19.200 -port 2017




vbot2 MD5


efabd7e734490b9ad12812982347f237
614581bba324c3550a18268a8cb9c221
86310b514c55d31db288a2bb2c1e6114
76d9c69036f1eaac8f7a90eba3a36bfc
e36d96a74236038a348cfd667ca83528
d45da804fd35cf502bf942ebfeb64064
90a633f30bdbb2b80642bb229d1605d1
c4391301645cc9df4da3657f4c88f7dc
8bef47e420d0cdf8d0ee69a5d1f5b74c
4c8cdcbaf16f39a461b0bf7052fe1ec3
d936a9226fbbe97993bbe604c8cd5458
125b99cc79808679a7461f1841fd80a5
3b7da3d39db6ec08373c1e4af79aff85
23f764f5f918746b9ffff952dd25cc21
6f24268273573fd5f07cacb00031f1a0
ecae928b4e4093489bd221986da39aba
d883d5a2bedf0c3a3da79358c06fa429
3e26626d4563f3199fde498d0ff9fe32
11c1d777b18ffc0f23d2435fdb4645dc
...




vbot2 C2


104.244.75.12_666
142.11.194.209_1337
142.11.194.209_17911
142.11.194.209_34
142.11.194.209_44
184.172.110.248_666
184.172.110.249_666
185.172.110.248_323
185.172.110.248_666
185.225.19.200_666
192.119.66.66_7331
192.129.188.98_323
205.185.123.101_666
23.254.164.76_107
23.254.164.76_33
23.254.164.76_89
45.84.196.148_1227
50.115.173.131_111
85.92.108.211_1447


{"version":"0.3.1","atoms":[],"cards":[["markdown",{"markdown":"## Overview\nGafgyt botnets have a long history of infecting Linux devices to launch DDoS attacks. While dozens of variants have been detected, new variants are constantly emerging with changes in terms of register message, exploits, and attacking methods. On the other hand, their new botnets are usually short lived, with most of the C2s watched keeping active for only a few days. In this blog, I will introduce such a sort of variant. The key findings are as follow:\n1. This variant was active from mid-April to mid-June. In total 31 campaigns for this variant were detected, from which 572 samples were captured. They were spread to build 19 botnets.\n2. This variant evolved through 2 versions. Both have a characteristic register message template “ver:%f:%s:%d” that includes a rarely seen format specifier “%f”. \n3. Mirai code was heavily used in both versions, which makes it possible analyze them with the extracted Mirai configurations.\n4. The same infrastructures, e.g., download servers, and filenames were observed being used in other families of botnet campaigns.\nThis variant was named as vbot because vbot is found being used in an unstripped sample by the author. Accordingly the 2 versions are named as vbot1 and vbot2 in this blog.\n## vbot1\nOnly 1 vbot1 campaign was seen, with 26 samples captured, as shown by the following honeypot records. \n\n![fig1](__GHOST_URL__/content/images/2020/07/fig1.png)\n\nAll samples share the same C2 `185.225.19.200:2017`. Since in Gafgyt it’s common that the same source code will be compiled into binaries for different processor architectures, for simplicity, the following analysis is based on the unstripped ARM sample of ```f696375452d08eecbde14d64c74acdde```. Compared with previous variants, vbot1 has a more concise main() function because most of its code was moved into 2 new functions named init_vbot() and main_c2_handler().\n![fig3](__GHOST_URL__/content/images/2020/07/fig3.png)\nThe function name init_vbot indicates that the author code named their botnet as vbot. It's responsible for initializing things including watchdog, configurations, and scanner. C2 communications are done in main_c2_handler(), where a loop of connection, registration and receiving command can be found, as shown below.\n\n![fig4](__GHOST_URL__/content/images/2020/07/fig4.png)\n\nThe characteristic register message template `“ver:%f:%s:%d”` is used in the registration block that tightly follows the connection block. From the unstripped symbols we can show that the 3 specifiers separately represent version, bot type and arch. The analyzed sample has version of 4.1.\nActually it’s just the rarely seen specifier `“%f”` that caused my attention to this variant because as far as I knew “%f” was not supported by Gafgyt. The original authors borrowed the design of C library functions `printf` and `sprintf`, and implemented a new function named `sockprintf` which can generate message according to the assigned string format and send it to the C2. A custom yet simple format controls is done inside sockprintf with “%f” not implemented. That function has been kept by most Gafgyt variants. When firstly encountering vbot’s register template, I imagined a new version of sockprintf. However, that’s obviously not true. To reuse sockprintf but avoid complex programming, vbot author turned to sprintf to generate the expected message then passed it to sockprintf with the supported specifier `“%s”`.\nSimilar to many Gafgyt variants, Mirai code can be found in vbot1. Due to its tight connection with the encrypted configurations, the borrowed code can be well analyzed with the extracted configurations. If you don’t know how to extract, please go to our VB2018 [paper](https://www.virusbulletin.com/uploads/pdf/magazine/2018/VB2018-Liu-Wang.pdf). The extracted configurations are shown below, with items annotated with its owner modules.  \n![fig5](__GHOST_URL__/content/images/2020/07/fig5.png)\nThe commands are hidden in configurations. Except for attacking methods, vbot1 also supports remote update with the command `UPDATE`. Another worth mentioning feature is persistence mechanism, which is done by modifying crontab.\n\nIt’s strange that vbot1 was spread only once. After its campaign was firstly detected, 35 hours, or 1.5 days, later the first vbot2 campaign was seen from the same download server. Obviously the operators wanted to replace vbot1 with vbot2. The reason might be its buggy registration which always sends a 191-byte register message back to its C2 but only 18 bytes there are really useful, as shown by the following figure. \n\n![fig2](__GHOST_URL__/content/images/2020/07/fig2.png)\n\n## vbot2\nIn total 30 vbot2 campaigns were seen from April 16 to June 12, 2020, with 546 samples captured from 12 download servers. From those samples 13 C2 servers were checked. Detailed analysis shows except the registration code, vbot2 actually differs a lot from vbot1 in terms of code structure, attacking methods and Mirai configuration. The following analysis is based on the x86 sample ```f5b0ebebc924e69e34a4ddd145916594```. It’s stripped but key function names have been manually restored.\nDifferent from vbot1 but similar to many other variants, vbot2's C2 communications are done in main(), as shown below. \n\n![fig6](__GHOST_URL__/content/images/2020/07/fig6.png)\n\nNearly the same registration block as vbot1 can be found, with the 3 specifiers holding the same semantics. The analyzed sample has version of 1.5. The loop composed of “loc_804B80B -> REGISTRATION -> loc_804B863” is very similar to previous Gafgyt variants in terms of CFG node number and semantics. The blocks are separately responsible for establishing connection, registration, and receiving commands. \n5 attacking methods were checked. All of them have been seen in other variants. \n\n![fig7](__GHOST_URL__/content/images/2020/07/fig7.png)\n\nSome vbot2 samples, e.g., ```e36d96a74236038a348cfd667ca83528```, have slightly different attacking method names, as shown below.\n\n![fig8](__GHOST_URL__/content/images/2020/07/fig8.png)\n\n2 Mirai configurations were found. The only difference lies in the 0x28 item, as shown by the following 2 figures.\n\n![fig9-1](__GHOST_URL__/content/images/2020/07/fig9-1.png)\n![fig10](__GHOST_URL__/content/images/2020/07/fig10.png)\n\nFrom the annotations we can see the Mirai code was mainly used in modules of watchdog, killer, scanner and rand alpha string generation. Since the 0x28 item corresponds to a message to be written to the STDOUT, and the second unprintable 0x28 item is probably caused by a typo from the author. \nWith the extracted configurations the differences from vbot1 are obvious. They are:\n1. vbot2 has different attacking methods from vbot1. \n2. While vbot1 hides commands in its configuration, vbot2 directly uses them.\n3. No remote update and persistence mechanism were found in vbot2.\n\nAlthough those great differences suggest that vbot1 and vbot2 were actually derived from different code bases, I still think they were written by the same author(s) because:\n1. The shared register message template and registration implementation are unique enough.\n2. The first vbot2 campaign shared the same download and C2 server as vbot1 within a relatively short period of time (1.5 days).\n\n## vbot and the RHOMBUS malware\nWhile the filename RHOMBUS was seen 4 times in vbot campaigns, its use in Gafgyt campaigns was much earlier[[1]]( https://twitter.com/_odisseus/status/1232957932121313281), with the variant called RHOMBUS analysed in [[2]](https://old.reddit.com/r/LinuxMalware/comments/fh3zar/memo_rhombus_an_elf_bot_installerdropper/)[[3]](https://blog.apnic.net/2020/05/22/rhombus-a-new-iot-malware/). Here I make a simple comparison. In the blogged RHOMBUS malware dropper mechanism was found, with the dropper having the persistence ability across restart by modifying crontab. The dropped binaries, e.g., ```269029c1554b13c3eccfaacf0196ff72``` and ```ba42665872ea41e3d2edd8978bc38c24```, actually belong to another Gafgyt variant that also heavily borrowed code from Mirai, as shown by the below figure. \n![fig11](__GHOST_URL__/content/images/2020/07/fig11.png)\nFrom the above configuration we can see that obvious similarities exist between the RHOMBUS dropped binaries and vbot1. I think the most possibility is that vbot1 evolved from RHOMBUS malware with the following modifications:\n1. The dropper’s persistence mechanism was grafted to its payload. That’s why persistence items could be found in vbot1 configuration but not in the above figure.\n2. The register template was updated.\n3. c2 communications were moved to the so called main_c2_handler() function.\n\nOther key points about RHOMBUS malware include:\n1. The register message template is \"jm:_:%d\" or jm:%s:%d.\n2. Similar to many Gafgyt variants, C2 communications were done in main().\n3. The Gafgyt characteristic function initConnection() was removed with its code broken down into snippets that can be found in main().\n\n## Conclusion\nI have introduced a short lived Gafgyt variant vbot. During its 2 month life, 31 campaigns were seen to build 19 botnets. From vbot we can learn that it’s easy for Linux IoT botnet authors to quickly write new variants, which might be due to the fact that dozens of Gafgyt and Mirai source has been leaked online. Once a new variant is written, the behind operators usually will spread it over and over with different campaigns to build multiple botnets. Such patterns have also been observed in other variants and families, e.g., Mirai. To fight such sort of fast emerging while short living botnets, automatic IoC extraction would play an import role for quick blocking or tracking. In VB2020 conference to be held in October, I will give a [talk](https://www.virusbulletin.com/conference/vb2020/abstracts/lightweight-emulation-based-ioc-extraction-gafgyt-botnets) on that topic. I hope it will help you fight against Gafgyt botnets better.\n\n## IoC\n### download servers\n```\n104.244.75.12\n142.11.194.209\n185.172.110.248\n185.172.110.249\n185.225.19.200\n192.119.66.66\n192.129.188.98\n205.185.123.101\n23.254.164.76\n45.84.196.148\n50.115.173.131\n85.92.108.211\n```\n\n### vbot1 MD5 \n```\n2a141cd2930536f74f51fb57adbb0236\n8717baf17660d8e96813ccd99f32c0be\ncc559b487e1ec18727f37006bd3395e0\nf666c3398601cd1b017f8d4556cabbbc\n6fb6aaa253c165636ee63a4fdcdb1b9e\nf422707ac869240bfeea648b6f9b90ad\n36997fd129a5ff09311da94c3814379c\n790ae71c097662bf6efba92d2d633076\ne420df68941cc7ce2d8dd4ba92fd360e\n3e36440871a6e39ee87e6d7d1a42155a\nae50829a02e5265c590f2fff35e64c52\n09ab7435c76df627a813fb75db15ce5d\n43ee98318945a475b555045aed4f0e01\ne4db8addb5123021e358576157e5e1c0\n4147fb0fe442173558f86fe37728ecae\n846d6ad9ea86e331f2e071eac6a269de\n40b1bf1e415ae508f8a5b831c2f4e994\nf696375452d08eecbde14d64c74acdde\n98b07b087b98b8d679c9938b16ae4df3\naea960687f0e43b465198be7ffafcf82\n3d596d37fe6536a2c759923d920f3e08\n52c462f3b22646774219f91bfb44ae66\nd2c273e758fd4ac2759ca1d63aafcf6c\nbbee73ed05730ad95df7a77241207ea5\n0f492673eb249fa1209512575040f62d\n0e59d4a40bba390314ffa0713b18441c\n```\n\n### vbot1 C2\n```\n185.225.19.200 -port 2017\n```\n\n### vbot2 MD5\n```\nefabd7e734490b9ad12812982347f237\n614581bba324c3550a18268a8cb9c221\n86310b514c55d31db288a2bb2c1e6114\n76d9c69036f1eaac8f7a90eba3a36bfc\ne36d96a74236038a348cfd667ca83528\nd45da804fd35cf502bf942ebfeb64064\n90a633f30bdbb2b80642bb229d1605d1\nc4391301645cc9df4da3657f4c88f7dc\n8bef47e420d0cdf8d0ee69a5d1f5b74c\n4c8cdcbaf16f39a461b0bf7052fe1ec3\nd936a9226fbbe97993bbe604c8cd5458\n125b99cc79808679a7461f1841fd80a5\n3b7da3d39db6ec08373c1e4af79aff85\n23f764f5f918746b9ffff952dd25cc21\n6f24268273573fd5f07cacb00031f1a0\necae928b4e4093489bd221986da39aba\nd883d5a2bedf0c3a3da79358c06fa429\n3e26626d4563f3199fde498d0ff9fe32\n11c1d777b18ffc0f23d2435fdb4645dc\n...\n```\n\n### vbot2 C2\n```\n104.244.75.12_666\n142.11.194.209_1337\n142.11.194.209_17911\n142.11.194.209_34\n142.11.194.209_44\n184.172.110.248_666\n184.172.110.249_666\n185.172.110.248_323\n185.172.110.248_666\n185.225.19.200_666\n192.119.66.66_7331\n192.129.188.98_323\n205.185.123.101_666\n23.254.164.76_107\n23.254.164.76_33\n23.254.164.76_89\n45.84.196.148_1227\n50.115.173.131_111\n85.92.108.211_1447\n```\n\n\n"}]],"markups":[],"sections":[[10,0],[1,"p",[]]],"ghostVersion":"3.0"}