{"id":19505,"date":"2016-09-22T17:55:58","date_gmt":"2016-09-23T00:55:58","guid":{"rendered":"https:\/\/www.paloaltonetworks.com\/blog\/?p=19505"},"modified":"2016-09-29T09:46:27","modified_gmt":"2016-09-29T16:46:27","slug":"unit-42-labyrenth-capture-the-flag-ctf-windows-track-7-9-solutions","status":"publish","type":"post","link":"https:\/\/www2.paloaltonetworks.com\/blog\/2016\/09\/unit-42-labyrenth-capture-the-flag-ctf-windows-track-7-9-solutions\/","title":{"rendered":"LabyREnth Capture the Flag (CTF): Windows Track 7-9 Solutions"},"content":{"rendered":"<p>Welcome back to our blog series where we reveal the\u00a0solutions\u00a0to\u00a0<a href=\"https:\/\/www.paloaltonetworks.com\/blog\/2016\/07\/unit42-announcing-the-labyrenth-capture-the-flag-ctf-challenge\/\" target=\"_blank\">LabyREnth, the Unit 42 Capture the Flag (CTF)<\/a>\u00a0challenge. We\u2019ll be revealing the\u00a0<a href=\"https:\/\/www.paloaltonetworks.com\/blog\/tag\/ctf\/\" target=\"_blank\">solutions<\/a>\u00a0to one challenge track per week. Next up, the Windows track challenges 7 through 9.\u00a0<!--more--><\/p>\n<h3>Windows 7 Challenge: Some guy found this pcap and executable. Ready, set, go!<\/h3>\n<p><em>Challenge Created By: Josh Grunzweig <a href=\"https:\/\/twitter.com\/jgrunzweig\" rel=\"nofollow,noopener\"  target=\"_blank\">@jgrunzweig<\/a><\/em><\/p>\n<p>For this challenge, users were given both a PCAP and a Windows executable file. Taking a quick look at the PCAP file, we see there are a number of individual connections from 172.16.95.1 to 172.16.95.190, each about the same size.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:65%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19622 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1-500x325.png\" alt=\"windows_2_1\" width=\"500\" height=\"325\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1-500x325.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1-230x149.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1-768x499.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1-462x300.png 462w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1-62x40.png 62w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_1.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p style=\"text-align: center;\"><em>Figure 1 Connections in G0blinKing pcap file<\/em><\/p>\n<p>Looking at a specific connection, we see that each one is transferring a single byte of data at a time.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:52.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19619 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2-500x263.png\" alt=\"windows_2_2\" width=\"500\" height=\"263\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2-500x263.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2-230x121.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2-768x404.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2-510x268.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2-76x40.png 76w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_2.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p style=\"text-align: center;\"><em>Figure 2 Data in stream 0 for G0blinKing pcap file<\/em><\/p>\n<p>Presumably, we can come to the conclusion that some data is being sent from one host to another, one byte at a time. To determine what data has been generated, we need to look at the Windows executable file.<\/p>\n<p>Opening the file, we see a minor Easter egg, where the pdb string was overwritten.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:22.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19616 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3-500x113.png\" alt=\"windows_2_3\" width=\"500\" height=\"113\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3-500x113.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3-230x52.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3-768x174.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3-510x116.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3-176x40.png 176w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_3.png 974w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p style=\"text-align: center;\"><em>Figure 3 Overwritten pdb path<\/em><\/p>\n<p>Unfortunately for this file, it doesn\u2019t disassemble terribly well, and we see a number of functions that simply jump to the actual function containing the relevant code. This is just a byproduct of how the file was compiled. Looking through the code, however, we can see that the actual core functionality of the code starts at a function at offset 0x412300.<\/p>\n<p>Performing a quick triage of the sample and the functions that are called, we can get a high-level overview of what is going on. Note that I\u2019ve renamed a few of the functions in the figure below based on guesses as to what the functions may be doing.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_4.png\"><div style=\"max-width:100%\" data-width=\"406\"><span class=\"ar-custom\" style=\"padding-bottom:332.51%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-19613 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_4.png\" alt=\"windows_2_4\" width=\"406\" height=\"1350\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_4.png 406w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_4-230x765.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_4-90x300.png 90w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_4-12x40.png 12w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/span><\/div><\/a><\/p>\n<p style=\"text-align: center;\"><em>Figure 4 Main function of executable<\/em><\/p>\n<p>So, we can safely conclude that some form of encryption is being performed against the data contained in file.txt, it\u2019s then being encoded, and then sent across the network, where the PCAP was generated from. At this point we simply need to identify what is happening during encryption and encoding respectively.<\/p>\n<p>For encryption, we track down a function that looks to be primarily responsible. We also identify a string aptly named \u2018AWildKeyAppears!\u2019, which is most likely going to be the key used for encryption. Looking at the beginning of this function, we identify a number of constants as seen in the following figure.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:93.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19610 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5-500x468.png\" alt=\"windows_2_5\" width=\"500\" height=\"468\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5-500x468.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5-230x215.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5-768x718.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5-321x300.png 321w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5-43x40.png 43w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_5.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p style=\"text-align: center;\"><em>Figure 5 Encryption function<\/em><\/p>\n<p>A number of these constants turn out to be red herrings. However, if we look at the constant of 0x9E3769B9, we see that this constant is used in the TEA\/XTEA encryption algorithms. Further review of this function shows us that we\u2019re simply dealing with XTEA, with a few red herrings thrown in. The following original source code shows what it looked like prior to compilation.<\/p>\n<pre class=\"lang:default decode:true \">unsigned int key[4] = {0x6c695741, 0x79654b64, 0x65707041, \r\n0x21737261};\r\n\r\n#define BLOCK_SIZE 8\r\n\r\nvoid xtea_encipher(unsigned int num_rounds, uint32_t v[2], \r\nuint32_t const key[4]) {\r\n    unsigned int i;\r\n    uint32_t j, o, s, h;\r\n    j = 0xBADA55;\r\n    uint32_t delta = 0x9e3769b9;\r\n    o = 0x4913092;\r\n    s = 0x12345678;\r\n    h = 0xDEADBEEF;\r\n    uint32_t v0=v[0], v1=v[1], sum=0;\r\n    for (i=0; i &lt; num_rounds; i++) {\r\n        v0 += (((v1 &lt;&lt; 4) ^ (v1 &gt;&gt; 5)) + v1) ^ (sum + key[sum &amp; \r\n3]);\r\n        j += 4092;\r\n        o -+ 4092;\r\n        for (int x = 8; x &lt; 32; x++) {\r\n          s = s*8;\r\n          j -= 64;\r\n          o -= 8;\r\n        }\r\n        h = 64;\r\n        sum += (delta + 4096);\r\n        v1 += (((v0 &lt;&lt; 4) ^ (v0 &gt;&gt; 5)) + v0) ^ (sum + \r\nkey[(sum&gt;&gt;11) &amp; 3]);\r\n    }\r\n    v[0]=v0; \r\n    v[1]=v1;\r\n}\r\n<\/pre>\n<p>Now we can move onto the encoding function. At a quick glance, it looks to be base64. However, if we look at the alphabet, it does not look to be standard. The following is the traditional base64 alphabet.<\/p>\n<p>ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/<\/p>\n<p>This is the alphabet discovered within the Windows executable.<\/p>\n<p>qtgJYKa8y5L4flzMQ\/BsGpSkHIjhVrm3NCAi9cbeXvuwDx+R6dO7ZPEno21T0UFW<\/p>\n<p>Knowing this, we can now create a script that will both parse the PCAP file and decrypt the contents sent across the wire. The following script was created to accomplish this.<\/p>\n<pre class=\"lang:default decode:true \">import string\r\nimport dpkt\r\nimport sys\r\nimport base64\r\nimport struct\r\n\r\n\r\ndef xtea_decrypt(key,block, n=32, endian=\"!\"):\r\n  v0,v1 = struct.unpack(endian+\"2L\",block)\r\n  k = struct.unpack(endian+\"4L\",key)\r\n  delta,mask = 0x9e3779b9L,0xffffffffL\r\n  sum = (delta * n) &amp; mask\r\n  for round in range(n):\r\n    v1 = (v1 - (((v0&lt;&lt;4 ^ v0&gt;&gt;5) + v0) ^ (sum + k[sum&gt;&gt;11 &amp; \r\n3]))) &amp; mask\r\n    sum = (sum - delta) &amp; mask\r\n    v0 = (v0 - (((v1&lt;&lt;4 ^ v1&gt;&gt;5) + v1) ^ (sum + k[sum &amp; 3]))) &amp; \r\nmask\r\n  return struct.pack(endian+\"2L\",v0,v1)\r\n\r\nall_data = \"\"\r\n\r\ndef parse_pcap_file(filename):\r\n  global all_data\r\n  f = open(filename)\r\n  pcap = dpkt.pcap.Reader(f)\r\n  for ts, buf in pcap:\r\n    eth = dpkt.ethernet.Ethernet(buf)\r\n    ip = eth.data\r\n    tcp = ip.data\r\n    if tcp.dport == 8080 and len(tcp.data) &gt; 0:\r\n      all_data += tcp.data\r\n\r\nif __name__ == '__main__':\r\n  if len(sys.argv) &lt;= 1:\r\n    print \"%s [pcap file]\" % __file__\r\n    sys.exit(2)\r\n  parse_pcap_file(sys.argv[1])\r\n\r\nnew_b64_chars  = \r\n\"qtgJYKa8y5L4flzMQ\/BsGpSkHIjhVrm3NCAi9cbeXvuwDx+R6dO7ZPEno21T0UF\r\nW\"\r\nold_b64_chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\r\n\/\"\r\n\r\nall_data = all_data.translate(string.maketrans(new_b64_chars, \r\nold_b64_chars))\r\ndata = base64.b64decode(all_data)\r\n\r\nresult = \"\"\r\nkey = 'AWildKeyAppears!'\r\nfor x in range(0, len(data)\/8):\r\n  o = xtea_decrypt(key, data[8*x:8*x+8], endian=\"&lt;\")\r\n  result += o\r\nprint result\r\n<\/pre>\n<p>Running this script against the provided PCAP file, we\u2019re presented with the following output.<\/p>\n<pre class=\"lang:default decode:true \">PADDINGPADDINGPADDINGPADDINGPADDINGPADDINGPADDINGPADDINGP\r\nPAN{did_1_mention_th0se_pupp3ts_fr34ked_m3_out_recent1y?}\r\nPADDINGPADDINGPADDINGhibobPADDINGPADDINGPADDINGPAD\r\n<\/pre>\n<p>PAN{did_1_mention_th0se_pupp3ts_fr34ked_m3_out_recent1y?}<\/p>\n<h3>Windows 8 Challenge: Prepare for windows kernel debugging! (smile)<\/h3>\n<p><em>Challenge Created By: Esmid Idrizovic <a href=\"https:\/\/twitter.com\/xedi25\" rel=\"nofollow,noopener\"  target=\"_blank\">@xedi25<\/a><\/em><\/p>\n<h4>Initial analysis<\/h4>\n<p>When we open the file revloader.exe in a PE viewer we see that it\u2019s a PE64 file. The file contains three unencrypted resources in the RCData directory.\u00a0 We extract all three resource files to look at what\u2019s in these files.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:57.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19607 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6-500x287.png\" alt=\"windows_2_6\" width=\"500\" height=\"287\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6-500x287.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6-230x132.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6-768x441.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6-510x293.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6-70x40.png 70w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_6.png 872w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<h4>Resources of revloader.exe<\/h4>\n<p><strong>Resource 101<\/strong><\/p>\n<p>This file is also a PE64 and contains some version information strings, which tells us that it\u2019s DSEFix. DSEFix is a tool that can bypass the driver signature enforcement in Windows by using an exploit in a signed VirtualBox driver. By using DSEFix, you can disable DSE and load any driver you want. So it looks like we\u2019ll solve this challenge by using an unsigned windows driver.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:79.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19604 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7-500x399.png\" alt=\"windows_2_7\" width=\"500\" height=\"399\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7-500x399.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7-230x184.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7-376x300.png 376w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7-50x40.png 50w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_7.png 729w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p><strong>Resource 102<\/strong><\/p>\n<p>This is the driver itself. It\u2019s also a PE64 and uses FLTMGR.SYS. In version information, we can see that it\u2019s a windows driver with the internal name revhunt.sys. We can also see that the file is not signed, so it makes sense that revloader.exe is going to use DSEFix to load the revhunt.sys.<\/p>\n<p><strong>Resource 103<\/strong><\/p>\n<p>This is an INF file for the driver. We can see that it\u2019s a mini file filter driver and that it uses the altitude 31337.<\/p>\n<h4>Revloader<\/h4>\n<p>Let\u2019s start with revloader.exe to verify that it\u2019s going to drop DSEFix driver and run DSEFix to disable windows driver signature enforcement. We can take a look at the import table to find important functions that might be used for this kind of work.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:37.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19601 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8-500x187.png\" alt=\"windows_2_8\" width=\"500\" height=\"187\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8-500x187.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8-230x86.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8-510x190.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8-107x40.png 107w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_8.png 533w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<ul>\n<li>LookupPrivilegeValueW\/AdjustTokenPrivilege: to acquire the missing rights to load a driver (\u201cSeLoadDriverPrivilege\u201d).<\/li>\n<li>LoadResource\/FindResource: to find a resource and map it to memory.<\/li>\n<li>CreateFileW: to create or access a file on the disk.<\/li>\n<li>WinExec: to execute a file.<\/li>\n<li>FilterLoad\/FilterUnload: to load and unload a mini filter driver.<\/li>\n<\/ul>\n<p>Following cross-references to FilterLoad we can see that the function to load the driver is at 0x140001800. That function uses InstallHinfSectionW with arguments \u201cDefaultInstall 132 &lt;filename.inf&gt;\u201d to install the driver and then uses FilterLoad to load the driver. If we follow that function back, we can see that this function has been called from main function and we can see that there are a few more interesting calls:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_9.png\"><div style=\"max-width:100%\" data-width=\"330\"><span class=\"ar-custom\" style=\"padding-bottom:132.73%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-19598 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_9.png\" alt=\"windows_2_9\" width=\"330\" height=\"438\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_9.png 330w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_9-230x305.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_9-226x300.png 226w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_9-30x40.png 30w\" sizes=\"auto, (max-width: 330px) 100vw, 330px\" \/><\/span><\/div><\/a><\/p>\n<p>We can see that the function at 0x140001FD0 will be called with argument 101, 102, and 103. That means this function is probably accessing the embedded resources. If we look into that function we will see that it uses FindResourceW, SizeofResource, LoadResource, CreateFileW and WriteFile. We can rename that function to DropResource. After these three calls, it will call WinExec.<\/p>\n<p>That means that revloader is dropping the resources to current directory (resource 101, 102, 103) and then executing dsefix.exe (resource 101) after it loads the mini file filter driver (resource 102 + 103).<\/p>\n<p>Let\u2019s run revloader.exe to load the driver into kernel and see if it works.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:63.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19595 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10-500x319.png\" alt=\"windows_2_10\" width=\"500\" height=\"319\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10-500x319.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10-230x147.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10-471x300.png 471w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10-63x40.png 63w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_10.png 745w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We can see the \u201cWelcome to revhunt x86-x64\u201d. Now let\u2019s analyze the driver and try to find the flag.<\/p>\n<h4>Revhunt<\/h4>\n<p>Opening revhunt.sys in IDA Pro we can see that in DriverEntry function there is a jump to 0x140007000. That looks like the real main function.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:81.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19592 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11-500x406.png\" alt=\"windows_2_11\" width=\"500\" height=\"406\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11-500x406.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11-230x187.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11-768x624.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11-369x300.png 369w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11-49x40.png 49w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_11.png 778w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We can see that the driver is using some kernel anti-debugging functions like KdDebuggerNotPresent and KdDisableDebugger. That means if we attach a kernel debugger to our virtual machine, the function KdDisableDebugger will disconnect us. We would have to patch KdDebuggerNotPresent and KdDisableDebugger with NOP instruction or, since the driver is not signed, we can also patch the calls in the driver itself.<\/p>\n<p>We can also see that the driver uses FltRegisterFilter and FltStartFiltering. Let\u2019s take a look at definition of FltRegisterFilter:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">NTSTATUS FltRegisterFilter(\r\n_In_\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0PDRIVER_OBJECT \u00a0\u00a0Driver,\r\n_In_\u00a0\u00a0const FLT_REGISTRATION *Registration,\r\n_Out_\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0PFLT_FILTER \u00a0\u00a0\u00a0\u00a0\u00a0*RetFilter\r\n);\r\n<\/pre>\n<p>FltRegisterFilter takes a FLT_REGISTRATION structure as a second argument that contains information (flags, callback routines, etc.) for the registration of the mini file filter driver. The second argument for FltRegisterFilter in this case is:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">lea\u00a0\u00a0\u00a0\u00a0 rdx, unk_140003140\r\n<\/pre>\n<p>We can go to IDA Pro and set a structure at 0x140003140 as FLT_REGISTRATION but before we do that we have to load the correct type library: Windows Driver Kit 8 (kernel mode) - wdk8_km. You can also take any newer DDK libraries. Now we can set the correct structure:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:56%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19589 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12-500x280.png\" alt=\"windows_2_12\" width=\"500\" height=\"280\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12-500x280.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12-230x129.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12-510x286.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12-71x40.png 71w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_12.png 758w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Using that we can quickly identify what each sub-function is used for. We can also see that the flags for the structure are set to 0x02, which is FLTFL_REGISTRATION_SUPPORT_NPFS_MSFS. According to MSDN that means that the driver supports named pipes and mailslot requests as normal file events.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:11%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19586 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13-500x55.png\" alt=\"windows_2_13\" width=\"500\" height=\"55\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13-500x55.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13-230x25.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13-768x85.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13-510x56.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13-240x26.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_13.png 953w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Now let\u2019s do the same with OperationRegistration and set a structure of FLT_OPERATION_REGISTRATION:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:13.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19583 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14-500x69.png\" alt=\"windows_2_14\" width=\"500\" height=\"69\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14-500x69.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14-230x32.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14-768x106.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14-510x71.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14-240x33.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_14.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Checking quickly for PreOperation and PostOperation code, we can see that the really interesting code is going on in the PostOperation function, so let\u2019s analyze that.<\/p>\n<h4>PostOperation callback<\/h4>\n<p>Before we start, we should set a new function definition in IDA Pro to the correct definition like in MSDN, it will make our analysis a lot easier (and if you use the Hex-Rays Decompiler it will decompile a lot better). So let\u2019s change the function definition to:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">typedef FLT_POSTOP_CALLBACK_STATUS ( *PFLT_POST_OPERATION_CALLBACK)(\r\n_Inout_\u00a0\u00a0PFLT_CALLBACK_DATA \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Data,\r\n_In_\u00a0\u00a0\u00a0\u00a0\u00a0PCFLT_RELATED_OBJECTS \u00a0\u00a0\u00a0FltObjects,\r\n_In_opt_\u00a0PVOID \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0CompletionContext,\r\n_In_\u00a0\u00a0\u00a0\u00a0\u00a0FLT_POST_OPERATION_FLAGS Flags\r\n);\r\n\r\n__int64 __fastcall PostOperation(PFLT_CALLBACK_DATA\r\nCallbackData, PCFLT_RELATED_OBJECTS FltObjects, PVOID\r\nCompletionContext, FLT_POST_OPERATION_FLAGS Flags);\r\n<\/pre>\n<p>By loading the correct type libraries, we can simplify the analysis because that code looks easier to read:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:73%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19580 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15-500x365.png\" alt=\"windows_2_15\" width=\"500\" height=\"365\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15-500x365.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15-230x168.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15-411x300.png 411w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15-55x40.png 55w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_15.png 719w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We can see that the function is checking if the current FileObject is a mailslot event (FO_MAILSLOT), if the current file name of the object is 18 characters long, if \u201c\\gsrt.txt\u201d, and if the current event is opening the file. If that\u2019s the case, then it will use FltReadFile to read from the file and compare the content with encrypted data:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:23%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19577 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16-500x115.png\" alt=\"windows_2_16\" width=\"500\" height=\"115\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16-500x115.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16-230x53.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16-768x176.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16-510x117.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16-174x40.png 174w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_16.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>So let\u2019s quickly decode that using a python script:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">data = [0x7F, 0x56, 0x71, 0x4E, 0x61, 0x52, 0x7D, 0x43, 0x7B, 0x19, 0x70, 0x58, 0x7E,\r\n0x37]\r\nfor x in range(0, 14):\r\nif (x % 2 == 0):\r\ndata[x] ^= 0x13\r\nelse:\r\ndata[x] ^= 0x37\r\nprint str (bytearray(data))\r\n\r\n$ python decoder.py\r\nlabyrenth.com\r\n<\/pre>\n<p>That means, we have to create a file named \u201c\\gsrt.txt\u201d with the content \u201clabyrenth.com\u201d and then open the file. After that we can see there is another byte array initialized on the stack and decode it using the same technique as before:<\/p>\n<p><a style=\"font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 16px; line-height: 1.5; background-color: #ffffff;\" href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:19.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19574 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17-500x99.png\" alt=\"windows_2_17\" width=\"500\" height=\"99\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17-500x99.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17-230x45.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17-768x151.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17-510x101.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17-203x40.png 203w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_17.png 847w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Let us write that to our script and decode also that string.<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">data = [ 0x5C, 0x5F, 0x3D, 0x19, 0x3D, 0x17, 0x7C, 0x5C, 0x72, 0x4E, 0x3D, 0x19,\r\n0x3D, 0x19, 0x5A, 0x17, 0x7E, 0x52, 0x72, 0x59, 0x33, 0x7E, 0x43, 0x74,\r\n0x33, 0x58, 0x7D, 0x17, 0x2D, 0x0A, 0x33, 0x60, 0x7A, 0x59, 0x77, 0x58,\r\n0x64, 0x44, 0x33, 0x0F, 0x33, 0x40, 0x7C, 0x42, 0x7F, 0x53, 0x33, 0x5F,\r\n0x72, 0x41, 0x76, 0x17, 0x71, 0x52, 0x76, 0x59, 0x33, 0x52, 0x72, 0x44,\r\n0x7A, 0x52, 0x61, 0x17, 0x71, 0x42, 0x67, 0x17, 0x7E, 0x5A, 0x7E, 0x5A,\r\n0x78, 0x56, 0x6A, 0x17, 0x6A, 0x58, 0x66, 0x17, 0x72, 0x45, 0x76, 0x17,\r\n0x67, 0x5F, 0x76, 0x17, 0x61, 0x52, 0x65, 0x52, 0x61, 0x44, 0x76, 0x45,\r\n0x33, 0x5F, 0x76, 0x45, 0x76, 0x19, 0x19, 0x37]\r\n\r\nfor x in range(0, 104):\r\nif (x % 2 == 0):\r\ndata[x] ^= 0x13\r\nelse:\r\ndata[x] ^= 0x37\r\n\r\nprint str(bytearray(data))\r\n\r\n$ python decoder.py\r\nOh... okay....I mean IPC on &gt;= Windows 8 would have been easier but mmmmkay you are the reverser here.\r\n<\/pre>\n<p>That looks like a hint that tells us that we could have used Interprocess Communications (IPC) to do the same. If we scroll up again we will see that the sample was comparing the current FileObject.Flags with FO_MAILSLOT. That means if there was any Mailslot event it would have directly jumped to 0x140001405, which looks like an initialization function.<\/p>\n<p>If we take a look into that function, we will see that it will allocate a memory address using ExAllocatePoolWithTag and save the result at 0x140004020, which I have named lpszBuffer.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:20%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19571 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18-500x100.png\" alt=\"windows_2_18\" width=\"500\" height=\"100\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18-500x100.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18-230x46.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18-768x153.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18-510x102.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18-201x40.png 201w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_18.png 974w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>If we take a look at the cross-references to lpszBuffer, we will see that it\u2019s used in four functions: PostOperation, InitBuffer, 0x14000181C, and Unload. We will look into 0x14000181C a little later but now let\u2019s go back to the PostOperation function and see what happens next.<\/p>\n<p>After the InitBuffer call, it will check the filename of the FileObject again and compare it with \u201c\\pan.flag\u201d. If that\u2019s correct, it will call the function 0x14000181C and it will print the flag using DbgPrint. That means that the decrypting routine is at 0x14000181C and that lpszBuffer will contain the decoded flag.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:73.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19568 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19-500x367.png\" alt=\"windows_2_19\" width=\"500\" height=\"367\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19-500x367.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19-230x169.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19-768x564.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19-409x300.png 409w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19-54x40.png 54w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_19.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Now let\u2019s take a look into the function at 0x14000181C. I have renamed that function to TestFlag.<\/p>\n<h4>Analyzing flag testing function<\/h4>\n<p>At the beginning of the function we can see that it uses FltReadFile again to read the content of the given FileObject. We can also see that it reads 58 bytes. The first four bytes are compared with \u201cPAN{\u201c.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:28.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19565 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20-500x144.png\" alt=\"windows_2_20\" width=\"500\" height=\"144\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20-500x144.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20-230x66.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20-768x221.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20-510x147.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20-139x40.png 139w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_20.png 868w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>After that we can see first set of XOR data. It will take the next four bytes and XOR them with 0x1A1B1C1D and compare the result with 0x366C734A. It\u2019s time to start writing our decoder.<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">key = \"PAN{\"\r\nkey += (hex(0x366C734A ^ 0x1A1B1C1D)[2:]).decode('hex')[::-1]\r\n<\/pre>\n<p>Looks good so far...<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">python decoder.py\r\nPAN{Wow,\r\n<\/pre>\n<p>Let\u2019s move on to the next characters. The next code segment is doing some shifting and XOR based on the result of KdDebuggerNotPresent. Function KdDebuggerNotPresent should return 1 if there is no debugger attached. We also have to reverse the order to get the correct key:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:16.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19562 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21-500x81.png\" alt=\"windows_2_21\" width=\"500\" height=\"81\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21-500x81.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21-230x37.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21-510x83.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21-240x40.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_21.png 721w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">key += chr((0xB0 ^ 0xF0) &gt;&gt; 1)\r\n<\/pre>\n<p>The result is a space character (0x20 in hex). We can move on to the next character but we have to reverse the order again to get the correct character (instead of add, we have to use sub, etc.):<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:9.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19559 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22-500x46.png\" alt=\"windows_2_22\" width=\"500\" height=\"46\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22-500x46.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22-230x21.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22-510x47.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22-240x22.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_22.png 758w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">key += chr((0x56 ^0x20) - 4)\r\n<\/pre>\n<p>Now we just have to continue to slowly decode the whole flag but it gets trickier with a call to 0x140001AFC. At this function it will try to access characters at different offsets and do weirder calculations:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:86.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19556 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23-500x432.png\" alt=\"windows_2_23\" width=\"500\" height=\"432\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23-500x432.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23-230x199.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23-347x300.png 347w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23-46x40.png 46w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_23.png 533w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>For example, at 0x140001B41 it will load the fourth character and subtract 0x20 from it and multiply it with 3 [rax+rax*2] and then it will compare it with 0xC3. Optimizer can do some pretty cool stuff sometimes.<\/p>\n<p>After analyzing the whole function and its sub-functions, we get the following decoder script:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\"># 0x14000190A\r\nkey = \"PAN{\"\r\nkey += (hex(0x366C734A ^ 0x1A1B1C1D)[2:]).decode('hex')[::-1]\r\nkey += chr((0xB0 ^ 0xF0) &gt;&gt; 1)\r\nkey += chr((0x56 ^0x20) - 4)\r\nkey += (hex((0x8888999900001110 &amp; 0xFFFFFFFFFFFFFFF0) ^ 0x0A9FAFCEA72656775))[2:-\r\n1].decode('hex')[::-1]\r\n# 0x140001AFC\r\nkey += chr(0x20)\r\nkey += chr(0x67 - 0x20)\r\nkey += chr(0x72)\r\nkey += chr(0xfc ^ 0x99)\r\nkey += chr((0xc3 \/ 3) + 0x20)\r\nkey += chr(0x3b ^ 0x4f)\r\nkey += chr(0x20)\r\nkey += chr((0x71 - 0x0f) ^ 0x0f)\r\nkey += chr((0x81 ^ 0x21) - 0x31)\r\nkey += chr(0x46 + 0x30)\r\nkey += chr((1 ^ 0x58) + 0x0c)\r\nkey += chr(0x73)\r\n# 0x140001BD4\r\nkey += chr(0x2c)\r\nkey += chr(0x20)\r\nkey += chr(0x1ac0 &gt;&gt; 6)\r\nkey += chr(0x328 \/ 8)\r\nkey += chr((0xe002 ^ 0xf2f2) \/ 0x30)\r\nkey += chr((0x9542 ^ 0x8942) &gt;&gt; 6)\r\nkey += chr(0x1f + 1)\r\nkey += chr(0x834 * 4 \/ 0x50)\r\nkey += chr((0x94dd ^ 0x83c1) \/ 0x33)\r\nkey += chr(0x1f + 1)\r\nkey += chr((0x1dd36c ^ 0x46) \/ 0x4142)\r\nkey += chr(0x328250 \/ 0x7373)\r\n# 0x140001CD8\r\nkey += chr((0xb6 ^ 0x32) \/ 3)\r\nkey += chr(0x40 - 0x20)\r\nkey += chr((0xd7 ^ 0x44) - 0x23)\r\nkey += chr((0xb2 ^ 0x21) - 0x21)\r\nkey += chr(0x1bc \/ 4)\r\nkey += chr((0x8f25 ^ 0x8875) &gt;&gt; 4)\r\nkey += chr(((0x0d6 ^ 0x0e4) \/ 2) &lt;&lt; 2)\r\nkey += chr((0x62 ^ 0x42) &amp; 0xfe)\r\n# 0x140001DB8\r\nkey += chr((0x70d49 ^ 0x48354) \/ 0x833)\r\nkey += chr((0x14c3a1 ^ 0x232221) \/ 0x8c40)\r\nkey += chr(0xA0 ^ 0x80)\r\n# 0x140001E2C\r\nkey += chr(0x5c ^ 0x25)\r\nkey += chr((0x20f63 ^ 0x23) \/ 0x4c0)\r\nkey += chr((0x242067 ^ 0x12567) \/ 0x5100)\r\nkey += chr(((0x61 ^ 0x21) &gt;&gt; 6) + 0x20)\r\nkey += '}'\r\n\r\nprint key\r\n\r\npython decoder.py\r\n\r\nPAN{Wow, reverser! Great moves, keep it up, proud of you!}\r\n<\/pre>\n<h4>Testing the flag<\/h4>\n<p>Now we\u2019ll test the flag to confirm if everything is correct. We have to do following steps:<\/p>\n<ul>\n<li>Create a file named \u201cgsrt.txt\u201d with content \u201clabyrenth.com\u201d<\/li>\n<li>Open \u201cgsrt.txt\u201d to raise a FILE_OPEN event to initialize the buffer\n<ul>\n<li>We can also create a mailsot event instead of these two steps (we can use CreateMailslot + WriteFile)<\/li>\n<\/ul>\n<\/li>\n<li>Create a file named \u201cpan.flag\u201d with our flag \u201cPAN{\u2026}\u201d<\/li>\n<li>Open \u201cpan.flag\u201d to raise a FILE_OPEN event to call the analyzing function<\/li>\n<li>Attach with DbgView to see the kernel debug output<\/li>\n<\/ul>\n<p>The solution with creating a file is easier because we can make a batch file to do the job for us:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">Solution.bat\r\necho PAN{Wow, reverser! Great moves, keep it up, proud of you!} &gt; c:\\pan.flag\r\necho labyrenth.com&gt; c:\\gsrt.txt\r\nstart notepad c:\\gsrt.txt\r\nstart notepad c:\\pan.flag\r\n<\/pre>\n<p>We run revloader.exe and run our solution batch file and see what happens:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:70.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"alignnone size-large wp-image-19553 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24-500x352.png\" alt=\"windows_2_24\" width=\"500\" height=\"352\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24-500x352.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24-230x162.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24-768x541.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24-426x300.png 426w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24-57x40.png 57w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_24.png 932w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>And we can see in the last screenshot that the flag is correct and it gets printed out.<\/p>\n<h3>Windows 9 Challenge: I think some holy dude wrote that crypter.<\/h3>\n<p><em>Challenge Created By: Esmid Idrizovic <a href=\"https:\/\/twitter.com\/xedi25\" rel=\"nofollow,noopener\"  target=\"_blank\">@xedi25<\/a><\/em><\/p>\n<h4>Initial analysis<\/h4>\n<p>When we run the final challenge, we see a dialog where we have to enter 30 characters. We can also see that the icon is different and that it\u2019s the default Delphi 7 executable icon. If we enter any text and press enter we see that the label changes to \u201cWrong\u201d. That means that we have to enter the correct flag and press enter to verify it.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:20.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19550 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25-500x101.png\" alt=\"windows_2_25\" width=\"500\" height=\"101\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25-500x101.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25-230x46.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25-768x154.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25-510x103.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25-199x40.png 199w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_25.png 890w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>If we open that sample in a PE viewer, we see that it\u2019s using an unknown EXE crypter to hide its code (actually that crypter is Morphine 2.7 which is also written in Delphi). We can see that by looking at the import table there are just LoadLibraryA, GetProcAddress, and the PE sections.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:57.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19547 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26-500x287.png\" alt=\"windows_2_26\" width=\"500\" height=\"287\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26-500x287.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26-230x132.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26-510x293.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26-70x40.png 70w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_26.png 763w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We can solve this challenge pretty fast if we know what we have to look for. We want to identify the routine that is checking for a valid flag. We can start our analysis at the function which sets the status to \u201cWrong\u201d, but before we can do that we have to dump the executable so we can load it in IDA Pro.<\/p>\n<h4>Dump the executable<\/h4>\n<p>We can use Scylla x86 to dump the process, so let\u2019s execute the challenge and run Scylla. Select \u201cDelphiChallenge.exe\u201d, press \u201cIAT Autosearch\u201d, after that press \u201cGet Imports\u201d and Scylla should be able to find the imports.\u00a0 You can already see the correct imports in next screenshot:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:98.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19544 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-500x491.png\" alt=\"windows_2_27\" width=\"500\" height=\"491\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-500x491.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-230x226.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-768x754.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-306x300.png 306w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-41x40.png 41w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-32x32.png 32w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27-64x64.png 64w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_27.png 867w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We can save the PE dump using \u201cDump\u201d and \u201cFix dump\u201d functions in Scylla. We can\u2019t run that dumped file but it\u2019s enough for a static analysis in IDA Pro. We can dump the file correctly but it takes a few extra steps (see extra part).<\/p>\n<h4>Static analysis<\/h4>\n<p>Now open the file in IDA Pro and go directly to \u201cstrings window\u201d by using Shift+F12. Search in strings window for \u201cWrong\u201d and you should see these 5 entries:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:60.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19541 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28-500x302.png\" alt=\"windows_2_28\" width=\"500\" height=\"302\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28-500x302.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28-230x139.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28-496x300.png 496w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28-66x40.png 66w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_28.png 577w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>If we follow the first string using cross-references, we can see that it\u2019s referenced in sub_4C17BC and there is one more interesting string:<\/p>\n<p>If byte_4C4C5C is nonzero then it will show \u201cCorrect!! You are so g00d\u201d. Following byte_4C4C5C we can see that its set to 1 at offset 0x004C127F and that function starts at offset 0x004C0E1C. This function looks like our testing flag routine.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_30.png\"><div style=\"max-width:100%\" data-width=\"469\"><span class=\"ar-custom\" style=\"padding-bottom:111.94%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-19535 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_30.png\" alt=\"windows_2_30\" width=\"469\" height=\"525\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_30.png 469w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_30-230x257.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_30-268x300.png 268w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_30-36x40.png 36w\" sizes=\"auto, (max-width: 469px) 100vw, 469px\" \/><\/span><\/div><\/a><\/p>\n<p>We have identified pretty quickly the routine which is checking for the correct flag, now we have to analyze that function. It\u2019s pretty similar to Windows track challenge 8. We know that the flag must start with \u201cPAN{\u201c and we can see that the function is checking for that at the beginning:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:52.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19532 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31-500x263.png\" alt=\"windows_2_31\" width=\"500\" height=\"263\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31-500x263.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31-230x121.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31-510x268.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31-76x40.png 76w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_31.png 517w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We have to follow the function and revert the calculations again like in Windows challenge 8. The final decoder script would look like this:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">key = \"PAN{\"\r\nkey += chr(0xcf ^ 0xab)\r\nkey += chr(0x1e ^ 0x2d)\r\nkey += chr(0x3e ^ 0x52)\r\nkey += chr(0x52 ^ 0x22)\r\nkey += chr(0x08 ^ 0x60)\r\nkey += chr(0x68 + 0x01)\r\nkey += chr(0xe5 ^ 0xba)\r\nkey += chr(0xd7 ^ 0xbe)\r\nkey += chr(0xe6 \/ 2)\r\nkey += chr((0x2f &lt;&lt; 1) + 1)\r\nkey += chr(0x194 &gt;&gt; 2)\r\nkey += chr((0x19 &lt;&lt; 1) + 2)\r\nkey += chr((0x1c0 ^ 0x0c) &gt;&gt; 2)\r\nkey += chr(((0x38 ^0x04) &lt;&lt; 1) + 1)\r\nkey += chr(((0x28 + 0x07) &lt;&lt; 1) + 1)\r\nkey += chr(((0x8c \/ 0x0A) &lt;&lt; 3) + 4)\r\nkey += chr(0x60 \/ 2)\r\nkey += chr(0x17c &gt;&gt; 2)\r\nkey += chr((0x59 ^ 0x60) &lt;&lt; 1)\r\nkey += chr((0x42 ^ 0x88) \/ 2)\r\nkey += chr((0x0c0 ^ 0x2c) \/ 2)\r\nkey += chr((0x16 &lt;&lt; 1) + 7)\r\nkey += chr((0x36 ^ 0x29a) \/ 6)\r\nkey += chr(((0x130f0 \/ 8) ^ 0x2486) \/ 8)\r\nkey += chr(((0x2950 ^0x25a0) \/ 0x30))\r\nkey += chr(0x7d)\r\nprint key\r\n\r\npython decoder.py\r\nPAN{d3lphi_is_e4sy_t0_rev3rSE}\r\n<\/pre>\n<p>We can now test and verify if that flag is correct.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:20.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19529 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32-500x101.png\" alt=\"windows_2_32\" width=\"500\" height=\"101\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32-500x101.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32-230x46.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32-510x103.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32-198x40.png 198w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_32.png 654w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<h4>Extra: Manual unpacking<\/h4>\n<p>If we want do dump the process correctly we can use OllyDbg and OllyDump. To identify the original entry point (OEP) we can use the \u201cset hardware breakpoint at current ESP\u201d technique. For that we have to run the first instruction, go to the dump window and jump to the ESP. Then we can set a \u201cHardware, on access\u201d breakpoint at current address.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:55.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19526 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33-500x277.png\" alt=\"windows_2_33\" width=\"500\" height=\"277\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33-500x277.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33-230x128.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33-768x426.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33-510x283.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33-72x40.png 72w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_33.png 1017w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>If we press F9 a few times we will reach the original entry point. Now we have to do some calculations and dump it to a new file.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:43.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19523 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34-500x219.png\" alt=\"windows_2_34\" width=\"500\" height=\"219\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34-500x219.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34-230x101.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34-510x224.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34-91x40.png 91w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_34.png 702w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>For calculating the real OEP we need to know at which address the executable has been loaded.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:6.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19520 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35-500x31.png\" alt=\"windows_2_35\" width=\"500\" height=\"31\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35-500x31.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35-230x14.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35-510x31.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35-240x15.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_35.png 702w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Now we just have to subtract these offsets and we get the correct offsets for OllyDump.<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">Calculations:\r\nOEP: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x00941b60\r\nAddress: \u00a0 \u00a0 \u00a0 \u00a00x008F0000\r\nSize: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a00x001F0000\r\nImageBase: \u00a0 0x008F0000\r\n\r\nNew EP: \t(0x00941b60 - 0x008F0000) = 0x51B60\r\n<\/pre>\n<p>Now let\u2019s fill that data into OllyDump and dump the file as \u201cdumped.exe\u201d:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:80.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19517 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36-500x404.png\" alt=\"windows_2_36\" width=\"500\" height=\"404\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36-500x404.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36-230x186.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36-371x300.png 371w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36-49x40.png 49w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_36.png 533w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>But something is still wrong if we try to execute the unpacked sample:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Something-wrong.png\"><div style=\"max-width:100%\" data-width=\"440\"><span class=\"ar-custom\" style=\"padding-bottom:36.82%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-19631 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Something-wrong.png\" alt=\"something-wrong\" width=\"440\" height=\"162\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Something-wrong.png 440w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Something-wrong-230x85.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Something-wrong-109x40.png 109w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/span><\/div><\/a><\/p>\n<p>It\u2019s probably the import table that causes problems, but we can use Scylla to fix that for us. For that we have to run DelphiChallenge.exe again (new process) and search for the import table. We also have to enter the correct entry point + image base:<\/p>\n<pre class=\"&quot;lang:default\" decode:true=\"\">EP + Imagebase:\t0x51B60 + 0x8F0000 = 0x941B60\r\n<\/pre>\n<p>Now we can use \u201cFix dump\u201d and fix the dumped.exe executable:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:108.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19511 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38-500x541.png\" alt=\"windows_2_38\" width=\"500\" height=\"541\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38-500x541.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38-230x249.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38-277x300.png 277w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38-37x40.png 37w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_38.png 607w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Scylla has created a new import table and now we can run the unpacked executable. Yey.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:23.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-19508 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39-500x118.png\" alt=\"windows_2_39\" width=\"500\" height=\"118\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39-500x118.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39-230x54.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39-768x181.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39-510x120.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39-170x40.png 170w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/Windows_2_39.png 975w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Leave a comment below to share your thoughts about these challenges. Be sure to also check out how other threat researchers solved these challenges:<\/p>\n<p><strong><span class=\"s1\">Windows 7:<\/span><\/strong><\/p>\n<ul>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/jmprsp.wordpress.com\/2016\/09\/08\/labyrenth-ctf-windows-track-challenge-7\" rel=\"nofollow,noopener\" >https:\/\/jmprsp.wordpress.com\/2016\/09\/08\/labyrenth-ctf-windows-track-challenge-7<\/a><\/span><span class=\"s3\">\/<\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/gray-panda\/grayrepo\/tree\/master\/2016_labyREnth\/win7_pcap\" rel=\"nofollow,noopener\" >https:\/\/github.com\/gray-panda\/grayrepo\/tree\/master\/2016_labyREnth\/win7_pcap<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/uafio\/git\/blob\/master\/scripts\/labyREnth-2016\/labyrenth-2016-win-7.py\" rel=\"nofollow,noopener\" >https:\/\/github.com\/uafio\/git\/blob\/master\/scripts\/labyREnth-2016\/labyrenth-2016-win-7.py<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/11x256\/CTFs\/tree\/master\/2016\/LabyREnth\/7-PCAP\" rel=\"nofollow,noopener\" >https:\/\/github.com\/11x256\/CTFs\/tree\/master\/2016\/LabyREnth\/7-PCAP<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/spartansecurity\/Writeups\/blob\/master\/labyrenth2016\/windows.md#challenge-7\" rel=\"nofollow,noopener\" >https:\/\/github.com\/spartansecurity\/Writeups\/blob\/master\/labyrenth2016\/windows.md#challenge-7<\/a><\/span><\/li>\n<\/ul>\n<p class=\"p1\"><strong><span class=\"s1\">Windows 8:\u00a0<\/span><\/strong><\/p>\n<ul>\n<li class=\"p1\"><span class=\"s2\"><a href=\"https:\/\/jmprsp.wordpress.com\/2016\/09\/16\/labyrenth-ctf-windows-track-challenge-8\" rel=\"nofollow,noopener\" >https:\/\/jmprsp.wordpress.com\/2016\/09\/16\/labyrenth-ctf-windows-track-challenge-8<\/a><\/span><span class=\"s3\">\/<\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/gray-panda\/grayrepo\/tree\/master\/2016_labyREnth\/win8_revhunt\" rel=\"nofollow,noopener\" >https:\/\/github.com\/gray-panda\/grayrepo\/tree\/master\/2016_labyREnth\/win8_revhunt<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"http:\/\/sibears.ru\/labs\/labyrenth2016-win-8\" rel=\"nofollow,noopener\" >http:\/\/sibears.ru\/labs\/labyrenth2016-win-8<\/a><\/span><span class=\"s3\">\/<\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/uafio\/git\/blob\/master\/scripts\/labyREnth-2016\/labyrenth-2016-win-8.py\" rel=\"nofollow,noopener\" >https:\/\/github.com\/uafio\/git\/blob\/master\/scripts\/labyREnth-2016\/labyrenth-2016-win-8.py<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/11x256\/CTFs\/tree\/master\/2016\/LabyREnth\/8-Revhunt\" rel=\"nofollow,noopener\" >https:\/\/github.com\/11x256\/CTFs\/tree\/master\/2016\/LabyREnth\/8-Revhunt<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/spartansecurity\/Writeups\/blob\/master\/labyrenth2016\/windows.md#challenge-8\" rel=\"nofollow,noopener\" >https:\/\/github.com\/spartansecurity\/Writeups\/blob\/master\/labyrenth2016\/windows.md#challenge-8<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"http:\/\/findingvulns.blogspot.sg\/2016\/08\/labyrenth-ctf-2016-windows-track.html\" rel=\"nofollow,noopener\" >http:\/\/findingvulns.blogspot.sg\/2016\/08\/labyrenth-ctf-2016-windows-track.html<\/a><\/span><\/li>\n<\/ul>\n<p><strong><span class=\"s1\">Win<\/span><span class=\"s1\">dows 9:<\/span><\/strong><\/p>\n<ul>\n<li><span class=\"s2\"><a href=\"https:\/\/jmprsp.wordpress.com\/2016\/09\/19\/labyrenth-ctf-windows-track-challenge-9\" rel=\"nofollow,noopener\" >https:\/\/jmprsp.wordpress.com\/2016\/09\/19\/labyrenth-ctf-windows-track-challenge-9<\/a><\/span><span class=\"s3\">\/<\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/gray-panda\/grayrepo\/tree\/master\/2016_labyREnth\/win9_delphichal\" rel=\"nofollow,noopener\" >https:\/\/github.com\/gray-panda\/grayrepo\/tree\/master\/2016_labyREnth\/win9_delphichal<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"http:\/\/sibears.ru\/labs\/labyrenth2016-win-9\/\" rel=\"nofollow,noopener\" >http:\/\/sibears.ru\/labs\/labyrenth2016-win-9\/<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/uafio\/git\/blob\/master\/scripts\/labyREnth-2016\/labyrenth-2016-win-9.txt\" rel=\"nofollow,noopener\" >https:\/\/github.com\/uafio\/git\/blob\/master\/scripts\/labyREnth-2016\/labyrenth-2016-win-9.txt<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/11x256\/CTFs\/tree\/master\/2016\/LabyREnth\/9-Delphi%20challenge\" rel=\"nofollow,noopener\" >https:\/\/github.com\/11x256\/CTFs\/tree\/master\/2016\/LabyREnth\/9-Delphi%20challenge<\/a><\/span><\/li>\n<li class=\"p2\"><span class=\"s2\"><a href=\"https:\/\/github.com\/spartansecurity\/Writeups\/blob\/master\/labyrenth2016\/windows.md#challenge-9\" rel=\"nofollow,noopener\" >https:\/\/github.com\/spartansecurity\/Writeups\/blob\/master\/labyrenth2016\/windows.md#challenge-9<\/a><\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back to our blog series where we reveal the\u00a0solutions\u00a0to\u00a0LabyREnth, the Unit 42 Capture the Flag (CTF)\u00a0challenge. We\u2019ll be revealing the\u00a0solutions\u00a0to one challenge track per week. Next up, the Windows track challenges &hellip;<\/p>\n","protected":false},"author":138,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[133],"tags":[2644,2145,2142,586,882],"coauthors":[1312,1116,2693],"class_list":["post-19505","post","type-post","status-publish","format-standard","hentry","category-events","tag-capture-the-flag","tag-ctf","tag-labyrenth","tag-unit-42","tag-windows"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts\/19505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/users\/138"}],"replies":[{"embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/comments?post=19505"}],"version-history":[{"count":12,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts\/19505\/revisions"}],"predecessor-version":[{"id":19923,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts\/19505\/revisions\/19923"}],"wp:attachment":[{"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/media?parent=19505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/categories?post=19505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/tags?post=19505"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/coauthors?post=19505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}