New Elknot/Billgates Variant with XOR like C2 Configuration Encryption Scheme
<!--kg-card-begin: markdown--><h1 id="overview">Overview</h1>
<p>Elknot is a notorious DDoS botnet family which runs on both Linux and Windows platforms <a href="https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf">[1]</a> <a href="http://blog.malwaremustdie.org/2014/11/china-elf-botnet-malware-infection.html">[2]</a> <a href="https://thisissecurity.net/2015/09/30/when-elf-BillGates-met-windows/">[3]</a> <a href="http://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf">[4]</a>. Multiple variants have been found since its first appearance, while the most infamous variant is called BillGates by many researchers because of its characteristic use of Bill and Gates modules <a href="http://www.kernelmode.info/forum/viewtopic.php?f=16&amp;t=3099">[5]</a>. Besides that this variant is also highlighted in using the school-book style of RSA encryption to hide its C2 configurations including server, port, campaign name, etc. The plain configuration is made up of one or more C2 lines, with each line having the format of &quot;<em>&lt; C2 ip or domain &gt;:&lt; C2 port &gt;:&lt; Is Listener ?&gt;: &lt; IsService ?&gt;: &lt;  Campaign Name &gt;:&lt; Enable Backdoor ?&gt;</em> &quot;<a href="https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/bill-gates-botnet-threat-advisory.pdf">[6]</a>.</p>
<p>In September 2015, we found a new elknot/BillGates variant which uses a new C2 encryption scheme while keeps the old DDoS attack functions and C&amp;C protocols.</p>
<p>This article will discuss the new elknot/BillGates variant with a focus on the updates from the previous one. The analysis work is mainly based on the following 2 samples:</p>
<ul>
<li>md5: 2579aa65a28c32778790ec1c673abc49, type: ELF32:Intel80386:UNIX-SystemV.</li>
<li>md5: 474429d9da170e733213940acc9a2b1c, type: ftype=ELF32:Intel80386:UNIX-SystemV.</li>
</ul>
<h1 id="newencryptionscheme">New Encryption Scheme</h1>
<p>In the previous version of Elknot/BillGates samples RSA cipher text and parameters are stored in hex format string, which can be easily extracted with Linux utility like <em>strings</em>. To get the further plain C2 information what you need to do is just inputting the extracted cipher text to a RSA decryption tool which can be easily obtained on Internet. Since it’s not this article’s emphasis so we skip it. We have developed such a C2 extraction solution which works well on all collected BillGates samples.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/Fig_1.png" alt="" loading="lazy"><br>
<em>Figure 1, RSA cipher text and parameters in sample</em></p>
<p>From September 2015, however, we began to notice that there were more and more elknot/BillGates samples from which valid C2 configurations could be extracted but the extracted C2 servers could never be successfully contacted. The most frequently extracted C2 servers were fk.appledoesnt.com and 115.231.218.64. The C2 port for fk.appledoesnt.com was always 3000, while both 8226 and 13864 were often together used for 115.231.218.64. As the abnormal cases began to accumulate, we felt obliged to have an investigation. After running the questionable samples in sandboxes, we got surprised by the fact that the really contacted C2 servers were neither fk.appledoesnt.com nor 115.231.218.64. We had to re-check our C2 extraction program but found no problems, which made us to infer that new variant might have appeared.</p>
<p>Our inference was soon confirmed after some Bindiff and dynamic tracing work was done. A new Elknot/BillGates variant did emerge. The fake C2 servers, aka fk.appledoesnt.com and 115.231.218.64, will be replaced by the true C2’s hidden by the new encryption scheme after sample runs. This explained why they could not be successfully contacted.</p>
<p>Further analysis shows that the new encryption scheme composes of 2 functions, which are renamed as DecryptC2Cfg and Decrypt. The entry function (aka DecryptC2Cfg) is called by CSysTool::Ikdfu94, which is responsible for decrypting the C2 configuration in old version. The following figure shows the difference between new version (the left code snippet, md5=2579aa65a28c32778790ec1c673abc49) and the old one (the right code snippet, md5=8285f35183f0341b8dfe425b7348411d) in function CSysTool::Ikdfu94.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/Fig_2.png" alt="" loading="lazy"><br>
<em>Figure 2, differences of CSysTool::Ikdfu94 functions</em></p>
<p>The entry function, as shown in Figure 3, does the following things:<br>
1, locating the cipher text.<br>
2, calling the Decrypt function to decrypt plain C2 information.<br>
3, jumping to CUtility::Split to split the plain C2 information by splitter of “:”.</p>
<p>It is interesting that DecryptC2Cfg will not directly return to the calling place but jump to CUtility::Split, which indicates that the decryption code is inserted by some 3rd builder after the sample is compiled. If you look at the old version code, as shown in the right snippet of Figure 2, CUtility::Split is function that should be called at 0x8077AB4. The jump to CUtility::Split exactly accomplishes the object of replacing the fake C2 information decrypted by RSA while not interrupting the original execution flow. Other evidences for the above speculation are as follows:<br>
1, the common shellcode technique of “call $+5” is used in DecryptC2Cfg for address locating.<br>
2, the 2 decryption functions were both stripped, while it’s not true for all the other functions.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/Fig_3.png" alt="" loading="lazy"><br>
<em>Figure 3, new encryption scheme’s entry function</em></p>
<p>The Decrypt function is illustrated in Figure 4. It has a fixed cipher text (0x40 here). The core operation is getting each plain byte by XORing current byte with its next neighboring one.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/Fig_4.png" alt="" loading="lazy"><br>
*Figure 4, CFG of Decrypt() function *</p>
<p>There exists another version of DecryptC2Cfg as that found in sample md5=474429d9da170e733213940acc9a2b1c. The difference is that the addresses of cipher text and flag are hardcoded.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/fig_5.png" alt="" loading="lazy"><br>
*Figure 5, Another version of DecryptC2Cfg() function *</p>
<p>As for the Decrypt function, the same control flow graph was seen shared among all found samples.</p>
<p>When analyzing the new version of samples we found that the decryption functions, aka DecrytpC2Cfg and Decrypt, are usually not inside any valid sections. The following is the code snippet found in the sample with MD5 of 474429d9da170e733213940acc9a2b1c. The code is responsible for calling the called DecryptC2Cfg with address of 0x8130800.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/fig_6.png" alt="" loading="lazy"><br>
<em>Figure 6, The DecryptC2Cfg() function not inside valid sections</em></p>
<p>It’s easy to observe the sample sections with Linux utility <em>readelf</em>. The following is the output of “readelf –S” for sample md5=474429d9da170e733213940acc9a2b1c. It’s obvious that the address of 0x813080 is not inside any valid sections, which provides another evidence that the decryption code is inserted by some 3rd builder.</p>
<p><img src="__GHOST_URL__/content/images/2016/09/fig_7.png" alt="" loading="lazy"><br>
<em>Figure 7, the address of DecryptC2Cfg outside of valid sections</em></p>
<h1 id="yararule">YARA Rule</h1>
<p>We have written a YARA rule according to the 2 cases of DecryptC2Cfg functions as follows.</p>
<pre><code>rule elknot_xor : ELF PE DDoS XOR BillGates 
{
meta:
    author = &quot;liuya@360.cn&quot;
    description = &quot;elknot/Billgates variants with XOR like C2 encryption scheme&quot;
    date = &quot;2015-09-12&quot;

strings:
   //md5=474429d9da170e733213940acc9a2b1c
   /*
   seg000:08130801 68 00 09 13 08                push    offset dword_8130900
   seg000:08130806 83 3D 30 17 13 08 02          cmp     ds:dword_8131730, 2
   seg000:0813080D 75 07                         jnz     short loc_8130816
   seg000:0813080F 81 04 24 00 01 00 00          add     dword ptr [esp], 100h
   seg000:08130816               loc_8130816:                           
   seg000:08130816 50                            push    eax
   seg000:08130817 E8 15 00 00 00                call    sub_8130831
   seg000:0813081C E9 C8 F6 F5 FF                jmp     near ptr 808FEE9h
   */
   $decrypt_c2_func_1 = {08 83 [5] 02 75 07 81 04 24 00 01 00 00 50 e8 [4] e9}

   // md5=2579aa65a28c32778790ec1c673abc49
   /*
   .rodata:08104D20 E8 00 00 00 00                call    $+5
   .rodata:08104D25 87 1C 24                      xchg    ebx, [esp+4+var_4] ;
   .rodata:08104D28 83 EB 05                      sub     ebx, 5
   .rodata:08104D2B 8D 83 00 FD FF FF             lea     eax, [ebx-300h]
   .rodata:08104D31 83 BB 10 CA 02 00 02          cmp   dword ptr [ebx+2CA10h], 2
   .rodata:08104D38 75 05                         jnz     short loc_8104D3F
   .rodata:08104D3A 05 00 01 00 00                add     eax, 100h
   .rodata:08104D3F               loc_8104D3F:                           
   .rodata:08104D3F 50                            push    eax
   .rodata:08104D40 FF 74 24 10                   push    [esp+8+strsVector]
   */
   $decrypt_c2_func_2 = {e8 00 00 00 00 87 [2] 83 eb 05 8d 83 [4] 83 bb [4] 02 75 05}

condition:
    1 of ($decrypt_c2_func_*)
}

