<div dir="ltr"><div>Hello,</div><div><br></div><div>The qualifications for Seccon CTF were on December 5 to 6. The top 10 teams and 3 other teams that won 1st place in other competitions will qualify for the finals in Japan on January 31, 2016.</div><div>There were plenty of teams, and we have participated with the team PwnThyBytes.</div><div><br></div><div>1 <span class="" style="white-space:pre">       </span>6323 <span class="" style="white-space:pre">             </span>217</div><div>2 <span class="" style="white-space:pre">      </span>6306 <span class="" style="white-space:pre">             </span>GoatskiN</div><div>3 <span class="" style="white-space:pre"> </span>6302 <span class="" style="white-space:pre">             </span>PPP</div><div>4 <span class="" style="white-space:pre">      </span>5302 <span class="" style="white-space:pre">             </span>m1z0r3</div><div>5 <span class="" style="white-space:pre">   </span>5003 <span class="" style="white-space:pre">             </span>0x0</div><div>6 <span class="" style="white-space:pre">      </span>4800 <span class="" style="white-space:pre">             </span>PwnThyBytes</div><div>7 <span class="" style="white-space:pre">      </span>4702 <span class="" style="white-space:pre">             </span>Shellphish</div><div>8 <span class="" style="white-space:pre">       </span>4700 <span class="" style="white-space:pre">             </span>CodeRed</div><div>9 <span class="" style="white-space:pre">  </span>4600 <span class="" style="white-space:pre">             </span>KaSecon</div><div>10 <span class="" style="white-space:pre"> </span>4505 <span class="" style="white-space:pre">             </span>Bushwhackers</div><div><br></div><div><br></div><div>Team members are: Silviu, Radu, Codrut, Ionut, Vladimir, Catalin, Silvia, Filip, Alex, Vali, Osiris.</div><div>We solved 85% of tasks. I don't know exactly what each member did because we worked very much in pairs of two people, but I'll say what I did:</div><div><br></div><div>Given the large number of members, I worked together with Catalin Irimie on many tasks.</div><div>Most of the tasks were solved with Catalin Irimie:</div><div><br></div><div>[1] Connect the server  (Solved by 587)</div><div>This was an easy task. All I had to do was to start a tcpdump and connect to the server, then when I looked into to the output of the tcpdump I found the flag.</div><div><br></div><div><br></div><div>[2] Entry form  (Solved by 189)</div><div>This was an easy task too, because just when I looked to the URL "<a href="http://entryform.pwn.seccon.jp/register.cgi">entryform.pwn.seccon.jp/register.cgi</a>" I told to Catalin that this should be shellshocker or perl command execution. He managed to find the source code and the following line got our attention:</div><div>"open(SH, "|/usr/sbin/sendmail -bm '".$q->param("mail")."'");"</div><div>A system command is dynamicly contructed with unfiltered user input. All we had to do was to inject a new command and read the output.</div><div>/register.cgi?name=notempty&mail='%20-bp|ls%20%23</div><div><br></div><div>Then we found the flag.</div><div><br></div><div><br></div><div>[3] Bonsai XSS Revolutions  (Solved by 49)</div><div>At this task the organizer gave us an .exe file that "simulated" an administrator that is looking at his emails on his "email client". At first glance we thought that we should make a dns resolver and use <a href="http://seccon.jp">seccon.jp</a> ip address to resolve "tsuribori.test" and then we would send an email to "keigo.yamazaki@tsuribori.test".</div><div><br></div><div>After a while I figured out that the .exe file would create a smtp server that listen on port 25 and all we have to do is to send emails to localhost and the administrator would see the email sent by us.</div><div>We created a python script that send emails. After some tests we found an XSS in parameter "Date". We used that XSS to print with "alert()" the source code of the html page and we saw that the User-Agent of the browser is rewritten:</div><div>"<html>(...)<body></div><div><script>var navigator=new Object;navigator.userAgent='This is NOT a flag. Use XSS to obtain it.';</script>(...)"</div><div><br></div><div>This problem has many solves:</div><div>a. I told Catalin that we could open the .exe file with javascript disabled from IE and then the code "<script>var navigator=new Object;navigator.userAgent='This is NOT a flag. Use XSS to obtain it.';</script>" wouldn't execute anymore. After the .exe file was opened and the page was loaded we just enabled javascript and print the User-Agent.</div><div><br></div><div>b. Open a new tab and load an image at ip:port. We shuold find the flag in User-Agent.</div><div><br></div><div><br></div><div>[4] Reverse-Engineering Android APK 2  (Solved by 11)</div><div>At this task worked many team members: Silviu Popescu reversed the apk and found the authentication flow. The apk uses AES/ECB to encrypt data for each request to the server. </div><div>With tcpdump we extracted the requests to the server and we saw what we should send to it.</div><div>We made in python a script that sent to the server all user data encrypted and used this to find other security vulnerability.</div><div>  They gave us a hint: “The key is stored in the application, but you will need to hack the server.“, but we already knew that.</div><div>We found an SQL Injection in parameter "email". Was a blind SQL Injection, but Catalin had an idea to make it simple. We extracted the password of our account (stored into the database) and used it to extract data from the database.</div><div>With the following payload we extracted all unique_id from the database:</div><div>&email=<a href="mailto:seccontest2@mailinator.com">seccontest2@mailinator.com</a>' and 1=2 union all select 215, '3809f46bc99ed836cd29eaf', NULL, NULL, BINARY 'X22dCZC6XbcwSHRN4NWR8XVYNbw2MzY0NDk1ZTJl', '6364495e2e', (select group_concat(unique_id from users),NULL FROM users#</div><div><br></div><div>Having all unique_id we made a script to decrypt(AES/ECB) the flag with each unique_id we extracted from the database.</div><div>And one of the lines was our flag: "SECCON{6FgshufUTpRm}"</div><div><br></div><div><br></div><div><br></div><div>[5] Please give me MD5 collision files  (Solved by 5)</div><div>This task was very intersting and hard and was solved because Catalin insisted to solve.</div><div><br></div><div>They gave us an application to insert two different files with same md5 (other teams could do that too). The application would compute length=len(file1)+len(file2) and if the length would be the lowest from the game and you survive 30 min on first place you will obtain the flag.</div><div><br></div><div>Suppose team1 found md5("123456789")=md5("1234567"), the total length would be 16</div><div>1. md5.valueOfTeam1    len 16</div><div><br></div><div>Suppose team2 found md5("1234567890")=md5("12345670"), the total length would be 18</div><div>1. md5.valueOfTeam1    len 16</div><div>2. md5.valueOfTeam2    len 18</div><div><br></div><div>Suppose team3 found md5("123456789000")=md5("1234567000"), the total length would be 20</div><div>1. md5.valueOfTeam1    len 16</div><div>2. md5.valueOfTeam2    len 18</div><div>3. md5.valueOfTeam3    len 20</div><div><br></div><div>Suppose team4 found md5("1234567")=md5("123456"), the total length would be 13</div><div>1. md5.valueOfTeam4    len 13</div><div>2. md5.valueOfTeam1    len 16</div><div>3. md5.valueOfTeam2    len 18</div><div>4. md5.valueOfTeam3    len 20</div><div><br></div><div>Team4 has to stay 30 min on first place to get the flag.</div><div><br></div><div><br></div><div>Another tip of the game is that if you find the md5 of the Team4  md5("1234567") then you can submit it and remove them from the first place and the hash would go to a black list(can't be used again).</div><div>If Team(n) would submit md5 of Team4 the scoreboard would be:</div><div>2. md5.valueOfTeam1    len 16</div><div>3. md5.valueOfTeam2    len 18</div><div>4. md5.valueOfTeam3    len 20</div><div><br></div><div><br></div><div>The tactic here was to find two different md5 to collide and we found them. The length was 64.</div><div>Because the length was 64 you could construct other files that are different but have the same md5:</div><div>Supose md5("a"*4) = md5("b"*64), then md5("a"*4 + ord(i)) = md5("b"*64 + ord(i)), 0<=i<256</div><div><br></div><div>There are 3 pairs of files that have the same md5 and are the lowest find so far and public. Several teams found all 3 pairs and ruled the game (but no one spent 30 min because the md5 was easy to find and invalidate) till the organizers decided to remove the time constraint.</div><div><br></div><div><br></div><div>After we found out we don't have to stay 30 min on first place, we submited 2 files with same md5 and length 65+65 and then we started to invalidate others md5 and we got our flag.</div><div><br></div><div><br></div><div><br></div><div><br></div><div>32C3 CTF</div><div>Last week I participated at 32C3 CTF alone and I made some web tasks.</div><div>The CTF started on 27 Dec. and ended on 29 Dec. (48h).</div><div>Top 3 are:</div><div>pasten          7350</div><div>Dragon Sector   6200</div><div>First Order     5100</div><div><br></div><div>I registered an account and I played alone, for fun, few hours because I went to some presentations (btw, perl jam 2 I enjoyed the most).</div><div><br></div><div>At the CTF I made 4 tasks:</div><div>Kummerkasten 300  Solves: 61</div><div>TinyHosting  250  Solves: 71</div><div>MonkeyBase   200  Solves: 26</div><div>ITD          150  Solves: 11</div><div><br></div><div>[1] Kummerkasten</div><div>When I visited the url from the description I saw a Contact form, which told me that could be a blind XSS behind that.</div><div>I inserted in parameter "body": <img src="my_ip:2222" /> and with nc I listened for any incoming connection. The connection was made immediately I sent the request to the administrator.</div><div>After few tests I found that it was a XSS with no restriction. Knowing that I just sent the source code of the administrator page and I saw some more sections:</div><div>/admin/bugs</div><div>/admin/token</div><div>Getting the html source code of those pages I've noticed 2 images:</div><div>/admin/img/root_pw.png?20151228</div><div>/admin/img/token.png?20151228</div><div><br></div><div>I sent the content of the images to my server and combining the two strings obtained from the images I get the flag: 1_4m_numb3r_0n3!629880</div><div><br></div><div><br></div><div>[2] TinyHosting</div><div>This time I have a file upload where I can upload any file with any extension, but the length of the content is 7 bytes.</div><div>I have to make a php shell that is 7 bytes.</div><div>The solution was:</div><div>a. to upload a file test.php and as content:   <?=`*`;</div><div>b. then I have to make some files with name "eval" and another one with name "echo '<?php echo system($_GET[1]);?>' > shell.php"</div><div>c. when I will visit the tiny shell test.php then will execute "<?=`*`". This code will make a list of all files from directory and will sort them alphabetically. Will take the first line combined with the others and will execute system command.</div><div>My files in that directory are:</div><div>eval</div><div>echo '<?php echo system($_GET[1]);?>' > shell.php</div><div>index.html</div><div>test.php</div><div><br></div><div>When test.php is invoked, then the following commands will be executed on the server side:</div><div>eval "echo '<?php echo system($_GET[1]);?>' > shell.php"</div><div>eval "index.html"</div><div>eval "wtest.php"</div><div><br></div><div>first one will create a php shell with name shell.php and then I will be able to send any system command and see the output. The rest is history.</div><div><br></div><div>[3] MonkeyBase</div><div>This wasn't a hard task, but I have some problems because of lots of red herring.</div><div>The web application had lots of functionalities and I had to check for SQL Injection, Blind XSS, Remote Command Execution, unserialize php data, check for hash length extension. In the end was file inclusion (I think I could obtain a RCE but wasn't necessary). With that file inclusion I obtain the flag from one of the php source code.</div><div><br></div><div>[4] ITD</div><div>This was an interesting task. Was possible to use "file_get_content" to read file, but they blocked most of the php wrappers. The problem was when they tried to block "file" wrapper, they blacklisted "file:///", but it is possible to use "file://localhost/etc/passwd" to read local files. </div><div>The blacklist is:</div><div>$w = array('<','>','\.\.','^/+.*','file:///','php://','data://','zip://','ftp://','phar://','zlib://','glob://','expect://');</div><div><br></div><div><br></div><div>Knowing how to read files I found the path to the flag. I had to execute a binary and if that binary returns "LOOSE" the php script would stop, else would give me the flag.</div><div>Here were many solves. I choose to submit lots of requests on 10 threads till one of the execution would fail and would not return any string to php script.</div><div>I made a python script that send  requests on 10 threads till one of the response would give me the flag.</div><div><br></div><div>All the best,</div><div>Cernica Ionut</div><div><br></div></div>