{"id":18169,"date":"2016-09-01T17:37:34","date_gmt":"2016-09-02T00:37:34","guid":{"rendered":"https:\/\/www.paloaltonetworks.com\/blog\/?p=18169"},"modified":"2016-09-01T17:57:30","modified_gmt":"2016-09-02T00:57:30","slug":"labyrenth-capture-the-flag-ctf-threat-track-solutions","status":"publish","type":"post","link":"https:\/\/www2.paloaltonetworks.com\/blog\/2016\/09\/labyrenth-capture-the-flag-ctf-threat-track-solutions\/","title":{"rendered":"LabyREnth Capture the Flag (CTF): Threat Track Solutions"},"content":{"rendered":"<p>Welcome back to our blog series where we reveal the\u00a0solutions\u00a0to <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 <a href=\"https:\/\/www.paloaltonetworks.com\/blog\/tag\/ctf\/\" target=\"_blank\">solutions<\/a> to one challenge track per week. Next up, the Threat track.<!--more--><\/p>\n<h3>Threat 1 Challenge: Welcome to the well of wishes!<\/h3>\n<p><em>Challenge Created By: Jeff White <\/em><a href=\"https:\/\/twitter.com\/noottrak\" rel=\"nofollow,noopener\"  target=\"_blank\"><em>@noottrak<\/em><\/a><\/p>\n<p>For this challenge you\u2019re provided a PCAP that has 30 HTTP GET Requests to <a href=\"http:\/\/www.dopefish.com\" rel=\"nofollow,noopener\"  target=\"_blank\">www.dopefish.com<\/a>. Inside each request is the same URL to the below image and a base64, reversed, string that decodes to \u201cNot everything is as it seems...\u201d.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:57.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18346 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1-500x289.png\" alt=\"CTF_Threat_1\" width=\"500\" height=\"289\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1-500x289.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1-230x133.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1-510x295.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1-69x40.png 69w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_1.png 663w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Looking at the actual GET requests, the URL structure is interesting as there are a few sections in the URL that remain static between the URLs so we\u2019ll go ahead and extract them all for further analysis.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:74.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18334 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2-500x371.png\" alt=\"CTF_Threat_2\" width=\"500\" height=\"371\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2-500x371.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2-230x170.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2-768x569.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2-405x300.png 405w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2-54x40.png 54w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_2.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Using the below command extracts each URL.<\/p>\n<p>tcpdump -r dopefish_labyrinth.pcap -A |grep \"GET \/\" |grep -o \"\/.*\" |sort \u2013u<\/p>\n<p>The general breakdown of the URL is as follows:<\/p>\n<p>\/M[a-zA-Z]{3}.php?=owVXdTMzc[a-zA-Z0-9]{109}&amp;L4bry1nth_[0-9]{3,5}?NxM[a-zA-Z0-9]{134}-[0-9]{4,5}%26%71%77port%3D27500<\/p>\n<p>Dropping the URL into an online URL parser shows that the query string being supplied to the file is the entire string after the initial \u201c?\u201d, which seems odd since there appears to be other variables in the URL.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:78%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18331 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3-500x390.png\" alt=\"CTF_Threat_3\" width=\"500\" height=\"390\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3-500x390.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3-230x180.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3-768x600.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3-384x300.png 384w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3-51x40.png 51w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_3.png 899w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Further analysis shows that the URL is not correctly formatted as \u201c?\u201d and \u201c=\u201d are reserved characters. When they are placed next to each other, without variables in-between, the rest of the URL becomes invalid.<\/p>\n<p>Looking at the query string starting with \u201c=\u201d and the above hint with a reverse base64 string beginning with the same symbol, I try to base64 decode the reversed string\u2026which works, but the output is of no use.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:3%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18328 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4-500x15.png\" alt=\"CTF_Threat_4\" width=\"500\" height=\"15\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4-500x15.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4-230x7.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4-768x23.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4-510x15.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4-240x7.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_4.png 899w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>After taking a closer look at the URLs, I noticed there are definite patterns that stand out in the characters, but \u201cNxM\u201d continues to repeat itself roughly every 18 characters. More importantly, the NxM pattern that is seen in the first long string and the long string directly following the \u201c&amp;L4bry1nth_[0-9]{3,5}?\u201d section of the URL. By removing this and putting the two long strings together, reversing it, and base64 decoding it, we get much more usable results.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18325 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5-500x20.png\" alt=\"CTF_Threat_5\" width=\"500\" height=\"20\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5-500x20.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5-230x9.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5-768x30.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5-510x20.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5-240x9.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_5.png 897w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>\u201c317WW317WW317WW317WW317WW317WW317WW317WW317WW317WW317WW317<br \/>\nW317WW317WW317WW317WW317WW317WW317WW317WW317WW317WW317WW317<br \/>\nW317WW317WW317WW317WW317WW317WW317WW317WW317WW317WW317WW317<br \/>\nW317WW317WW\u201d<\/p>\n<p>Continuing to build on our previous line, we wrap it in a for loop and parse out only the two halves, reverse them, and print the result.<\/p>\n<p>for i in $(tcpdump -r dopefish_labyrinth.pcap -A |grep \"GET \/\" |grep -o \"\/.*\" |sort -u |cut -d\"=\" -f2 |cut -d\"-\" -f1 |sed -e 's\/&amp;L4bry1nth_.*?\/\/g'); do echo \"=$i\" |rev |base64 -D ; done<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:39.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18322 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6-500x196.png\" alt=\"CTF_Threat_6\" width=\"500\" height=\"196\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6-500x196.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6-230x90.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6-768x300.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6-510x199.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6-102x40.png 102w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_6.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>There is a very apparent pattern in the output. The last step we take is to add one more command to our line and strip out the \u201c317\u201d, which turns out was the \u201cNxM\u201d from the URL.<\/p>\n<p>for i in $(tcpdump -r dopefish_labyrinth.pcap -A |grep \"GET \/\" |grep -o \"\/.*\" |sort -u |cut -d\"=\" -f2 |cut -d\"-\" -f1 |sed -e 's\/&amp;L4bry1nth_.*?\/\/g'); do echo \"=$i\" |rev |base64 -D ; done |sed -e 's\/317\/\/g'<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:97.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18319 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-500x488.png\" alt=\"CTF_Threat_7\" width=\"500\" height=\"488\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-500x488.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-230x225.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-768x750.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-307x300.png 307w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-41x40.png 41w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7-32x32.png 32w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_7.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>The key is PAN{th3D0p3fshl1v3s}.<\/p>\n<h3>Threat 2 Challenge: The rest of us, we died with our honor.<\/h3>\n<p><em>Challenge Created By: <\/em>Micah Yates <a href=\"https:\/\/twitter.com\/m1kachu_\" rel=\"nofollow,noopener\"  target=\"_blank\">@m1kachu_<\/a><\/p>\n<p><em>The hint is referring to this awesome <\/em><a href=\"http:\/\/i.imgur.com\/srMDxbk.jpg\" rel=\"nofollow,noopener\"  target=\"_blank\"><em>web-comic<\/em><\/a><em>.<\/em><\/p>\n<p>To begin the challenge, we are given a file named jareth1.gif<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_8.png\"><div style=\"max-width:100%\" data-width=\"319\"><span class=\"ar-custom\" style=\"padding-bottom:120.06%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-18316 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_8.png\" alt=\"CTF_Threat_8\" width=\"319\" height=\"383\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_8.png 319w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_8-230x276.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_8-250x300.png 250w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_8-33x40.png 33w\" sizes=\"auto, (max-width: 319px) 100vw, 319px\" \/><\/span><\/div><\/a><\/p>\n<p>The thumbnail makes it look like a valid gif, but is it?<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/jareth1.gif\"><div style=\"max-width:100%\" data-width=\"461\"><span class=\"ar-custom\" style=\"padding-bottom:66.16%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-18598 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/jareth1.gif\" alt=\"jareth1\" width=\"461\" height=\"305\" \/><\/span><\/div><\/a><\/p>\n<p>The file opens and animates fine.<\/p>\n<p>Opening the gif with a hex editor, the header looks like a regular gif header.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:2.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18310 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10-500x12.png\" alt=\"CTF_Threat_10\" width=\"500\" height=\"12\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10-500x12.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10-230x6.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10-768x19.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10-510x12.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_10-240x6.png 240w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Scroll to the bottom, and this file is missing the standard gif trailer of 0x3B. (Read more about <a href=\"http:\/\/giflib.sourceforge.net\/whatsinagif\/bits_and_bytes.html\" rel=\"nofollow,noopener\"  target=\"_blank\">what\u2019s in a valid gif<\/a>.)<\/p>\n<p>The hex values at the end are not the standard gif trailer.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:2.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18307 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11-500x11.png\" alt=\"CTF_Threat_11\" width=\"500\" height=\"11\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11-500x11.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11-230x5.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11-768x17.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11-510x11.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_11-240x5.png 240w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>There is data appended to this gif.<\/p>\n<p>So what do we do with this information? One trick I like to employ with tampered image files is to do a reverse image lookup via Google. I upload the jareth1.gif file to google image search and get this back:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:53.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18304 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12-500x268.png\" alt=\"CTF_Threat_12\" width=\"500\" height=\"268\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12-500x268.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12-230x123.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12-510x274.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12-75x40.png 75w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_12.png 550w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Clicking through a few of the visually similar images we find this <a href=\"http:\/\/i.imgur.com\/CTKsJjN.gif\" rel=\"nofollow,noopener\" >gif<\/a>. It animates the same and has the same dimensions as our jareth1.gif but a different size.<\/p>\n<p>When diffing the two gifs, we can see that the original gif ended at offset 0x3436D with a valid trailer of 0x3B. Some shellcode and malware authors like to hide data by XOR-ing it with single or multi-byte hex values. Since it appears that the 0xAA bytes are repeating at the end of the file, and some data typically contains nulls, lets XOR the entire file by 0xAA.<\/p>\n<p>Now let\u2019s look at the leftover data\u2019s header:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:5.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18301 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13-500x29.png\" alt=\"CTF_Threat_13\" width=\"500\" height=\"29\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13-500x29.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13-230x13.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13-768x44.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13-510x29.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13-240x14.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_13.png 1057w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Based off of the header, it appears that the hidden data is a 7zip archive. Let\u2019s save off this XOR\u2019d data to another file.<\/p>\n<p>One trick I like to use is 7zip\u2019s ability to unzip files when the header is in the incorrect place. Simply use the command line or right click and select 7zip -&gt; Extract here.<\/p>\n<p>Decompressing that file gives us another file simply named \u201cfile\u201d.<\/p>\n<p>Taking a quick look at the header we see that this is an html file.<\/p>\n<p>Renaming it to file.html and opening it with a browser yields this glorious ASCII art of David Bowie:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:57.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18298 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14-500x286.png\" alt=\"CTF_Threat_14\" width=\"500\" height=\"286\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14-500x286.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14-230x131.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14-768x439.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14-510x291.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14-70x40.png 70w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_14.png 1001w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>So what now? There\u2019s no obfuscated javascript, just a seemingly incomprehensible mess of html. It also looks as if there is a repeating pattern of A7 A0 bookending some other data.<\/p>\n<p>Let\u2019s drop a section of that hex looking data into a hex editor:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:13%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18295 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15-500x65.png\" alt=\"CTF_Threat_15\" width=\"500\" height=\"65\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15-500x65.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15-230x30.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15-768x99.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15-510x66.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_15-240x31.png 240w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>None of it renders into ASCII, let\u2019s try XORing it with 2 byte 0xA7A0 to see if there\u2019s data underneath:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:14.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18292 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16-500x71.png\" alt=\"CTF_Threat_16\" width=\"500\" height=\"71\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16-500x71.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16-230x33.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16-768x109.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16-510x73.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16-240x34.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_16.png 1082w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Still nothing to work with, but it does look like it could possibly be ASCII text.<\/p>\n<p>Let\u2019s undo that and try again with the original single byte 0xAA:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17.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-18289 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17-500x69.png\" alt=\"CTF_Threat_17\" width=\"500\" height=\"69\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17-500x69.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17-230x32.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17-768x106.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17-510x70.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17-240x33.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_17.png 1080w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Much better. The text renders as:<\/p>\n<p>Write a YARA rule to find normal valid GIF files.<\/p>\n<p>Using the template below:<\/p>\n<ol>\n<li>replace each \"**\" pair in $header with the appropriate 6 bytes.<\/li>\n<li>replace each \"*\" in $trailer with the appropriate regex.<\/li>\n<li>replace the \"*\" in condition with the appropriate digit.<\/li>\n<\/ol>\n<pre class=\"lang:default decode:true\">rule valid_gif : valid_gif\r\n{\r\n        strings:\r\n\r\n\t\t\t$header = { ** ** ** ** ** ** }\r\n\t\t\t$trailer = *******\r\n\t\t\t\t\r\n        condition:\r\n\t\t\t$header at * and $trailer\r\n}\r\n\r\nUsing the information about proper gif structure we write the following correct rule:\r\n\r\nrule valid_gif : valid_gif\r\n{\r\n        strings:\r\n\r\n\t\t\t$header = { 47 49 46 38 39 61 }\r\n\t\t\t$trailer = \/\\x3B$\/\r\n\t\t\t\t\r\n        condition:\r\n\t\t\t$header at 0 and $trailer\r\n}\r\n<\/pre>\n<p>After reading this article about <a href=\"http:\/\/giflib.sourceforge.net\/whatsinagif\/bits_and_bytes.html\" rel=\"nofollow,noopener\"  target=\"_blank\">what\u2019s in a gif<\/a>:<\/p>\n<ol>\n<li>The header is self-explanatory.<\/li>\n<li>The regex format is required here to make sure there is no following data after the 3B<\/li>\n<li>And of course the header has to be at the beginning of the file at position 0<\/li>\n<\/ol>\n<p>Submitting the rule above will result in the key: PAN{848Y_wIsh3D_4w4y}<\/p>\n<h3>Threat 3 Challenge: Matryoshkas got nothing on me.<\/h3>\n<p><em>Challenge Created By: Josh Grunzweig <\/em><a href=\"https:\/\/twitter.com\/jgrunzweig\" rel=\"nofollow,noopener\"  target=\"_blank\"><em>@jgrunzweig<\/em><\/a><\/p>\n<p>For this challenge, we\u2019re presented with a Python script. When you run the script, the only output you receive is this:<\/p>\n<p>python h0ggle.py<br \/>\nYou fell into a pit and died... of dysentery.<\/p>\n<p>Looking at the script, it appears to base64 decode the data and decrypt it before passing it to exec() function. The data is rather large, with over one million characters. It\u2019s using AES for the encryption from the Crypto.Cipher suite and stepping through it with a debugger shows that it continues this iteration process where each blob of data executed contains the same code with a new blob of data.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:27%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18286 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18-500x135.png\" alt=\"CTF_Threat_18\" width=\"500\" height=\"135\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18-500x135.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18-230x62.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18-768x208.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18-510x138.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18-148x40.png 148w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_18.png 898w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Following this line of logic, we can quickly script out this process. We\u2019ll write each decrypted section to a new file and include the headers necessary to run it again, so on and so forth, until we reach the end.<\/p>\n<p>First, we\u2019ll create header.txt with the following data:<\/p>\n<p>#!\/usr\/bin\/env python<\/p>\n<p><strong>from <\/strong>Crypto.Cipher <strong>import <\/strong>AES <strong>as <\/strong>tiywynstbg<br \/>\n<strong>import <\/strong>base64 <strong>as <\/strong>ufjliotyds<br \/>\n<strong>import <\/strong>itertools <strong>as <\/strong>abtwsjxzys<br \/>\n<strong>from <\/strong>itertools <strong>import <\/strong>cycle, izip<br \/>\n<strong>def <\/strong>gasfewfesafds(message, key):<br \/>\n<strong>return ''<\/strong>.join(chr(ord(c)^ord(k)) <strong>for <\/strong>c,k <strong>in <\/strong>abtwsjxzys.izip(message, abtwsjxzys.cycle(key)))<\/p>\n<p>Next, we\u2019ll put together a one-liner to traverse the dark depths of Python and see where it leads.<\/p>\n<p>cp h0ggle.py h0ggle_1.py; for i in $(seq 1 50); do sed -e 's\/exec(\/print(\/g' h0ggle_$i.py &gt; temp; mv temp h0ggle_$i.py; python h0ggle_$i.py &gt; temp; cat header.txt temp &gt; h0ggle_$((i+1)).py; done<\/p>\n<p>We run into a syntax error on file h0ggle_28.py, which shows our dysentery error message.<\/p>\n<p>File \"h0ggle_28.py\", line 8<br \/>\nYou fell into a pit and died... of dysentery.<br \/>\n^<\/p>\n<p>Looking at h0ggle_27.py we can see how to safely cross the river!<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:31.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18283 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19-500x159.png\" alt=\"CTF_Threat_19\" width=\"500\" height=\"159\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19-500x159.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19-230x73.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19-768x245.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19-510x163.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19-125x40.png 125w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_19.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Key = PAN{all_dir3ctionz_l3ad_n0wh3r3}<\/p>\n<h3>Threat 4 Challenge: The same, but different.<\/h3>\n<p><em>Challenge Created By: <\/em>Micah Yates <a href=\"https:\/\/twitter.com\/m1kachu_\" rel=\"nofollow,noopener\"  target=\"_blank\">@m1kachu_<\/a><\/p>\n<p><em>The hint is referring to the previous yara challenge, Threat 2 Challenge: The rest of us, we died with our honor.<\/em><\/p>\n<p>To begin the challenge, we are given 6 word docs.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_20.png\"><div style=\"max-width:100%\" data-width=\"320\"><span class=\"ar-custom\" style=\"padding-bottom:115.31%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-18460 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_20.png\" alt=\"CTF_Threat_20\" width=\"320\" height=\"369\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_20.png 320w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_20-230x265.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_20-260x300.png 260w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_20-35x40.png 35w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/span><\/div><\/a><\/p>\n<p>Let\u2019s open them all up<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:51.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18457 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21-500x258.png\" alt=\"CTF_Threat_21\" width=\"500\" height=\"258\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21-500x258.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21-230x118.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21-768x396.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21-510x263.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21-78x40.png 78w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_21.png 1058w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>The files open and display the somewhat same word doc.<\/p>\n<p>Running the file command on all of these files results in:<\/p>\n<p>3673c9d7a5b2f978d3a34001d360ac485f22ed6fa868c8304eb99273a6efb268.doc: Microsoft Word 2007+<br \/>\n668bed5ed5d5effb3be659e8dab55c63369985064f7ee80f9365e75b34f6283d.doc: Microsoft Word 2007+<br \/>\n7717bd124dd0c0881afd6b327ff41b420bff77d3c5ae338a31cce5cfdcb3b5d0.doc: data<br \/>\n87f146c41082d7ba885f9433e0223b346f3032f7364bf18675b924a017994779.doc: Microsoft Word 2007+<br \/>\nafc502de73482404cc344301c207f27c7da7b31641cd2192b3bba40f3ab6964e.doc: Composite Document File V2 Document, Little Endian, Os: Windows, Version 6.1, Code page: 1252, Author: Micah Yates, Template: Normal.dotm, Last Saved By: Micah Yates, Revision Number: 2, Name of Creating Application: Microsoft Office Word, Create Time\/Date: Wed Jul 13 17:19:00 2016, Last Saved Time\/Date: Wed Jul 13 17:19:00 2016, Number of Pages: 1, Number of Words: 146, Number of Characters: 837, Security: 0<br \/>\nd48a2f4922bca81ce8fff8c18d788f41d2034c7999ca1ed03965d914dc06a9df.doc: Rich Text Format data, version 1, unknown character set<\/p>\n<p>They\u2019re not all the same file format, but all contain the same basic content. There\u2019s a .doc, .docx, .rtf, .mhtm, .dot, and .docm file with the same plaintext inside. Simply changing their extensions to .doc allows for Word to try and open them as a standard Word .doc<\/p>\n<p>Let\u2019s open up the RTF (d48a2f4922bca81ce8fff8c18d788f41d2034c7999ca1ed03965d914dc06a9df.doc) in a hex editor. They\u2019re typically fairly simple to follow. The header looks fine so lets scroll down to the bottom of the file.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:28%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18454 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22-500x140.png\" alt=\"CTF_Threat_22\" width=\"500\" height=\"140\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22-500x140.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22-230x65.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22-768x216.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22-510x143.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_22-143x40.png 143w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Looks weird right? Let\u2019s take a look at the RTF file format on Wikipedia, specifically the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Rich_Text_Format#Code_Syntax\" rel=\"nofollow,noopener\" >Code Syntax<\/a>:<\/p>\n<p>Get all that?<\/p>\n<p>So the TL;DR of that section states that RTF data must be within curly braces \u201c{}\u201d. This RTF file clearly has data appended to it.<\/p>\n<p>Remember the hint? \u201cThe same, but different.\u201dWell it seems this challenge is similar to the Threat 2 challenge. There is unknown data appended to a legitimate looking file.<\/p>\n<p>Let\u2019s attack the data that seems to be repeating. The appended data looks similar to base64 encoding, but somewhat obscured. Within this appended data we have 3 sequences of data that are 48 bytes long that are repeating.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18451 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23-500x10.png\" alt=\"CTF_Threat_23\" width=\"500\" height=\"10\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23-500x10.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23-230x5.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23-768x15.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23-510x10.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_23-240x5.png 240w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:1.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18448 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24-500x9.png\" alt=\"CTF_Threat_24\" width=\"500\" height=\"9\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24-500x9.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24-230x4.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24-768x14.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24-510x10.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_24-240x5.png 240w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Two of them are different, and of those, one is clearly not a valid Base64. (See <a href=\"https:\/\/en.wikipedia.org\/wiki\/Base64\" rel=\"nofollow,noopener\" >Wikipedia\u2019s definition of Base64<\/a>.)<\/p>\n<p>When there are sequences of four repeating characters in Base64 encoded data, the underlying data typically repeats in some sort of pattern. For example: AAAAAAAAA Base64 encoded is QUFBQUFBQUFB<\/p>\n<p>Let\u2019s assume these two different sequences are hiding the same data, but have encoded it differently due to data position. If that\u2019s true, it looks like both sequences have also been obscured by a single byte operation. So what do we do to figure out that operation? Brute Force!<\/p>\n<p>Let\u2019s write a small script that performs single byte operations on the two sequences and then test it to see if they\u2019re valid Base64 characters. In short, this runs a simple one byte XOR over each byte in the sequence and checks to see if they are ASCII compatible with Base64 characters.<\/p>\n<pre class=\"lang:default decode:true\">import sys, re\r\ndata_sequence = bytearray(open(sys.argv[1], 'rb').read())\r\n\r\ntest_output = \"\"\r\n\r\nkey = range(0,255)\r\nfor i in range(len(key)):\r\n    for j in data_sequence:\r\n        test_output+=(chr(i^j))\r\n    base64_test = test_output\r\n    test_output = \"\"\r\n    if re.match(\"(?:[A-Za-z0-9+\\\/]{8})\", base64_test):\r\n        print hex(i), base64_test\r\n<\/pre>\n<p>I truncated the two sequences above into an 8-byte sequence of data:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_25.png\"><div style=\"max-width:100%\" data-width=\"361\"><span class=\"ar-custom\" style=\"padding-bottom:29.92%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-18445 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_25.png\" alt=\"CTF_Threat_25\" width=\"361\" height=\"108\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_25.png 361w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_25-230x69.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_25-134x40.png 134w\" sizes=\"auto, (max-width: 361px) 100vw, 361px\" \/><\/span><\/div><\/a><\/p>\n<p>Running the script over these shortened sequences, it returns 4 XOR candidates:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_26.png\"><div style=\"max-width:100%\" data-width=\"189\"><span class=\"ar-custom\" style=\"padding-bottom:44.44%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-full wp-image-18442 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_26.png\" alt=\"CTF_Threat_26\" width=\"189\" height=\"84\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_26.png 189w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_26-90x40.png 90w\" sizes=\"auto, (max-width: 189px) 100vw, 189px\" \/><\/span><\/div><\/a><\/p>\n<p>So we have four potential XOR values that decode valid Base64 characters.<\/p>\n<p>Starting with XOR-ing the appended data with 0x26 we get this:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:83.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18439 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27-500x419.png\" alt=\"CTF_Threat_27\" width=\"500\" height=\"419\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27-500x419.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27-230x193.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27-768x644.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27-358x300.png 358w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27-48x40.png 48w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_27.png 1036w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Looks pretty promising, and almost all characters are Base64 standard except there are no \u201c+\u201d characters, only \u201c-\u201c.<\/p>\n<p>This looks like it may be using an alternate encoding string with \u201c-\u201c in place of \u201c+\u201d. If we try and decode with this alphabet: \u201cABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-\/\u201d, there is no data that looks promising.<\/p>\n<p>Some malicious Base64 encodings use alternate alphabets. Sometimes they\u2019re simple and just change up the position of the alphabet. Let\u2019s write another brute force script to rotate the position of the alphabet above, decode, and test to see if it has valid ASCII text.<\/p>\n<pre class=\"lang:default decode:true\">import string, base64, re\r\n\r\nSTANDARD_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/'\r\nCUSTOM_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-\/'\r\nROTATED_ALPHABET = CUSTOM_ALPHABET\r\ndef is_ascii(s):\r\n    return all(ord(c) &lt; 128 for c in s)\r\ninput_str = \"vRjD3gu6ysbzqvjbihjP1gu63gW6zgvOzwnOigfG1cbQyxjDyxrD1QTNigXAihrC0xm6zwT91Qr\/zcb-\r\nyxr7l6OkvxnD1A263g7\/ihr\/1xbGyxr\/igj\/1gXRihj\/2gL7yQu6zwf90ca8k8C8ihb70xi63Q\/O0cbO0gu\r\n6zA\/M2Rq6mti6yB\/OzxmUdqCncBjP1gu6zwT9xQrJyMaUigvIyPX-\r\n1QmncBGnc8a6ica6ica62RrM0wTB2NCnc6-jdqCjcq--\r\nzA\/M2Rq6psbVicCEicCEicCEicCEicCEicCEicCEicCEicCEicCEicCEicCEihOnc6-\r\njcsrNzwnJ1Aq6psbVicCEicCEicCEicCEicCEicCEicCEicCEicCEicCEicCEicCEihOnc6-\r\njcsrO0g\/MzcaXihG6k8C6k8C6k8C6k8C6k8C6k8C6k8C6k8C6k8C6k8C6k8C6k8C65qOkcq\r\n-jcqOkica6ica6icb91QT-0xrD1QSUdqCjcq-LigXAihrCzwOncBOa\"\r\n\r\ndef alt_decode(input):\r\n  return base64.b64decode(input.translate(DECODE_TRANS))\r\n\r\nfor rotate in range(len(CUSTOM_ALPHABET)):\r\n    ROTATED_ALPHABET = CUSTOM_ALPHABET[rotate:]+CUSTOM_ALPHABET[:rotate]\r\n    DECODE_TRANS = string.maketrans(ROTATED_ALPHABET, STANDARD_ALPHABET)\r\n    if is_ascii(alt_decode(input_str)):\r\n        print rotate, ROTATED_ALPHABET\r\n        print \"***************\"\r\n        print alt_decode(input_str) \r\n<\/pre>\n<p>So what we did in the script was enter our data that had been XOR-ed with 0x26. We defined an alternative Base64 alphabet and then looped through all variations of that alphabet by rotating the entire alphabet by one character per loop. We then checked each output to see if it was valid ASCII, and then printed it. Running the above code returns:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:32.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18436 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28-500x164.png\" alt=\"CTF_Threat_28\" width=\"500\" height=\"164\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28-500x164.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28-230x76.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28-768x252.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28-510x167.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28-122x40.png 122w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_28.png 923w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Here\u2019s the encoded data and clue. It appears that the decoding alphabet has been rotated by 26 characters.<\/p>\n<p>Would you look at that, three lines of repeating characters, all the same length: \u201c{ ** ** ** ** ** ** ** ** ** ** ** ** }\u201d<\/p>\n<p>So to recap, we brute-forced a single byte XOR, then brute forced an alternate base64 alphabet that had been rotated left by 26 characters.<\/p>\n<p>Going back through the other documents we find the two variations to this encoded data, and fill out the YARA rule like this:<\/p>\n<pre class=\"lang:default decode:true\">rule enc_doc : enc_doc\r\n{\r\n        strings:\r\n\t\t\r\n\t\t\t$first = { 50 74 4C 62 15 41 53 10 5F 55 44 5C }\r\n\t\t\t$second = { 4F 40 15 6B 16 5E 54 09 4F 41 43 10 }\r\n\t\t\t$third = { 4F 45 44 5E 14 67 09 69 5C 55 44 11 }\r\n\t\t\t\t\r\n        condition:\r\n\t\t\t1 of them\r\n}\r\n<\/pre>\n<p>Submitting the rule above will result in the key: PAN{7H1r7EEn-hOuR_71me_l1M17}<\/p>\n<h3>Threat 5 Challenge: Hello Confetti!<\/h3>\n<p><em>Challenge Created By: Anthony Kasza <\/em><a href=\"https:\/\/twitter.com\/anthonykasza\" rel=\"nofollow,noopener\" ><em>@anthonykasza<\/em><\/a><\/p>\n<p>Opening the provided \u201chello.pcap\u201d file with Wireshark and examining the protocol hierarchy within the pcap shows only UDP traffic. Wireshark believes a few of the packets are malformed real-time transport control packets while the majority of the packets are data.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:32.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18433 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29-500x161.png\" alt=\"CTF_Threat_29\" width=\"500\" height=\"161\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29-500x161.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29-230x74.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29-510x164.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29-124x40.png 124w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_29.png 749w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Observing the UDP conversations within Wireshark, only a single \u201cconnection\u201d occurred within the pcap. The connection is between port 9090 and 53321 on 127.0.0.1. The inconsistency of protocols above combined with a single connection within the trace file leads to the conclusion the protocol being used is non-standard.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:70.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18430 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30-500x354.png\" alt=\"CTF_Threat_30\" width=\"500\" height=\"354\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30-500x354.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30-230x163.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30-424x300.png 424w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30-57x40.png 57w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_30.png 647w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>The first packet in the trace contains the data \u201chello :)\u201d followed by an 0x0a. This is the only packet with a length that\u2019s not 8234 and sent from port 53321 to port 9090. The second packet contains data which starts with \u201cBZh\u201d which is the magic file header for a bzip file. Ignoring the first \u201chello\u201d packet, a bzip archive can be extracted from the trace file. Decompressing the bzip archive reveals a second pcap trace.<\/p>\n<p>Using similar techniques as before, multiple FTP over IPv6 connections can be observed within the pcap. Following one of the FTP connections reveals a series of requests and responses, which all streams mimic:<\/p>\n<ul>\n<li>an anonymous FTP login occurs<\/li>\n<li>a series of change directory commands is issued to \/this\/is\/going\/to\/be\/so\/much\/fun\/<\/li>\n<li>a size request for a file resulting in a response of 61052<\/li>\n<li>a REST request for a specified byte offset of the file<\/li>\n<li>the TCP connection is then reset<\/li>\n<\/ul>\n<p>This series of commands is indicative of an FTP range request.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:92.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18427 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31-500x464.png\" alt=\"CTF_Threat_31\" width=\"500\" height=\"464\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31-500x464.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31-230x213.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31-323x300.png 323w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31-43x40.png 43w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_31.png 655w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Reassembling the bytes of the file transferred via FTP range requests provides a tarball. Within the tarball is a third pcap trace file.<\/p>\n<p>Again, observing protocols and conversations within the pcap reveals multiple HTTP connections between two end points. By observing the HTTP response codes in the connections a participant may have noticed only \u201c206 Partial Content\u201d codes. These codes are used to respond to HTTP range requests. The \u201cRange\u201d header is also included in all requests issued within the trace file.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:56.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18424 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32-500x283.png\" alt=\"CTF_Threat_32\" width=\"500\" height=\"283\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32-500x283.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32-230x130.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32-510x288.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32-71x40.png 71w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_32.png 637w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Similar to FTP range requests, HTTP range requests can be used to request specific byte ranges for resources. Reassembling the byte ranges reveals a fourth and final packet trace file.<\/p>\n<p>Within this trace file is a single TLS session between a host and Google. Within the requested SNI names of the \u201cClient Hello\u201d message of the TLS exchange additional server names (besides www.google.com) are present. This should be a big red flag to participants as this indicates the client would accept HTTP host names besides www.google.com. These SNI entries are also not ASCII characters, which also may have been a red flag.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:70.6%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18421 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33-500x353.png\" alt=\"CTF_Threat_33\" width=\"500\" height=\"353\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33-500x353.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33-230x162.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33-425x300.png 425w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33-57x40.png 57w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_33.png 620w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>The additional SNI entries in hexadecimal representation follow:<\/p>\n<ol>\n<li>61707f4a<\/li>\n<li>6801117501561d11<\/li>\n<li>7811795450435511680144117d585a54116172706162110b75<\/li>\n<li>4c<\/li>\n<\/ol>\n<p>Knowing previous challenge flags took the form of \u201cPAN{ FLAG }\u201d XORing the first value of the first SNI entry, 0x61, with 0x50 (\u201cP\u201d in hexadecimal) revealed the key, 0x31, used to XOR the remaining characters with. Doing so produces the key for this challenge:<\/p>\n<p>PAN{Y0 D0g, I Heard Y0u Like PCAPS :D}<\/p>\n<p>This challenge tested the participant\u2019s knowledge of standard networking protocols and how these protocols can be (mis)used to fragment data at the application layer.\u00a0 It also tested the participant\u2019s tenacity as it was a rather long and obfuscation heavy challenge. Tools used to solve this challenge could include Wireshark, common command line utilities, Bro, and Python\u2019s dpkt module.<\/p>\n<h3>Threat 6 Challenge: There can only be one.<\/h3>\n<p><em>Challenge Created By: <\/em>Micah Yates <a href=\"https:\/\/twitter.com\/m1kachu_\" rel=\"nofollow,noopener\"  target=\"_blank\">@m1kachu_<\/a><\/p>\n<p><em>The hint is referring to the singular string required for the challenge YARA rule.<\/em><\/p>\n<p>We are given the following instructions in the directions.txt file:<\/p>\n<pre class=\"width-set:true lang:default decode:true\">Given the included archive of malware samples:\r\n\r\nFind the longest, contiguous, most efficient rule to catch all of them.\r\nThe rule must use the hexadecimal format. \r\nThe rule CANNOT fire on any other samples. ONLY the 48 provided.\r\nThe wildcard (\"?\" or \"??\") is allowed but not jumps \"[1-6]\". See http:\/\/yara.readthedocs.io\/en\/latest\/writingrules.\r\nhtml#hexadecimal-strings \r\nThe samples are included in yara_samples.7z password is \"infected\"\r\n\r\nThe rule must follow this example format:\r\n\r\nrule yara_challenge\r\n{\r\n\tstrings:\r\n\t\t$yara_challenge = { de ad b? ef ?? ??}\r\n\tcondition:\r\n\t\t all of them \r\n}\r\n\r\nYou will change the contents of $yara_challenge from \"de ad b? ef ?? ??\" to a hex formatted rule that will catch all\r\n48 samples.\r\n\r\nUse this template when submitting your rule:\r\n\r\nrule yara_challenge\r\n{\r\n\tstrings:\r\n\t\t$yara_challenge = { ** ** ** ** ** ** }\r\n\tcondition:\r\n\t\t all of them \r\n}\r\n\r\n\r\nHint:\r\nThere are 52 wildcard \"?\"'s within the answer\r\n\r\nMalware samples have the following sha256 hashes:\r\n0050e14f8e6bca0b2b99708f0659e38f407debec5ab7afc71de48fb104508a60\r\n04a23b3cb2d6361df66ca94a470ffa1017a8e5cd3255ce342219765d7d4619bc\r\n104a657a127f86f7b3c0266374d3c8190089600649bfec9d022a1db5a593ff05\r\n10611281e1ccbdbb578b5d5e2b5d3bb101b137313f30488859d33efc0b0a2d49\r\n16efd909ed255628ad4da000cb7a2d1efda45ba3c549cb6c89017f92ffe3661f\r\n190759abb680efcc7e3ae3321089b43dbf3fa96a5d23a1cfb67b0eac4479bd7e\r\n1bbeca916a642737c0a0366afdf5054b4c34763f3ef182ce02fbd47330df08a5\r\n1d0d00c76353c8a1d2e33af602238244f0e0417193d7f65cfca4f4b576107071\r\n2037ffebd0249c148a7aace14bddb1e722676449a1fb2e242c54de9507aa9891\r\n383f0d2cbf8914c3ecb23ea82bff38e1c048980806e37d75e3539362d105675c\r\n3c14b486b84574dddb44e6090bea99f1635271aa9d2b34e121b9a6a7c63e20eb\r\n495a0660bbeebdf5c97066962a188b2df761f73ccd0056491a1a66a02f7d8b22\r\n4f0532e15ced95a1cebc13dd268dcbe7c609d4da237d9e46916678f288d3d9c6\r\n584da5ab12cecc1346990260edbddff27c6a8beb64fddb43e4a5e4c3c7aeafed\r\n5db8bb1cff115c3d984a560508dea374163d1579d61c64c5f8339bed21247858\r\n5dcdf2e8f1b9348bfd3330a31a70a4b5fc03dd86e45553dca9d85f74f9d8ec6c\r\n637aef27fca11245278a48f70535902570ef526ba19bcb8a675f07cdc7788993\r\n64a373487c4cc2b8b60687ecc01150b546b18be7069981c5fe5d48075190f1ff\r\n693f08996d40c0c2bdb25ae5457d44f9df694a8972a70fe989312753c7fe9ab4\r\n7c7700a4b8e19a168f7befb37155cdb133fec1fd5944e4ad57d483be40f9f5d5\r\n7d40062e8399a547f5578d462d3d864abf44a52a251f3d6dc0e3d0f2919b9b06\r\n7d5f4c2030022ca5db32716635f8b2f850fe74531d0dc1dc859e86dc9afdd411\r\n7e732e41d93b613cac1ba979d7f7c98c8603f65a50bbf6b6198f1ee396dc7174\r\n837485ae1a0d843692bac9f91ad3f3c77f576414c2f1abc477b053dbc3302939\r\n873276d9f8cbf3206408319f5579048663b30cb8f36b1a1a0a08e74a2685c688\r\n8cea8428c05a2845315cbdd64daa9bfcfc6ee49f935923786452db8b7e395662\r\n98fe63c98c8865781a7ef52b8b105dd3eeb444dfe3242468af0211eadd4076a5\r\na0d777ff492a90ec6d9eff93e38e7b35cf0ff70111b7723dc48a88ccd468d1fa\r\na4ef1ce4dd797047944605ab1d94b6e7e091949635b04ffb4cb929e1c13a93b5\r\na52762177877479859e4f88a13f605ad1e69d759019cf49dcf026781375b74a7\r\nbb4f09d5fb61d65e48bfc235657a895280ebe9c0bb20ddff112edb6ab5a6114a\r\nc8acb5eab3b6019fda9609b2badd902d7be9ebdd042e2c244018589ff1398355\r\ncc170c55c076d3c280752bfb55b25b28cc4fa56c730a2df64e636f92b737ce01\r\nd8a6e6bace789a863e537f814cca587ae697e9a5533ae43288d76f3fcad4491f\r\ndbbd5d7944b1791027762a40a70b3c74772a9d31b5c67b6519394a1705edabcc\r\ndf391f2ffc4e001b1572bb0386504a2e6bc56b0446575be4035cb617f8f0c579\r\ne03bd4b39cf7bc80a5177abe797dd896df1c97c59ede45728a245f7b912def33\r\ne6a2b6355fd513a8ce24deef488ee3cc39f5d736915965875c54f81c19e52971\r\ne96de8414e0e438184d2352be17d1f31f2f309fe5f4c7c167dd4375fa28f96b0\r\ne9af4018616e4275c6b6af5531bb988431c1454d8567cc4f6c7d2b4dc63440aa\r\ne9d191e5a9565068627795d74eb6605f3878b6c5655955f72f69dffa5076e495\r\nea96636e1c8741efac1eefb673726087261fa23c680a8556abf36ec13409253f\r\nef3b6b3060ef897724cea9ac2080b1201d08c9e6a0dad0ecf492c08441a4f604\r\nf3b82f2c80c2ea5496407200bab1cc04f3679b80c74608aa03bfae37e62f992e\r\nf48db6b5d9d34ead2dc736cd7f8af15b7b6fb3e39fe0baf5eac52e1e3967795c\r\nf6a180cc3b31693739089a9966dd1feb107bb49216f1e3ed11baab8e4f6b5226\r\nf737829e9ad9a025945ad9ce803641677ae0fe3abf43b1984a7c8ab994923178\r\nfc2751ff381d75154c76da7a42211509f7cc3fd4b50956e36e53b4f7653534d5\r\n<\/pre>\n<p>So lets unzip the included archive and take a look at the included files.<\/p>\n<p>Based off of the above conditions, it appears that the rule must be exclusive to this set of 48 files. That rules out common repeating elements of a PE file, like header, padding etc. So I\u2019m going to look at data and functionality within the binaries.<\/p>\n<p>My approach to this problem would be to diff the two smallest files in the archive and see what code lines up. (If you have a paid version of IDA-Pro, you can use a free plugin, <a href=\"https:\/\/www.zynamics.com\/software.html\" rel=\"nofollow,noopener\" >BinDiff<\/a>.) We\u2019ll diff the two smallest files:<\/p>\n<ul>\n<li>fc2751ff381d75154c76da7a42211509f7cc3fd4b50956e36e53b4f7653534d5<\/li>\n<li>e96de8414e0e438184d2352be17d1f31f2f309fe5f4c7c167dd4375fa28f96b0<\/li>\n<\/ul>\n<p>Let\u2019s sort the diffed files by basic block count, this will give us the longest functions in the binaries.<\/p>\n<p>It looks like they\u2019re 100% the same according to bindiff. Looks promising.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:23.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18418 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34-500x117.png\" alt=\"CTF_Threat_34\" width=\"500\" height=\"117\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34-500x117.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34-230x54.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34-768x179.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34-510x119.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34-172x40.png 172w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_34.png 965w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Opening up both files at sub_10001000 in Hex View in IDA we can see that they\u2019re practically identical.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:108%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18415 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35-500x540.png\" alt=\"CTF_Threat_35\" width=\"500\" height=\"540\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35-500x540.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35-230x248.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35-768x829.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35-278x300.png 278w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35-37x40.png 37w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_35.png 962w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Since we\u2019re going to convert this hex to a yara rule lets open up these files in bash and convert them to text. Then do a silly grep for the beginning of the hex that matches and almost everything after that.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36.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-18412 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36-500x100.png\" alt=\"CTF_Threat_36\" width=\"500\" height=\"100\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36-500x100.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36-230x46.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36-768x154.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36-510x102.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36-199x40.png 199w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_36.png 976w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>This gives us a nice text file with all of the similar hex bytes:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:50.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18409 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37-500x254.png\" alt=\"CTF_Threat_37\" width=\"500\" height=\"254\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37-500x254.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37-230x117.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37-768x390.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37-510x259.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37-79x40.png 79w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_37.png 983w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>There are 48 unique lines, so it looks like we\u2019re on the right track. Next step is to write a python script to figure out the placement of those 52 wildcards.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:60%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18406 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38-500x300.png\" alt=\"CTF_Threat_38\" width=\"500\" height=\"300\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38-500x300.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38-230x138.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38-768x461.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38-67x40.png 67w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_38.png 977w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>This script checks line by line, then character by character to see if the hex text matches, if not it\u2019s replaced with a \u201c?\u201d. It then cuts off the rule after the 52<sup>nd<\/sup> occurrence of the \u201c?\u201d and prints out the rule:<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39.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-18403 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39-500x101.png\" alt=\"CTF_Threat_39\" width=\"500\" height=\"101\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39-500x101.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39-230x46.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39-768x155.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39-510x103.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39-199x40.png 199w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_39.png 999w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>We end up with a yara rule that catches all 48 samples:<\/p>\n<pre class=\"lang:default decode:true\">rule yara_challenge\r\n{\r\n\tstrings:\r\n\t\t$yara_challenge = { \r\n5153568B742414B9030000008BC633DB99F7F93BD375048BC6EB1683FA0175058D4602EB0C8\r\n3FA028D460174048B4424088D0C8500000000B856555555F7E98B4C241C8BC2C1E81F03D049\r\n3BCA7D065E33C05B59C3558D5601575289742414895C2428E8?E??00008BCE8B74241C8BE88B\r\nC18BFD83C404C1E902F3A58BC883E103F3A48B4C241C8B74242083F903C60429000F8C870000\r\n00B8ABAAAAAAF7E1D1EA8D04522BC8894C24108B7C242483C3048A0C2F83C703C1F90283E1\r\n3F897C24248A81?0???0?088441EFC8A4C2FFD8A442FFE83E103C1F804C1E10483E00F0BC88A8\r\n9?0???0?0884C1EFD8A442FFF8A4C2FFEC1F80683E10F83E003C1E1020BC18A80?0???0?08844\r\n1EFE8A4C2FFF83E13F4A8A81?0???0?088441EFF758B8B44241083F802754E8B4424248A0C288\r\nD7C2801C1F90283E13F8A91?0???0?08814338A04288A0F83E003C1F904C1E00483E10F0BC18\r\nA90?0???0?0885433018A0783E00F8A0C85?0???0?0884C3302C64433033DEB3883F80175368B\r\n4424248A1428C1FA0283E23F8A8A?0???0?0880C338A142883E203C1E2048A82?0???0?088443\r\n301B03D884433028844330383C30455C6043300E8?5??000083C4048BC35F5D5E5B59C390909\r\n09090909090909053568B74240C578BFE83C9FF33C0F2AEF7D1498BF98BC7250300008079054\r\n883C8FC4074065F5E33C05BC368?4 }\r\n\tcondition:\r\n\t\t all of them \r\n}\r\n<\/pre>\n<p>Submitting the rule above will result in the key: PAN{8oogI3_WonD3rL4nd}<\/p>\n<p>BONUS:<\/p>\n<p>If you combine the keys from all three yara challenges, they write out a Haiku about the Labyrinth Movie.<\/p>\n<h3>Threat 7 Challenge: There has been a breach of the Borg's drone network!<\/h3>\n<p><em>Challenge Created By: Jeff White <\/em><a href=\"https:\/\/twitter.com\/noottrak\" rel=\"nofollow,noopener\"  target=\"_blank\"><em>@noottrak<\/em><\/a><\/p>\n<p>For this challenge, we\u2019re given a Windows PE \u201cdrone.exe\u201d and when we run it we\u2019re greeted with a Borg Cube and some text about an apparent encryption.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:35.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18400 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40-500x177.png\" alt=\"CTF_Threat_40\" width=\"500\" height=\"177\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40-500x177.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40-230x82.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40-768x273.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40-510x181.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40-113x40.png 113w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_40.png 899w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Based on the text, it appears the URL (<a href=\"https:\/\/www.youtube.com\/watch?v=AyenRCJ_4Ww\" rel=\"nofollow,noopener\" >https:\/\/www.youtube.com\/watch?v=AyenRCJ_4Ww<\/a> - the Borg montra!) and key \u201cborgdata\u201d are encrypted to form the hash \u201c374316062B033D0A3E6A746B46560377367A3328393720611641435A400C0C0B7E6E69<br \/>\nE392C2C394E5B5B1717061B0A\u201d. Then an error occurs and another hash is displayed and the program exits.<\/p>\n<p>Looking at the strings for the program, a number of them immediately stand out and, after a quick trip to Google, imply that this PE was built with PyInstaller.<\/p>\n<p>__main__<\/p>\n<p>__file__<\/p>\n<p>%s returned %d<\/p>\n<p>pyi-windows-manifest-filename<\/p>\n<p>Cannot allocate memory for ARCHIVE_STATUS<\/p>\n<p>_MEIPASS2<\/p>\n<p>Cannot open self %s or archive %s<\/p>\n<p>PATH<\/p>\n<p>Failed to get executable path.<\/p>\n<p>GetModuleFileNameW: %s<\/p>\n<p>Failed to convert executable path to UTF-8.<\/p>\n<p>Py_DontWriteBytecodeFlag<\/p>\n<p>Cannot GetProcAddress for Py_DontWriteBytecodeFlag<\/p>\n<p>Py_FileSystemDefaultEncoding<\/p>\n<p>Cannot GetProcAddress for Py_FileSystemDefaultEncoding<\/p>\n<p>Py_FrozenFlag<\/p>\n<p>Cannot GetProcAddress for Py_FrozenFlag<\/p>\n<p>Py_IgnoreEnvironmentFlag<\/p>\n<p>PyInstaller is \u201ca program that packages Python programs into stand-alone executables.\u201dNow we know what we\u2019re dealing with. I decided that the quickest way to tackle this challenge would be to extract the Python script instead of trying to reverse-engineer a 9MB PE that wraps a Python script.<\/p>\n<p>After some more Google-Fu, we find PyInstaller Extractor on <a href=\"https:\/\/sourceforge.net\/projects\/pyinstallerextractor\/\" rel=\"nofollow,noopener\" >Sourceforge<\/a> and try to run it against our binary but immediately receive a traceback.<\/p>\n<p>Traceback (most recent call last):<br \/>\nFile \"pyinstxtractor11.py\", line 115, in &lt;module&gt;<br \/>\nfd=open(name,'wb')<br \/>\nIOError: [Errno 2] No such file or directory: ''<\/p>\n<p>Analyzing the traceback and the section of code where it happened, it looks like it had issues opening a file.<\/p>\n<pre class=\"lang:default decode:true\">    #Remove trailing null bytes from name\r\n    name=name.rstrip('\\00')\r\n\r\n    bpath=os.path.dirname(name)\r\n    if bpath!='':\r\n        #Check if path exists, create if not\r\n        if os.path.exists(bpath)==False:\r\n            os.makedirs(bpath)\r\n    fd=open(name,'wb')\r\n    fd.write(buf)\r\n    fd.close()\r\n<\/pre>\n<p>There were also some interesting files dropped before the program had the issue, which may be useful later.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:12.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18397 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41-500x62.png\" alt=\"CTF_Threat_41\" width=\"500\" height=\"62\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41-500x62.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41-230x28.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41-768x95.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41-510x63.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41-240x30.png 240w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_41.png 899w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Testing our assumption, we modify the script to print the \u2018name\u2019 field and can validate it\u2019s printing out the file names we saw written to disk.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:48.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"size-large wp-image-18394 aligncenter lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42-500x244.png\" alt=\"CTF_Threat_42\" width=\"500\" height=\"244\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42-500x244.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42-230x112.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42-510x249.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42-82x40.png 82w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_42.png 675w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>Given this, we simply wrap that action in a try\/except where we specify the filename as \u201cbroke\u201d if it is empty.<\/p>\n<pre class=\"lang:default decode:true\">    try:\r\n        fd=open(name,'wb')\r\n    except:\r\n        print \"broke file\"\r\n        fd=open(\"broke\u201d,'wb')<\/pre>\n<p>Running it again, we see a slew of files now get written to disk.<\/p>\n<p><div style=\"max-width:100%\" data-width=\"460\"><span class=\"ar-custom\" style=\"padding-bottom:77.83%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18568 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_43-1.png\" alt=\"CTF_threat_43\" width=\"460\" height=\"358\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_43-1.png 460w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_43-1-230x179.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_43-1-385x300.png 385w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_43-1-51x40.png 51w\" sizes=\"auto, (max-width: 460px) 100vw, 460px\" \/><\/span><\/div><\/p>\n<p>Looking at our \u201cbroke\u201d file, we see it\u2019s actually the script for the program!<\/p>\n<p><div style=\"max-width:100%\" data-width=\"367\"><span class=\"ar-custom\" style=\"padding-bottom:100.27%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter wp-image-18559 size-full lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44.jpg\" alt=\"CTF_threat_44\" width=\"367\" height=\"368\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44.jpg 367w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-100x100.jpg 100w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-230x231.jpg 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-299x300.jpg 299w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-40x40.jpg 40w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-32x32.jpg 32w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-64x64.jpg 64w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-96x96.jpg 96w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_44-128x128.jpg 128w\" sizes=\"auto, (max-width: 367px) 100vw, 367px\" \/><\/span><\/div><\/p>\n<pre class=\"lang:default decode:true\">#!\/usr\/bin\/env python\r\nimport requests, time, sys, json, ast, logging, base64\r\nlogging.getLogger(\"scapy.runtime\").setLevel(logging.CRITICAL)\r\nfrom scapy.all import *\r\n\r\ndef AABBBC(AABBCF, AABBCE, AABBBF):\r\n    AABBCC = len(AABBCF)\/float(len(AABBCE))\r\n    if str(AABBCC).split(\".\")[1] == \"0\":\r\n        AABBCD = int(str((AABBCC)).split(\".\")[0]) * 8\r\n    else:\r\n        while str(AABBCC).split(\".\")[1] != \"0\":\r\n            AABBCF += \"@\"\r\n            AABBCC = len(AABBCF)\/float(len(AABBCE))\r\n        AABBCD = int(str((AABBCC)).split(\".\")[0]) * 8\r\n    AABBB0 = []\r\n    AABBCF = list(AABBCF)\r\n    AABBCE = list(AABBCE)\r\n    while AABBCF != []:\r\n        p_AABBCF = AABBCF[0:8]\r\n        p_AABBCE = AABBCE[0:8]\r\n        AABBB1 = []\r\n        for i in xrange(0,8):\r\n            if type(p_AABBCE[i]) == int: # [+] *** ALERT ALERT *** [+]\r\n                AABBB2 = (ord(chr(p_AABBCE[i])) ^ ord(p_AABBCF[0])) # [+] HUMANS HAVE BROKEN THROUGH [+]\r\n            else: # [+] MODULATE SHIELDS [+]\r\n                AABBB2 = (ord(p_AABBCE[i]) ^ ord(p_AABBCF[0])) # [+] *** ALERT ALERT *** [+]\r\n            AABBB0.append(AABBB2)\r\n            AABBB1.append(AABBB2)\r\n            AABBCF.pop(0)\r\n            p_AABBCF.pop(0)\r\n            AABBCE = AABBB1\r\n        AABBCE.reverse()\r\n    AABBB0.reverse()\r\n    AABBB4 = []\r\n    for i in AABBB0:\r\n        AABBB3 = hex(i)\r\n        if len(AABBB3) != 4:\r\n            AABBB4.append(\"0\" + hex(i)[2:])\r\n        else:\r\n            AABBB4.append(hex(i)[2:])\r\n    AABBB4 = \"\".join(AABBB4).upper()\r\n    return AABBB4\r\n\r\ndef AABBB7(AABBBE):\r\n    return AABBBE[::-1]\r\n\r\ndef AABBCB(AABBBE):\r\n    print \"\\t[-] *** ERROR CONNECTING ***\"\r\n    print \"\\n[+] SHUTTING DOWN DRONE [+]\\n\"\r\n    time.sleep(2)\r\n    sys.exit()\r\n\r\ndef main():\r\n    AABBBD = \"\"\"\r\n            ___________\r\n           \/-\/_\"\/-\/_\/-\/|\r\n          \/\"-\/-_\"\/-_\/\/||\r\n         \/__________\/|\/|\r\n         |\"|_'='-]:+|\/||\r\n         |-+-|.|_'-\"||\/\/\r\n         |[\".[:!+-'=|\/\/\r\n         |='!+|-:]|-|\/\r\n          ----------\r\n\"\"\"\r\n    print AABBBD\r\n    print \"[+] BORG DRONE BOOTUP STARTING [+]\"\r\n    time.sleep(2)\r\n    try:\r\n        AABBBA = json.load(open(\"borgstruct.cfg\"))\r\n        print \"\\t[-] CONFIGURATION\", str(AABBBA['key'][1]) + \".0 LOADED\"\r\n    except:\r\n        AABBBA = {\"warp\": [\"d0rw$54p\", \"lss\", \"p\/\/:ptth\", \"nimda\/\/:ptf\"],\r\n                  \"coil\": [\"r\/moc.nibets\", \"exe.1\\:c\", \"tropmmoc\"],\r\n                  \"dilithium\": [\"praw\", \"-redrocirt\", \"FfPE6AFw\/w\"],\r\n                  \"scalar\": [874, 34, 666],\r\n                  \"array\": [69, 80, 443, 25, 22, 2600, 666, 8443, 27500],\r\n                  \"LoadLibraryA\": [\"IsDebuggerPresent\", \"IsDebuggerDetected\", \"NtQueryInformationProcess\", \"GetTickCount\"],\r\n                  \"LoadLibraryB\": [\"CheckRemoteDebuggerPresent\", \"UnhandledExceptionFilter\", \"CloseHandle\", \"QueryPerformanceCounter\"],\r\n                  \"LoadLibraryC\": [\"NtGetContextThread\", \"NtSetContextThread\", \"NtClose\"],\r\n                  \"adb\": [\"0xCD\", \"0x03\"],\r\n                  \"targets\": [\"squirtle\", \"humans\", \"ferengi\", \"rick astley\"],\r\n                  \"key\": [\"borgdata\", 1, 2, 3, 4, 5, 6, 7, 8, \"startrek\", \"cloaking\"],\r\n                  \"commands\": [\"ping\", \"shutdown\", \"nslookup\"],\r\n                  \"lore\": [\"grab\", \"the\", \"flag\"]}\r\n        json.dump(AABBBA, open(\"borgstruct.cfg\", \"w\"))\r\n        print \"\\t[-] CONFIGURATION VERSION\", str(AABBBA['key'][1]) + \".0 WRITTEN\"\r\n    if AABBBA['key'][1] == 1:\r\n        print \"\\n[+] FETCHING STARTUP VALUE FROM MATRIX\"\r\n        time.sleep(2)\r\n        try:\r\n            AABBB5 = AABBB7((AABBBA['dilithium'][2]) + \"a\" + (AABBBA['coil'][0]) + \"a\" + (AABBBA['warp'][2]))\r\n            AABBB6 = requests.get(AABBB5, verify=False)\r\n        except:\r\n            AABBCB(AABBBA['LoadLibraryA'][0])\r\n        AABBCE = AABBB6.content.split(\"\\n\")[1]\r\n        print \"\\t[-] DATA =\", AABBCE\r\n    if AABBBA['key'][1] == 2: # [+] *** ALERT ALERT *** [+]\r\n        print \"\\n[+] SEND FLAG REQUEST WITH ENCRYPTED DATA AND CODE [+]\" # [+] HUMANS HAVE BROKE NEXT DEFENSE [+]\r\n        AABBCE = AABBB7((AABBBA['dilithium'][2]) + \"o\" + (AABBBA['coil'][0]) + \"o\" + (AABBBA['warp'][2])) # [+] INITIATE LOW ORBIT ION CANNON [+]\r\n        print \"\\t[-] DATA =\", AABBCE # [+] *** ALERT ALERT *** [+]\r\n    AABBCF = AABBBA['key'][0]\r\n    print \"\\t[-] INITIALIZATION KEY =\", AABBCF\r\n    if len(AABBCF) != 8:\r\n        sys.exit()\r\n    print \"\\n[+] STARTING BORG ENCRYPTION ROUTINE [+]\"\r\n    time.sleep(2)\r\n    AABBBB = AABBBC(AABBCE, AABBCF, AABBBA['array'][3])\r\n    print \"\\t[-] RESULT = \" + AABBBB\r\n    print \"\\n[+] STARTING DRONE COMMUNICATION PROTOCOLS [+]\"\r\n    time.sleep(2)\r\n    scalar_array = AABBBA['scalar'][0]\r\n    FEEDDEAD = base64.b64decode('cGFuYm9yZ2Ryb25lLmNvbQ==')\r\n    try:\r\n        AABBB8 = IP(dst=FEEDDEAD)\/TCP(dport=AABBBA['array'][5],window=scalar_array,flags=\"S\")\/AABBBB\r\n        AABBB9 = sr1(AABBB8, verbose=False)\r\n    except:\r\n        AABBCB(AABBBA['LoadLibraryB'][1])\r\n    if AABBB9[TCP].window == 666:\r\n        print \"\\t*** ERROR RECEIVED ***\"\r\n        print \"\\t[-] RETURNED = \", AABBB9[Raw]\r\n        print \"\\n[+] SHUTTING DOWN DRONE [+]\\n\"\r\n        time.sleep(2)\r\n        sys.exit()\r\n    elif AABBB9[TCP].window == 34:\r\n        print \"\\t[-] UPDATE SUCCESSFUL\"\r\n        AABBBA = ast.literal_eval(str(AABBB9[Raw]).strip(\"\\n\"))\r\n        print \"\\t[-] CONFIGURATION VERSION\", str(AABBBA['key'][1]) + \".0 WRITTEN\"\r\n        json.dump(AABBBA, open(\"borgstruct.cfg\", \"w\"))\r\n        print \"\\t[-] PROCESSING COMMANDS\"\r\n        print \"\\t[-] EXECUTING COMMAND =\", AABBBA['commands'][3], AABBBA['adb'][2], \"\/\"\r\n        time.sleep(10)\r\n        print \"\\t*** ERROR WITH COMMAND ***\"\r\n        print \"\\t[-] NEW SERVER FUNCTION ADDED - FLAG REQUEST\"\r\n        print \"\\t[-] FLAG REQUEST REQUIRED FOR CURRENT ENCRYPTED DATA\"\r\n        print \"\\n[+] SHUTTING DOWN DRONE [+]\\n\"\r\n        time.sleep(2)\r\n        sys.exit()\r\n    else:\r\n        print \"\\t[-] RETURNED = \", AABBB9[Raw], \"\\n\"\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n<\/pre>\n<p>Lots of things going on in the script, the main ones of interest are some of the ones that immediately jump out for investigation.<\/p>\n<pre class=\"lang:default decode:true \"># Called before encryption message prints\r\nAABBBB = AABBBC(AABBCE, AABBCF, AABBBA['array'][3])\r\n# Scapy sending data to a server (part of the \u201cCOMMUNICATION PROTOCOL\u201d?)\r\nAABBB8 = IP(dst=FEEDDEAD)\/TCP(dport=AABBBA['array'][5],window=scalar_array,flags=\"S\")\/AABBBB\r\n#  Branch leads to messages about the flag\r\n    elif AABBB9[TCP].window == 34:\r\n        print \"\\t[-] NEW SERVER FUNCTION ADDED - FLAG REQUEST\"\r\n        print \"\\t[-] FLAG REQUEST REQUIRED FOR CURRENT ENCRYPTED DATA\"\r\n<\/pre>\n<p>First things first, we\u2019ll take a look at the encryption function and decipher that. We set a breakpoint on the main() function and begin to step through the code to understand what it\u2019s doing.<\/p>\n<ul>\n<li>Tries to load the file \u201cborgstruct.cfg\u201d and if that fails, it writes a dictionary to disk as that file.<\/li>\n<li>Check if dictionary \u2018key\u2019[1] is equal to 1 and if so, puts together a string from various locations within the dictionary. <a href=\"http:\/\/pastebin.com\/raw\/wFA6EPfF\" rel=\"nofollow,noopener\" >This URL contains the Youtube video mentioned above<\/a>.<\/li>\n<li>Sets another variable to \u201cborgdata\u201d.<br \/>\nCalls the encryption routine AABBBC(URL,\u201dborgdata\u201d,25).<\/li>\n<\/ul>\n<p><div style=\"max-width:100%\" data-width=\"462\"><span class=\"ar-custom\" style=\"padding-bottom:19.91%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter wp-image-18562 size-full lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_45.png\" alt=\"CTF_threat_45\" width=\"462\" height=\"92\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_45.png 462w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_45-230x46.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_45-201x40.png 201w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/span><\/div><\/p>\n<ul>\n<li>Checks if URL is divisible by 8 and, if not, pads it with \u201c@\u201d.<\/li>\n<li>Splits each variable into a list and begins the XoR the URL by key \u201cborgdata\u201d.<div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:36.2%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-large wp-image-18565 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46-500x181.png\" alt=\"CTF_threat_46\" width=\"500\" height=\"181\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46-500x181.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46-230x83.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46-768x278.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46-510x185.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46-110x40.png 110w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_threat_46.png 828w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/li>\n<li>Once it has the first set of 8 ordinals it reverses them and uses this set as the next XoR key, which continues on for the full length of the URL.<div style=\"max-width:100%\" data-width=\"900\"><span class=\"ar-custom\" style=\"padding-bottom:20.89%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18379 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47.png\" alt=\"CTF_Threat_47\" width=\"900\" height=\"188\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47.png 900w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47-230x48.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47-768x160.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47-500x104.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47-510x107.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_47-191x40.png 191w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/span><\/div><br \/>\nThis is classic cipher block chaining where each encrypted ciphertext is used as the encryption key for the next block.<\/li>\n<li>If we let the process continue until the end, it reverses the order of the final ordinal list and then converts it to hex.<\/li>\n<\/ul>\n<p>Since we know the ciphertext and now we know how the key is derived, we have enough pieces of the puzzle to build a decryptor. By copying the code from the script and de-obfuscating it, we can build our reverse decryption function.<\/p>\n<pre class=\"lang:default decode:true\">#!\/usr\/bin\/env python\r\n\r\ndef decrypt(hash):\r\n    final_key = []\r\n    key = []\r\n    count = 0\r\n    while count != len(hash):\r\n        key.append(hash[count:count+2])\r\n        count += 2\r\n    key = key[::-1]\r\n    temp = []\r\n    for value in key:\r\n        ord_value = ord(value.decode(\"hex\"))\r\n        temp.append(ord_value)\r\n    count = 0\r\n    block_count = len(temp)\r\n    while block_count != 0:\r\n        cipher = []\r\n        block = temp[block_count - 8:block_count]\r\n        if block_count != 0:\r\n            for value in block:\r\n                cipher.append(value)\r\n        else:\r\n            for value in block:\r\n                cipher.append(value)\r\n        xor_key = (temp[block_count - 16:block_count - 8])[::-1]\r\n\r\n        string_key = []\r\n        count = 0\r\n        if block_count - 8  != 0:\r\n            while count != 8:\r\n                string_key.append(chr(cipher[count] ^ xor_key[count]))\r\n                count +=1\r\n        else:\r\n            string_key = [\"????????\"]\r\n        final_key.append(\"\".join(string_key))\r\n\r\n        block_count -= 8\r\n        xor_key = []\r\n    final_key = \"\".join(final_key[::-1])\r\n    return \"\".join(final_key)\r\n\r\ndef encrypt(pt, key, add_value):\r\n    pt_size = len(pt)\/float(len(key)) # Grab Key Length\r\n    if str(pt_size).split(\".\")[1] == \"0\": # Check if divisible by 8\r\n        multiply_size = int(str((pt_size)).split(\".\")[0]) * 8\r\n    else:\r\n        while str(pt_size).split(\".\")[1] != \"0\": # Pad pt to be divisible by 8\r\n            pt += \"@\"\r\n            pt_size = len(pt)\/float(len(key))\r\n        multiply_size = int(str((pt_size)).split(\".\")[0]) * 8\r\n    cipher = []\r\n    pt = list(pt) # Put plaintext and key into their respective list for processing in 8 byte chunks\r\n    key = list(key)\r\n    while pt != []: # Stop when all plaintext processed\r\n        p_pt = pt[0:8]\r\n        p_key = key[0:8]\r\n        temp_list = []\r\n        for i in xrange(0,8): # Process 8 bytes at a time\r\n            if type(p_key[i]) == int: # Second 8 bytes and on will always be integers\r\n                new_ct = (ord(chr(p_key[i])) ^ ord(p_pt[0])) # XOR each PT byte with key byte\r\n            else: # First run of XOR, assuming ASCII key\r\n                new_ct = (ord(p_key[i]) ^ ord(p_pt[0]))\r\n            cipher.append(new_ct) # Add each byte to CT list\r\n            temp_list.append(new_ct)\r\n            pt.pop(0)\r\n            p_pt.pop(0)\r\n            key = temp_list\r\n        key.reverse() # Reverse Key list each run so now Z-&gt;A on second run+ (integers)\r\n    cipher.reverse() # Reverse entire CT\r\n    cipher_text = []\r\n    for i in cipher: # Convert each integer to hex equivalent\r\n        hex_value = hex(i)\r\n        if len(hex_value) != 4: # Pad to get consistent output with leading 0's\r\n            cipher_text.append(\"0\" + hex(i)[2:])\r\n        else:\r\n            cipher_text.append(hex(i)[2:])\r\n    cipher_text = \"\".join(cipher_text).upper() # Join it into one string\r\n    return cipher_text\r\n\r\ndef main():\r\n    pt = \"https:\/\/www.youtube.com\/watch?v=AyenRCJ_4Ww\"\r\n    key = \"borgdata\"\r\n    numb = 25\r\n    enc_hash = encrypt(pt, key, numb)\r\n    dec_hash = decrypt(enc_hash)\r\n    print \"Encrypted Hash: %s\\nDecrypted Hash: %s\" % (enc_hash, dec_hash)\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n<\/pre>\n<p>Running the code with the known plain text and initial key shows we get the same ciphertext shown in the initial run of the drone.exe executable, along with our known YouTube URL.<\/p>\n<p><div style=\"max-width:100%\" data-width=\"899\"><span class=\"ar-custom\" style=\"padding-bottom:6.67%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18376 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48.png\" alt=\"CTF_Threat_48\" width=\"899\" height=\"60\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48.png 899w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48-230x15.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48-768x51.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48-500x33.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48-510x34.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_48-240x16.png 240w\" sizes=\"auto, (max-width: 899px) 100vw, 899px\" \/><\/span><\/div><\/p>\n<p>Now we can take the returned value and put it through our decryptor to see what we get.<\/p>\n<p>The hash \u201c405E520E4A0E6F3401584E0A4E121E00322C24793B7E6C3304594B0E41131B032C6867<br \/>\n07A3E2A2B484553174C0E064724696363753C372F5B40550117061B0A\u201d becomes \u201c???????<br \/>\ntwitter.com\/borgcommlink\/status\/755587712267104257@@@@@@\u201d.<\/p>\n<p>Browsing to that Twitter address, we\u2019re greeted with yet another hash.<a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:51.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter wp-image-18373 size-large lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49-500x259.png\" alt=\"CTF_Threat_49\" width=\"500\" height=\"259\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49-500x259.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49-230x119.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49-768x398.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49-510x264.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49-77x40.png 77w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_49.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>This hash decrypts to another excellent <a href=\"https:\/\/www.youtube.com\/watch?v=rTAx8r_090o\" rel=\"nofollow,noopener\"  target=\"_blank\">Star Trek Youtube video<\/a>.<\/p>\n<p>Looking back at our script, we can tell that the script sends a hash to panborgdrone.com on port TCP\/2600 and based on the result of what the server sends back, either shuts down or updates its configuration with a new \u201cfunction\u201d called \u201cFLAG REQUEST\u201d. Sounds promising.<\/p>\n<p>Let\u2019s try editing the script and sending the hash from Borg Head.<\/p>\n<p><div style=\"max-width:100%\" data-width=\"506\"><span class=\"ar-custom\" style=\"padding-bottom:18.77%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18370 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_50.png\" alt=\"CTF_Threat_50\" width=\"506\" height=\"95\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_50.png 506w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_50-230x43.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_50-500x94.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_50-213x40.png 213w\" sizes=\"auto, (max-width: 506px) 100vw, 506px\" \/><\/span><\/div><\/p>\n<p>We get a slightly different error message this time and no hash like we did originally. Instead of \u201cHIVE|MIND|HASH\u201d it\u2019s \u201cHIVE|ERROR|DATA|874\u201d. Looking at the Scapy command again, the TCP Window Size is set by variable \u201cscalar_array\u201d which pulls from the configuration dictionary.<\/p>\n<p><div style=\"max-width:100%\" data-width=\"899\"><span class=\"ar-custom\" style=\"padding-bottom:21.47%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18367 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51.png\" alt=\"CTF_Threat_51\" width=\"899\" height=\"193\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51.png 899w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51-230x49.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51-768x165.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51-500x107.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51-510x109.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_51-186x40.png 186w\" sizes=\"auto, (max-width: 899px) 100vw, 899px\" \/><\/span><\/div><\/p>\n<p>Setting the Window Size to 34 nets us a change in response from the server.<\/p>\n<p><div style=\"max-width:100%\" data-width=\"750\"><span class=\"ar-custom\" style=\"padding-bottom:35.33%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18364 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_52.png\" alt=\"CTF_Threat_52\" width=\"750\" height=\"265\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_52.png 750w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_52-230x81.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_52-500x177.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_52-510x180.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_52-113x40.png 113w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/span><\/div><\/p>\n<p>Looking at the 2.0 configuration, this key and values stand out immediately.<\/p>\n<pre class=\"lang:default decode:true \">   \"datashat\" : [\r\n      \"submit\",\r\n      \"the\",\r\n      \"flag\",\r\n      \"manually\"\r\n   ],<\/pre>\n<p>Running the bot again with the new configuration, it loads a new URL (with quite possibly the <a href=\"https:\/\/www.youtube.com\/watch?v=X6oUz1v17Uo\" rel=\"nofollow,noopener\" >best Star Trek video ever made<\/a>) and XoR key of \u201cborgcube\u201d to generate a new hash. Placing the new hash in our send command, we get the following error \u201cHIVE|ERROR|CMD|2E\u201d, which is different than the previous \u201cERROR|DATA\u201d message we received.<\/p>\n<p><div style=\"max-width:100%\" data-width=\"900\"><span class=\"ar-custom\" style=\"padding-bottom:27.67%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter size-full wp-image-18361 lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53.png\" alt=\"CTF_Threat_53\" width=\"900\" height=\"249\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53.png 900w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53-230x64.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53-768x212.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53-500x138.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53-510x141.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_53-145x40.png 145w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/span><\/div><\/p>\n<p>Changing the Window Size back to 874 didn\u2019t result in any change of the message; however, while looking through the rest of Borg Head\u2019s Tweets, we find this little gem among the memes and Borgs talking to each other.<br \/>\n<a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:72.4%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter wp-image-18358 size-large lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54-500x362.png\" alt=\"CTF_Threat_54\" width=\"500\" height=\"362\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54-500x362.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54-230x166.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54-768x556.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54-415x300.png 415w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54-55x40.png 55w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_54.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>In the background of this message is a spreadsheet with a table showing various commands (CMD) and their respective Window Size. We can see that value 874 corresponds to \u201cDRONE CHECKIN\u201d, value 34 is \u201cDRONE UPDATE\u201d, and value 824 is \u201cFLAG REQUEST\u201d!<\/p>\n<p>Updating our script one last time with our new Window Size we are rewarded with our key.<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:46.8%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter wp-image-18355 size-large lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55-500x234.png\" alt=\"CTF_Threat_55\" width=\"500\" height=\"234\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55-500x234.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55-230x108.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55-768x360.png 768w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55-510x239.png 510w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55-85x40.png 85w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_55.png 900w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>A Star Wars troll for all the Star Trek fans\u2026<\/p>\n<p><a href=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56.png\"><div style=\"max-width:100%\" data-width=\"500\"><span class=\"ar-custom\" style=\"padding-bottom:75%;\"><img loading=\"lazy\" decoding=\"async\"  class=\"aligncenter wp-image-18172 size-large lozad\"  data-src=\"https:\/\/www.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56-500x375.png\" alt=\"CTF_Threat_56\" width=\"500\" height=\"375\" srcset=\"https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56-500x375.png 500w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56-230x173.png 230w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56-400x300.png 400w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56-53x40.png 53w, https:\/\/www2.paloaltonetworks.com\/blog\/wp-content\/uploads\/2016\/09\/CTF_Threat_56.png 650w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/span><\/div><\/a><\/p>\n<p>PAN{m4yTh3f0rc3beWIThyOu}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back to our blog series where we reveal the\u00a0solutions\u00a0to LabyREnth, the Unit 42 Capture the Flag (CTF)\u00a0challenge. We\u2019ll be revealing the solutions to one challenge track per week. Next up, the &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":[2145,2142,586],"coauthors":[1312,1774,1673,1116,1757],"class_list":["post-18169","post","type-post","status-publish","format-standard","hentry","category-events","tag-ctf","tag-labyrenth","tag-unit-42"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts\/18169","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=18169"}],"version-history":[{"count":27,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts\/18169\/revisions"}],"predecessor-version":[{"id":18619,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/posts\/18169\/revisions\/18619"}],"wp:attachment":[{"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/media?parent=18169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/categories?post=18169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/tags?post=18169"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www2.paloaltonetworks.com\/blog\/wp-json\/wp\/v2\/coauthors?post=18169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}