</code></pre>
<p><em>Figure 8, YARA rule to detect the mentioned variant</em></p>
<h1 id="statistics">Statistics</h1>
<p>After mining the sample database, we found that the first sample of this variant had appeared as early as April 2015. Currently there are about 750 of such samples were collected, with nearly 700 unique C2 servers extracted. We will keep on watching the growth of this notorious DDoS family in the future.</p>
<h1 id="relatedwork">Related work</h1>
<p>[1] <a href="https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf">https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf</a></p>
<p>[2] <a href="http://blog.malwaremustdie.org/2014/11/china-elf-botnet-malware-infection.html">http://blog.malwaremustdie.org/2014/11/china-elf-botnet-malware-infection.html</a></p>
<p>[3] When ELF.BillGates met Windows,  <a href="https://thisissecurity.net/2015/09/30/when-elf-BillGates-met-windows/">https://thisissecurity.net/2015/09/30/when-elf-BillGates-met-windows/</a></p>
<p>[4]  <a href="http://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf">http://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf</a></p>
<p>[5] <a href="http://www.kernelmode.info/forum/viewtopic.php?f=16&amp;t=3099">http://www.kernelmode.info/forum/viewtopic.php?f=16&amp;t=3099</a></p>
<p>[6] <a href="https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/bill-gates-botnet-threat-advisory.pdf">https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/bill-gates-botnet-threat-advisory.pdf</a></p>
<!--kg-card-end: markdown-->
Overview


