{"id":1249,"date":"2016-05-24T19:57:07","date_gmt":"2016-05-24T19:57:07","guid":{"rendered":"http:\/\/www.gironsec.com\/blog\/?p=1249"},"modified":"2016-05-24T19:57:07","modified_gmt":"2016-05-24T19:57:07","slug":"cactuscon-reverse-engineering-spoilers","status":"publish","type":"post","link":"https:\/\/www.gironsec.com\/blog\/2016\/05\/cactuscon-reverse-engineering-spoilers\/","title":{"rendered":"CactusCon Reverse Engineering Spoilers"},"content":{"rendered":"<p>Challenge 1:<\/p>\n<p>&#8211;[&#8212;&#8211;>+<]>&#8212;-.[&#8212;>+<]>&#8212;-.+++[->+++<]>++.++++++++.+++++.&#8212;&#8212;&#8211;.-[&#8212;>+<]>&#8211;.+[->+++<]>+.++++++++.&#8211;.+++++.&#8212;&#8212;-.&#8211;.&#8212;-.&#8211;[&#8212;>+<]>&#8211;.++++++.<\/p>\n<p>Answer: brainfuckingeasy<\/p>\n<p>Challenge 2 &#8211; &#8220;simple&#8221; xor crackme with a 55 character password. May make this a higher challenge. <\/p>\n<p>Answer:<br \/>\n&#8220;Waxing my car will not result in expert karate training&#8221;<\/p>\n<p>challenge 3 &#8211; C app, createthread, easy to solve with ida and hex editor or debugger. <\/p>\n<p>Change the timeout for WaitForSingleObject to something higher than 100 ms and you&#8217;ll see the messagebox, however the password is on the stack in byte form.<br \/>\n<a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/ayy.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/ayy.png\" alt=\"ayy\" width=\"593\" height=\"797\" class=\"alignnone size-full wp-image-1250\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/ayy.png 593w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/ayy-223x300.png 223w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/a><\/p>\n<p>Use a hex editor on each value being pushed to the stack to get the answer: windows_bug_or_feature? I also threw in some anti-debugger code just for kicks. <\/p>\n<p>challenge 4 &#8211; java applet with exe inside.  Use java decompiler against the jar file, you&#8217;ll see &#8220;String heytherejoe = &#8220;4D5A900003000000040000&#8221;, followed by a string to bytes method. Recall that 4D 5A is the hex code for MZ. This is an exe file packed with upx, just run and get answer: c4tus_C0n2016<\/p>\n<p>Challenge 5 &#8211; 2 PDF files with exploits inside. Both lead to either a message box or a download + run of http:\/\/hda.io\/muzac\/flag_5.mp3 which is SANIC.mp3, flag is at the end, which is my voice saying &#8220;hacksonic&#8221; so accept either &#8220;hacksonic&#8221; or &#8220;hack sonic&#8221;<br \/>\nPassword for the zip is infected<\/p>\n<p>Challenge 6 &#8211; python exe file with built in game and flag.<br \/>\nYou can use CheatEngine to obtain the score needed, or just decompile with either EasyPythonDecompiler or unfrozen. Optionally you could obtain a pointer to the decompiled code with a debugger, but that&#8217;s overkill. <\/p>\n<p>The flag is EasyPythonDecompiler_rocks<\/p>\n<p>Challenge 7 &#8211; .net challenge with obfuscator involved. Use de4dot against the binary.<br \/>\nYou should see code like this:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #0000ff\">static<\/span> <span style=\"color: #0000ff\">void<\/span> NothingToSeeHere()\r\n        {\r\n            <span style=\"color: #2b91af\">var<\/span> resourcelist_reference = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();\r\n            <span style=\"color: #2b91af\">var<\/span> assembly = Assembly.GetExecutingAssembly();\r\n            <span style=\"color: #2b91af\">var<\/span> resourceName = <span style=\"color: #a31515\">&quot;CactusCon_Reverse_Challenge_Main.Spraypaintingmyeyes.jpg&quot;<\/span>;\r\n\r\n            <span style=\"color: #0000ff\">using<\/span> (Stream stream = assembly.GetManifestResourceStream(resourceName))\r\n            {\r\n                MemoryStream ms = <span style=\"color: #0000ff\">new<\/span> MemoryStream();\r\n                stream.CopyTo(ms);\r\n                <span style=\"color: #2b91af\">byte<\/span>[] hashforme = ms.ToArray();\r\n\r\n                SHA1 shalol = SHA1.Create();\r\n                <span style=\"color: #2b91af\">byte<\/span>[] hio = shalol.ComputeHash(hashforme);\r\n                <span style=\"color: #2b91af\">string<\/span> text2 = <span style=\"color: #a31515\">&quot;&quot;<\/span>;\r\n                <span style=\"color: #0000ff\">for<\/span> (<span style=\"color: #2b91af\">int<\/span> j = 0; j &lt; hio.Length; j++)\r\n                {\r\n                    text2 += <span style=\"color: #2b91af\">string<\/span>.Format(<span style=\"color: #a31515\">&quot;{0:X2}&quot;<\/span>, hio[j] ^ 2);\r\n                }\r\n                MessageBox.Show(<span style=\"color: #a31515\">&quot;Good job, the flag is &quot;<\/span> + text2);\r\n            }\r\n        }\r\n<\/pre>\n<\/div>\n<p>The answer is the SHA1 hash of &#8216;Spraypaintingmyeyes.jpg&#8217;, xor&#8217;d by 2, or AB875A4DD1AEDC4FB5961981818472D366B06941<br \/>\nThe others were just thrown in to confuse the shit out everyone. <\/p>\n<p>Challenge 8 &#8211; Macro code that needs to be deobfuscated. Can be done with vbscript, notepad, and text-replace. Here&#8217;s the function used to decode:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #0000ff\">Private<\/span> <span style=\"color: #0000ff\">Function<\/span> DecryptStringFunc(argument)\r\n    <span style=\"color: #0000ff\">Dim<\/span> hb1, count, kv1\r\n    argument = StrReverse(argument)\r\n    <span style=\"color: #0000ff\">For<\/span> count = 1 <span style=\"color: #0000ff\">To<\/span> Len(argument)\r\n        hb1 = Mid(argument, count, 1)\r\n        kv1 = kv1 &amp; Chr(Asc(hb1) - 1)\r\n    <span style=\"color: #0000ff\">Next<\/span>\r\n    DecryptStringFunc = kv1\r\n<span style=\"color: #0000ff\">End<\/span> <span style=\"color: #0000ff\">Function<\/span>\r\n<\/pre>\n<\/div>\n<p>Flag is midcitystylespace.com.au<\/p>\n<p>Challenge 9 is an snes rom with some hidden data inside. Zip archive is broken. Included is the rom and emulator.<\/p>\n<p>I broke the pkzip header. It needs to be repaired to work.<br \/>\nSee https:\/\/users.cs.jmu.edu\/buchhofp\/forensics\/formats\/pkzip.html<\/p>\n<p>ie; replace<br \/>\n<!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\">77 68 61 74 67 6F 65 73 68 65 72 65 3F 3F 3F 00 2B A7 86 48 6B 1B\r\n<\/pre>\n<\/div>\n<p>with<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\">FF FF FF FF FF FF 50 4B 03 04 14 00 00 00 08 00 2B A7 86 48 6B 1B\r\n<\/pre>\n<\/div>\n<p>The cheater&#8217;s way is to use 7zip which ignores headers and looks for other structures and you&#8217;ll find the flag in jpeg form. The flag is &#8216;snes_butthead&#8217;.<\/p>\n<p>Final challenge is this:<br \/>\nZip file with password not provided. Crack it and you&#8217;ll see (4skJ0e)<br \/>\nInside is a broken exe file (PE chars replaced with JO) so fix with a hex editor.<br \/>\nExe uses custom exception handlers, SSE, MMX instructions, fibonacci sequences, and must be patched to get through. The password is in 2 parts, encrypted xor style. This is the flag &#8211;<br \/>\nmikudayo-fumifumi<\/p>\n<p>Fastest way to beat this is with a debugger and setting the EIP to 0040116e and single stepping, seeing the 2 strings pushed onto the stack and the 2 xor keys. Easy peasy.<\/p>\n<p><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/easy_way.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/easy_way-300x168.png\" alt=\"easy_way\" width=\"300\" height=\"168\" class=\"alignnone size-medium wp-image-1251\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/easy_way-300x168.png 300w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/easy_way-768x431.png 768w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/easy_way-1024x575.png 1024w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/easy_way.png 1925w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I look forward to making more next year.<\/p>\n<p>Happy cracking!<\/p>\n<p><a href=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/1460737634977.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/1460737634977.jpg\" alt=\"1460737634977\" width=\"552\" height=\"517\" class=\"alignnone size-full wp-image-1252\" srcset=\"https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/1460737634977.jpg 552w, https:\/\/www.gironsec.com\/blog\/wp-content\/uploads\/2016\/05\/1460737634977-300x281.jpg 300w\" sizes=\"(max-width: 552px) 100vw, 552px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Challenge 1: &#8211;[&#8212;&#8211;>+&#8212;-.[&#8212;>+&#8212;-.+++[->+++++.++++++++.+++++.&#8212;&#8212;&#8211;.-[&#8212;>+&#8211;.+[->++++.++++++++.&#8211;.+++++.&#8212;&#8212;-.&#8211;.&#8212;-.&#8211;[&#8212;>+&#8211;.++++++. Answer: brainfuckingeasy Challenge 2 &#8211; &#8220;simple&#8221; xor crackme with a 55 character password. May make this a higher challenge. Answer: &#8220;Waxing my car will not result in expert karate training&#8221; challenge 3 &#8211; C app, createthread, easy to solve with ida and hex editor or debugger. Change the timeout for WaitForSingleObject to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,5],"tags":[109],"_links":{"self":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1249"}],"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=1249"}],"version-history":[{"count":1,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1249\/revisions"}],"predecessor-version":[{"id":1253,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/posts\/1249\/revisions\/1253"}],"wp:attachment":[{"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/media?parent=1249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/categories?post=1249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gironsec.com\/blog\/wp-json\/wp\/v2\/tags?post=1249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}