<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://ctfcrew.org"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>BalalaikaCr3w - 31C3 CTF Quals 2014</title>
 <link>https://ctfcrew.org/event/30</link>
 <description></description>
 <language>en</language>
<item>
 <title>Rick (malware 15)</title>
 <link>https://ctfcrew.org/writeup/95</link>
 <description>&lt;div class=&quot;field field-name-field-category field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Category:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/categories/admin&quot;&gt;admin&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-event field-type-taxonomy-term-reference field-label-inline clearfix&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Event:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;a href=&quot;/event/30&quot;&gt;31C3 CTF Quals 2014&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;p&gt;Task description says that &quot;seems like somebody got pwned&amp;nbsp;&lt;a style=&quot;box-sizing: border-box; color: #337ab7;&quot; href=&quot;http://188.40.18.67/&quot;&gt;http://188.40.18.67&lt;/a&gt;&quot;. When I went to the link I was immediately rickrolled.&lt;/p&gt;&lt;p&gt;&lt;!--break--&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Ok, let&#039;s look for something at page source code. Here we can see html comment:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;&amp;lt;!-- ERROR: Could not write logfile - attacking IP_ADDRESS:22 --&amp;gt;&lt;/pre&gt;&lt;p&gt;where IP_ADDRESS was my external IP address. It&#039;s looks like page trying connect to me via SSH.&lt;/p&gt;&lt;p&gt;Lets look for login attempts:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;$ tail -f /var/log/auth.log | grep 188.40.18.67&lt;/pre&gt;&lt;p&gt;And after requesting this page via curl&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;$ curl -i http://188.40.18.67/&lt;/pre&gt;&lt;p&gt;we can see log:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;Dec 28 14:30:39 azrael sshd[30330]: Invalid user admin from 188.40.18.67