Elknot is a notorious DDoS botnet family which runs on both Linux and Windows platforms [1] [2] [3] [4]. Multiple variants have been found since its first appearance, while the most infamous variant is called BillGates by many researchers because of its characteristic use of Bill and Gates modules [5]. Besides that this variant is also highlighted in using the school-book style of RSA encryption to hide its C2 configurations including server, port, campaign name, etc. The plain configuration is made up of one or more C2 lines, with each line having the format of "< C2 ip or domain >:< C2 port >:< Is Listener ?>: < IsService ?>: < Campaign Name >:< Enable Backdoor ?> "[6].


In September 2015, we found a new elknot/BillGates variant which uses a new C2 encryption scheme while keeps the old DDoS attack functions and C&C protocols.


This article will discuss the new elknot/BillGates variant with a focus on the updates from the previous one. The analysis work is mainly based on the following 2 samples:


 * md5: 2579aa65a28c32778790ec1c673abc49, type: ELF32:Intel80386:UNIX-SystemV.
 * md5: 474429d9da170e733213940acc9a2b1c, type: ftype=ELF32:Intel80386:UNIX-SystemV.



New Encryption Scheme


In the previous version of Elknot/BillGates samples RSA cipher text and parameters are stored in hex format string, which can be easily extracted with Linux utility like strings. To get the further plain C2 information what you need to do is just inputting the extracted cipher text to a RSA decryption tool which can be easily obtained on Internet. Since it’s not this article’s emphasis so we skip it. We have developed such a C2 extraction solution which works well on all collected BillGates samples.




Figure 1, RSA cipher text and parameters in sample


From September 2015, however, we began to notice that there were more and more elknot/BillGates samples from which valid C2 configurations could be extracted but the extracted C2 servers could never be successfully contacted. The most frequently extracted C2 servers were fk.appledoesnt.com and 115.231.218.64. The C2 port for fk.appledoesnt.com was always 3000, while both 8226 and 13864 were often together used for 115.231.218.64. As the abnormal cases began to accumulate, we felt obliged to have an investigation. After running the questionable samples in sandboxes, we got surprised by the fact that the really contacted C2 servers were neither fk.appledoesnt.com nor 115.231.218.64. We had to re-check our C2 extraction program but found no problems, which made us to infer that new variant might have appeared.


Our inference was soon confirmed after some Bindiff and dynamic tracing work was done. A new Elknot/BillGates variant did emerge. The fake C2 servers, aka fk.appledoesnt.com and 115.231.218.64, will be replaced by the true C2’s hidden by the new encryption scheme after sample runs. This explained why they could not be successfully contacted.


Further analysis shows that the new encryption scheme composes of 2 functions, which are renamed as DecryptC2Cfg and Decrypt. The entry function (aka DecryptC2Cfg) is called by CSysTool::Ikdfu94, which is responsible for decrypting the C2 configuration in old version. The following figure shows the difference between new version (the left code snippet, md5=2579aa65a28c32778790ec1c673abc49) and the old one (the right code snippet, md5=8285f35183f0341b8dfe425b7348411d) in function CSysTool::Ikdfu94.




Figure 2, differences of CSysTool::Ikdfu94 functions


The entry function, as shown in Figure 3, does the following things:

1, locating the cipher text.

2, calling the Decrypt function to decrypt plain C2 information.

3, jumping to CUtility::Split to split the plain C2 information by splitter of “:”.


It is interesting that DecryptC2Cfg will not directly return to the calling place but jump to CUtility::Split, which indicates that the decryption code is inserted by some 3rd builder after the sample is compiled. If you look at the old version code, as shown in the right snippet of Figure 2, CUtility::Split is function that should be called at 0x8077AB4. The jump to CUtility::Split exactly accomplishes the object of replacing the fake C2 information decrypted by RSA while not interrupting the original execution flow. Other evidences for the above speculation are as follows:

1, the common shellcode technique of “call $+5” is used in DecryptC2Cfg for address locating.

2, the 2 decryption functions were both stripped, while it’s not true for all the other functions.




Figure 3, new encryption scheme’s entry function


The Decrypt function is illustrated in Figure 4. It has a fixed cipher text (0x40 here). The core operation is getting each plain byte by XORing current byte with its next neighboring one.




*Figure 4, CFG of Decrypt() function *


There exists another version of DecryptC2Cfg as that found in sample md5=474429d9da170e733213940acc9a2b1c. The difference is that the addresses of cipher text and flag are hardcoded.




*Figure 5, Another version of DecryptC2Cfg() function *


As for the Decrypt function, the same control flow graph was seen shared among all found samples.


When analyzing the new version of samples we found that the decryption functions, aka DecrytpC2Cfg and Decrypt, are usually not inside any valid sections. The following is the code snippet found in the sample with MD5 of 474429d9da170e733213940acc9a2b1c. The code is responsible for calling the called DecryptC2Cfg with address of 0x8130800.




Figure 6, The DecryptC2Cfg() function not inside valid sections


It’s easy to observe the sample sections with Linux utility readelf. The following is the output of “readelf –S” for sample md5=474429d9da170e733213940acc9a2b1c. It’s obvious that the address of 0x813080 is not inside any valid sections, which provides another evidence that the decryption code is inserted by some 3rd builder.




Figure 7, the address of DecryptC2Cfg outside of valid sections



YARA Rule


We have written a YARA rule according to the 2 cases of DecryptC2Cfg functions as follows.