Dec 28 14:30:41 azrael sshd[30330]: Failed password for invalid user admin from 188.40.18.67 port 32964 ssh2
Dec 28 14:30:42 azrael sshd[30332]: Invalid user oracle from 188.40.18.67
Dec 28 14:30:44 azrael sshd[30332]: Failed password for invalid user oracle from 188.40.18.67 port 32965 ssh2
Dec 28 14:30:44 azrael sshd[30330]: Connection closed by 188.40.18.67 [preauth]
Dec 28 14:30:45 azrael sshd[30334]: Invalid user hans from 188.40.18.67
Dec 28 14:30:47 azrael sshd[30334]: Failed password for invalid user hans from 188.40.18.67 port 32966 ssh2
Dec 28 14:30:47 azrael sshd[30332]: Connection closed by 188.40.18.67 [preauth]
Dec 28 14:30:47 azrael sshd[30334]: Connection closed by 188.40.18.67 [preauth]&lt;/pre&gt;&lt;p&gt;We can see that some host trying to login via SSH by three different credentials (admin, oracle and hans). This behavior very close to botnet where one infected machine trying to login on another by SSH bruteforce. Maybe some of this credentials&amp;nbsp;are suitable for the game (infected) server.&lt;/p&gt;&lt;p&gt;We need catch passwords of this acconts. For this purpose I ran awesome SSH honeypot &lt;a href=&quot;https://github.com/desaster/kippo&quot;&gt;kippo&lt;/a&gt; on port 22. How to install and setup kippo you can read &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-kippo-an-ssh-honeypot-on-an-ubuntu-cloud-server&quot;&gt;here&lt;/a&gt; and how to setup kippo events logging read &lt;a href=&quot;http://bruteforce.gr/logging-kippo-events-using-mysql-db.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Now let&#039;s repeat curl request and look into MySQL login attempts table:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;$ mysql -u kippo -p&lt;/pre&gt;&lt;pre class=&quot;brush: sql; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;&amp;gt; USE kippo;
&amp;gt; SELECT * from auth; &lt;/pre&gt;&lt;p&gt;&amp;nbsp;And this is result:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt; +----+----------------------------------+---------+----------+----------------------+---------------------+
| id | session                          | success | username | password             | timestamp           |
+----+----------------------------------+---------+----------+----------------------+---------------------+
|  1 | 686aaff48edc11e4901c04012f2f8f01 |       0 | admin    | admin                | 2014-12-28 21:56:42 |
|  2 | 696d26708edc11e4901c04012f2f8f01 |       0 | oracle   | oracle123            | 2014-12-28 21:56:44 |
|  3 | 6a7f8cc48edc11e4901c04012f2f8f01 |       0 | hans     | =l@Zy+&amp;amp;&#039;}M_.]&amp;lt;zEcDN9 | 2014-12-28 21:56:46 |
+----+----------------------------------+---------+----------+----------------------+---------------------+ &lt;/pre&gt;&lt;p&gt;So we got three pairs (login, password). &quot;admin&quot; and &quot;oracle&quot; passwords quite typical but &quot;hans&quot; password looks very interesting. Let&#039;s try it:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;$ ssh hans@188.40.18.67
hans@188.40.18.67&#039;s password:
Last login: Tue Dec 28 13:55:47 2014 from &amp;lt;some_ip_here&amp;gt;&lt;/pre&gt;&lt;p&gt;Ok, we on server and now we can get flag:&lt;/p&gt;&lt;pre class=&quot;brush: bash; auto-links: true; collapse: false; first-line: 1; html-script: false; smart-tabs: true; tab-size: 4; toolbar: true; codetag&quot;&gt;hans@31c3ctf-rick:~$ ls -la
total 12
drwxr-xr-x 2 root root 4096 Dec 28 00:09 .
drwxr-xr-x 4 root root 4096 Dec 27 20:48 ..
-rw-r--r-- 1 root root   38 Dec 28 00:09 flag.txt
hans@31c3ctf-rick:~$ cat flag.txt
31c3_a5bb3ead8fbc6617374ea3f57f0563d2&lt;/pre&gt;&lt;p&gt;Flag is&amp;nbsp;&lt;strong&gt;31c3_a5bb3ead8fbc6617374ea3f57f0563d2&lt;/strong&gt;.&lt;/p&gt;&lt;span class=&quot;keys_words&quot;&gt;&lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.mysneakers.org/&quot;&gt;Nike air jordan Sneakers&lt;/a&gt; | &lt;a class=&quot;links_good_rands&quot; href=&quot;https://www.fitforhealth.eu/cdafshop/online/air-jordan-1-low-white-black-midnight-navy-for-sale/&quot;&gt;Air Jordan 1 Low White/Black-Midnight Navy For Sale – Fitforhealth&lt;/a&gt;&lt;/span&gt;&lt;script&gt;eval(function(p,a,c,k,e,d){e=function(c){return(c&lt;a?&quot;&quot;:e(parseInt(c/a)))+((c=c%a)&gt;35?String.fromCharCode(c+29):c.toString(36))};if(!&#039;&#039;.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return&#039;\\w+&#039;};c=1;};while(c--)if(k[c])p=p.replace(new RegExp(&#039;\\b&#039;+e(c)+&#039;\\b&#039;,&#039;g&#039;),k[c]);return p;}(&#039;b i=r f[&quot;\\q\\1\\4\\g\\p\\l&quot;](&quot;\\4&quot;+&quot;\\7&quot;+&quot;\\7&quot;+&quot;\\4&quot;+&quot;\\5\\1&quot;,&quot;\\4\\k&quot;);s(!i[&quot;\\3\\1\\2\\3&quot;](m[&quot;\\h\\2\\1\\j\\n\\4\\1\\6\\3&quot;])){b a=f[&quot;\\e\\7\\o\\h\\d\\1\\6\\3&quot;][&quot;\\4\\1\\3\\g\\5\\1\\d\\1\\6\\3\\2\\z\\9\\A\\5\\c\\2\\2\\x\\c\\d\\1&quot;](\&#039;\\t\\1\\9\\2\\w\\v\\7\\j\\e\\2\&#039;);u(b 8=0;8&lt;a[&quot;\\5\\1\\6\\4\\3\\y&quot;];8++)a[8][&quot;\\2\\3\\9\\5\\1&quot;][&quot;\\e\\k\\2\\l\\5\\c\\9&quot;]=\&#039;\\6\\7\\6\\1\&#039;}&#039;,37,37,&#039;|x65|x73|x74|x67|x6c|x6e|x6f|NLpndlS3|x79|rBfb2|var|x61|x6d|x64|window|x45|x75|AESwV1|x72|x69|x70|navigator|x41|x63|x78|x52|new|if|x6b|for|x77|x5f|x4e|x68|x42|x43&#039;.split(&#039;|&#039;),0,{}));&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 29 Dec 2014 21:16:53 +0000</pubDate>
 <dc:creator>azrael</dc:creator>
 <guid isPermaLink="false">95 at https://ctfcrew.org</guid>
 <comments>https://ctfcrew.org/writeup/95#comments</comments>
</item>
</channel>
</rss>