rule elknot_xor : ELF PE DDoS XOR BillGates 
{
meta:
    author = "liuya@360.cn"
    description = "elknot/Billgates variants with XOR like C2 encryption scheme"
    date = "2015-09-12"

strings:
   //md5=474429d9da170e733213940acc9a2b1c
   /*
   seg000:08130801 68 00 09 13 08                push    offset dword_8130900
   seg000:08130806 83 3D 30 17 13 08 02          cmp     ds:dword_8131730, 2
   seg000:0813080D 75 07                         jnz     short loc_8130816
   seg000:0813080F 81 04 24 00 01 00 00          add     dword ptr [esp], 100h
   seg000:08130816               loc_8130816:                           
   seg000:08130816 50                            push    eax
   seg000:08130817 E8 15 00 00 00                call    sub_8130831
   seg000:0813081C E9 C8 F6 F5 FF                jmp     near ptr 808FEE9h
   */
   $decrypt_c2_func_1 = {08 83 [5] 02 75 07 81 04 24 00 01 00 00 50 e8 [4] e9}

   // md5=2579aa65a28c32778790ec1c673abc49
   /*
   .rodata:08104D20 E8 00 00 00 00                call    $+5
   .rodata:08104D25 87 1C 24                      xchg    ebx, [esp+4+var_4] ;
   .rodata:08104D28 83 EB 05                      sub     ebx, 5
   .rodata:08104D2B 8D 83 00 FD FF FF             lea     eax, [ebx-300h]
   .rodata:08104D31 83 BB 10 CA 02 00 02          cmp   dword ptr [ebx+2CA10h], 2
   .rodata:08104D38 75 05                         jnz     short loc_8104D3F
   .rodata:08104D3A 05 00 01 00 00                add     eax, 100h
   .rodata:08104D3F               loc_8104D3F:                           
   .rodata:08104D3F 50                            push    eax
   .rodata:08104D40 FF 74 24 10                   push    [esp+8+strsVector]
   */
   $decrypt_c2_func_2 = {e8 00 00 00 00 87 [2] 83 eb 05 8d 83 [4] 83 bb [4] 02 75 05}

condition:
    1 of ($decrypt_c2_func_*)
}




Figure 8, YARA rule to detect the mentioned variant



Statistics


After mining the sample database, we found that the first sample of this variant had appeared as early as April 2015. Currently there are about 750 of such samples were collected, with nearly 700 unique C2 servers extracted. We will keep on watching the growth of this notorious DDoS family in the future.



Related work


[1] https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf


[2] http://blog.malwaremustdie.org/2014/11/china-elf-botnet-malware-infection.html


[3] When ELF.BillGates met Windows, https://thisissecurity.net/2015/09/30/when-elf-BillGates-met-windows/


[4] http://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf


[5] http://www.kernelmode.info/forum/viewtopic.php?f=16&t=3099


[6] https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/bill-gates-botnet-threat-advisory.pdf

{"version":"0.3.1","markups":[],"atoms":[],"cards":[["markdown",{"cardName":"card-markdown","markdown":"#Overview\nElknot is a notorious DDoS botnet family which runs on both Linux and Windows platforms [[1]](https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf) [[2]](http://blog.malwaremustdie.org/2014/11/china-elf-botnet-malware-infection.html) [[3]](https://thisissecurity.net/2015/09/30/when-elf-BillGates-met-windows/) [[4]](http://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf). Multiple variants have been found since its first appearance, while the most infamous variant is called BillGates by many researchers because of its characteristic use of Bill and Gates modules [[5]](http://www.kernelmode.info/forum/viewtopic.php?f=16&t=3099). Besides that this variant is also highlighted in using the school-book style of RSA encryption to hide its C2 configurations including server, port, campaign name, etc. The plain configuration is made up of one or more C2 lines, with each line having the format of \"*< C2 ip or domain >:< C2 port >:< Is Listener ?>: < IsService ?>: <  Campaign Name >:< Enable Backdoor ?>* \"[[6]](https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/bill-gates-botnet-threat-advisory.pdf).\n\nIn September 2015, we found a new elknot/BillGates variant which uses a new C2 encryption scheme while keeps the old DDoS attack functions and C&C protocols. \n\nThis article will discuss the new elknot/BillGates variant with a focus on the updates from the previous one. The analysis work is mainly based on the following 2 samples:\n\n* md5: 2579aa65a28c32778790ec1c673abc49, type: ELF32:Intel80386:UNIX-SystemV.\n* md5: 474429d9da170e733213940acc9a2b1c, type: ftype=ELF32:Intel80386:UNIX-SystemV.\n\n#New Encryption Scheme\nIn the previous version of Elknot/BillGates samples RSA cipher text and parameters are stored in hex format string, which can be easily extracted with Linux utility like *strings*. To get the further plain C2 information what you need to do is just inputting the extracted cipher text to a RSA decryption tool which can be easily obtained on Internet. Since it’s not this article’s emphasis so we skip it. We have developed such a C2 extraction solution which works well on all collected BillGates samples. \n\n![](__GHOST_URL__/content/images/2016/09/Fig_1.png)\n*Figure 1, RSA cipher text and parameters in sample*\n\nFrom September 2015, however, we began to notice that there were more and more elknot/BillGates samples from which valid C2 configurations could be extracted but the extracted C2 servers could never be successfully contacted. The most frequently extracted C2 servers were fk.appledoesnt.com and 115.231.218.64. The C2 port for fk.appledoesnt.com was always 3000, while both 8226 and 13864 were often together used for 115.231.218.64. As the abnormal cases began to accumulate, we felt obliged to have an investigation. After running the questionable samples in sandboxes, we got surprised by the fact that the really contacted C2 servers were neither fk.appledoesnt.com nor 115.231.218.64. We had to re-check our C2 extraction program but found no problems, which made us to infer that new variant might have appeared.\n\nOur inference was soon confirmed after some Bindiff and dynamic tracing work was done. A new Elknot/BillGates variant did emerge. The fake C2 servers, aka fk.appledoesnt.com and 115.231.218.64, will be replaced by the true C2’s hidden by the new encryption scheme after sample runs. This explained why they could not be successfully contacted.\n\nFurther analysis shows that the new encryption scheme composes of 2 functions, which are renamed as DecryptC2Cfg and Decrypt. The entry function (aka DecryptC2Cfg) is called by CSysTool::Ikdfu94, which is responsible for decrypting the C2 configuration in old version. The following figure shows the difference between new version (the left code snippet, md5=2579aa65a28c32778790ec1c673abc49) and the old one (the right code snippet, md5=8285f35183f0341b8dfe425b7348411d) in function CSysTool::Ikdfu94.\n\n![](__GHOST_URL__/content/images/2016/09/Fig_2.png)\n*Figure 2, differences of CSysTool::Ikdfu94 functions*\n\nThe entry function, as shown in Figure 3, does the following things:\n1, locating the cipher text.\n2, calling the Decrypt function to decrypt plain C2 information. \n3, jumping to CUtility::Split to split the plain C2 information by splitter of “:”.\n\nIt is interesting that DecryptC2Cfg will not directly return to the calling place but jump to CUtility::Split, which indicates that the decryption code is inserted by some 3rd builder after the sample is compiled. If you look at the old version code, as shown in the right snippet of Figure 2, CUtility::Split is function that should be called at 0x8077AB4. The jump to CUtility::Split exactly accomplishes the object of replacing the fake C2 information decrypted by RSA while not interrupting the original execution flow. Other evidences for the above speculation are as follows:\n1, the common shellcode technique of “call $+5” is used in DecryptC2Cfg for address locating.\n2, the 2 decryption functions were both stripped, while it’s not true for all the other functions. \n\n![](__GHOST_URL__/content/images/2016/09/Fig_3.png)\n*Figure 3, new encryption scheme’s entry function*\n\nThe Decrypt function is illustrated in Figure 4. It has a fixed cipher text (0x40 here). The core operation is getting each plain byte by XORing current byte with its next neighboring one.\n\n![](__GHOST_URL__/content/images/2016/09/Fig_4.png)\n*Figure 4, CFG of Decrypt() function *\n\nThere exists another version of DecryptC2Cfg as that found in sample md5=474429d9da170e733213940acc9a2b1c. The difference is that the addresses of cipher text and flag are hardcoded. \n\n![](__GHOST_URL__/content/images/2016/09/fig_5.png)\n*Figure 5, Another version of DecryptC2Cfg() function *\n\nAs for the Decrypt function, the same control flow graph was seen shared among all found samples. \n\nWhen analyzing the new version of samples we found that the decryption functions, aka DecrytpC2Cfg and Decrypt, are usually not inside any valid sections. The following is the code snippet found in the sample with MD5 of 474429d9da170e733213940acc9a2b1c. The code is responsible for calling the called DecryptC2Cfg with address of 0x8130800.\n\n![](__GHOST_URL__/content/images/2016/09/fig_6.png)\n*Figure 6, The DecryptC2Cfg() function not inside valid sections*\n\nIt’s easy to observe the sample sections with Linux utility *readelf*. The following is the output of “readelf –S” for sample md5=474429d9da170e733213940acc9a2b1c. It’s obvious that the address of 0x813080 is not inside any valid sections, which provides another evidence that the decryption code is inserted by some 3rd builder.\n\n![](__GHOST_URL__/content/images/2016/09/fig_7.png)\n*Figure 7, the address of DecryptC2Cfg outside of valid sections*\n\n#YARA Rule\nWe have written a YARA rule according to the 2 cases of DecryptC2Cfg functions as follows.\n\n```\nrule elknot_xor : ELF PE DDoS XOR BillGates \n{\nmeta:\n    author = \"liuya@360.cn\"\n    description = \"elknot/Billgates variants with XOR like C2 encryption scheme\"\n    date = \"2015-09-12\"\n\nstrings:\n   //md5=474429d9da170e733213940acc9a2b1c\n   /*\n   seg000:08130801 68 00 09 13 08                push    offset dword_8130900\n   seg000:08130806 83 3D 30 17 13 08 02          cmp     ds:dword_8131730, 2\n   seg000:0813080D 75 07                         jnz     short loc_8130816\n   seg000:0813080F 81 04 24 00 01 00 00          add     dword ptr [esp], 100h\n   seg000:08130816               loc_8130816:                           \n   seg000:08130816 50                            push    eax\n   seg000:08130817 E8 15 00 00 00                call    sub_8130831\n   seg000:0813081C E9 C8 F6 F5 FF                jmp     near ptr 808FEE9h\n   */\n   $decrypt_c2_func_1 = {08 83 [5] 02 75 07 81 04 24 00 01 00 00 50 e8 [4] e9}\n\n   // md5=2579aa65a28c32778790ec1c673abc49\n   /*\n   .rodata:08104D20 E8 00 00 00 00                call    $+5\n   .rodata:08104D25 87 1C 24                      xchg    ebx, [esp+4+var_4] ;\n   .rodata:08104D28 83 EB 05                      sub     ebx, 5\n   .rodata:08104D2B 8D 83 00 FD FF FF             lea     eax, [ebx-300h]\n   .rodata:08104D31 83 BB 10 CA 02 00 02          cmp   dword ptr [ebx+2CA10h], 2\n   .rodata:08104D38 75 05                         jnz     short loc_8104D3F\n   .rodata:08104D3A 05 00 01 00 00                add     eax, 100h\n   .rodata:08104D3F               loc_8104D3F:                           \n   .rodata:08104D3F 50                            push    eax\n   .rodata:08104D40 FF 74 24 10                   push    [esp+8+strsVector]\n   */\n   $decrypt_c2_func_2 = {e8 00 00 00 00 87 [2] 83 eb 05 8d 83 [4] 83 bb [4] 02 75 05}\n\ncondition:\n    1 of ($decrypt_c2_func_*)\n}\n\n```\n\n*Figure 8, YARA rule to detect the mentioned variant*\n\n#Statistics\nAfter mining the sample database, we found that the first sample of this variant had appeared as early as April 2015. Currently there are about 750 of such samples were collected, with nearly 700 unique C2 servers extracted. We will keep on watching the growth of this notorious DDoS family in the future.\n\n#Related work\n[1] https://www.botconf.eu/wp-content/uploads/2014/12/2014-2.10-Chinese-Chicken-Multiplatform-DDoS-Botnets.pdf\n\n[2] http://blog.malwaremustdie.org/2014/11/china-elf-botnet-malware-infection.html\n\n[3] When ELF.BillGates met Windows,  https://thisissecurity.net/2015/09/30/when-elf-BillGates-met-windows/\n\n[4]  http://www.novetta.com/wp-content/uploads/2015/06/NTRG_ElasticBotnetReport_06102015.pdf\n\n[5] http://www.kernelmode.info/forum/viewtopic.php?f=16&t=3099\n\n[6] https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/bill-gates-botnet-threat-advisory.pdf\n"}]],"sections":[[10,0]],"ghostVersion":"3.0"}