{"id":42,"date":"2005-03-13T09:39:09","date_gmt":"2005-03-13T16:39:09","guid":{"rendered":"\/?p=42"},"modified":"2006-05-04T12:15:38","modified_gmt":"2006-05-04T19:15:38","slug":"brief-re-puzzles","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/","title":{"rendered":"Brief RE Puzzles"},"content":{"rendered":"<p>These are a few of my favorite little reverse engineering puzzles to show people when they express interest in the craft. They are also 2 sample functions I thought I would use when prototyping the <a href=\"http:\/\/multimedia.cx\/eggs\/index.php?cat=15\">BFRE program<\/a>.<\/p>\n<p><!--more--><\/p>\n<p>Puzzle #1&#8211; this function can be boiled down to a simple statement about its overall function. For the sake of domain knowledge, I will state that it comes from a production video codec. The first 4 hex digits of each instruction are omitted since they are all the same anyway. A typical invocation follows the function.<\/p>\n<pre>\r\n\r\n  DEF0 55                      push ebp\r\n  DEF1 8BEC                    mov ebp, esp\r\n  DEF3 53                      push ebx\r\n  DEF4 56                      push esi\r\n  DEF5 57                      push edi\r\n  DEF6 8B7D08                  mov edi, dword[ebp+08]\r\n  DEF9 8B750C                  mov esi, dword[ebp+0C]\r\n  DEFC 8B4F04                  mov ecx, dword[edi+04]\r\n  DEFF 8B5F10                  mov ebx, dword[edi+10]\r\n  DF02 8BD1                    mov edx, ecx\r\n  DF04 83E107                  and ecx, 00000007\r\n  DF07 C1EA03                  shr edx, 03\r\n  DF0A 8B0413                  mov eax, dword[ebx+edx]\r\n  DF0D 0FC8                    bswap eax\r\n  DF0F D3E0                    shl eax, cl\r\n  DF11 B920000000              mov ecx, 00000020\r\n  DF16 2BCE                    sub ecx, esi\r\n  DF18 D3E8                    shr eax, cl\r\n  DF1A 017704                  add dword[edi+04], esi\r\n  DF1D 5F                      pop edi\r\n  DF1E 5E                      pop esi\r\n  DF1F 5B                      pop ebx\r\n  DF20 5D                      pop ebp\r\n  DF21 C3                      ret\r\n\r\n<\/pre>\n<p>The following fragment shows an example of how the function is called:<\/p>\n<pre>\r\n\r\n  mov eax, dword[ebx+06]\r\n  mov ecx, 6\r\n  push ecx\r\n  push eax\r\n  call DEF0\r\n  add esp, 8\r\n\r\n<\/pre>\n<p>Puzzle #2: this function also serves an incredibly simple purpose. Again, all of the address have been shortened to 4 digits:<\/p>\n<pre>\r\n\r\n1000 8B442404                mov eax, dword[esp+04]\r\n1004 85C0                    test eax, eax\r\n1006 740D                    je 1015\r\n1008 8B08                    mov ecx, dword[eax]\r\n100A 83F93C                  cmp ecx, 0000003C\r\n100D 7506                    jne 1015\r\n100F B801000000              mov eax, 00000001\r\n1014 C3                      ret\r\n1015 C7050090009004000000    mov dword[nnnn9000], 00000004\r\n101F 33C0                    xor eax, eax\r\n1021 C3                      ret\r\n<\/pre>\n<p>And a typical invocation looks like this:<\/p>\n<pre>\r\n\r\n1031 8B742408                mov esi, dword[esp+08]\r\n1035 56                      push esi\r\n1036 E8C5FFFFFF              call 1000\r\n<\/pre>\n<p><a href=\"http:\/\/multimedia.cx\/eggs\/index.php?p=43\">Solutions to the puzzles are here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Try your hand at RE&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-reverse-engineering"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"Try your hand at RE...\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Brief RE Puzzles | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"Try your hand at RE...\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2005-03-13T16:39:09+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2006-05-04T19:15:38+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Brief RE Puzzles | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Try your hand at RE...\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#article\",\"name\":\"Brief RE Puzzles | Breaking Eggs And Making Omelettes\",\"headline\":\"Brief RE Puzzles\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2005-03-13T09:39:09-08:00\",\"dateModified\":\"2006-05-04T12:15:38-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#webpage\"},\"articleSection\":\"Reverse Engineering\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/reverse-engineering\\\/#listItem\",\"name\":\"Reverse Engineering\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/reverse-engineering\\\/#listItem\",\"position\":2,\"name\":\"Reverse Engineering\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/reverse-engineering\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#listItem\",\"name\":\"Brief RE Puzzles\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#listItem\",\"position\":3,\"name\":\"Brief RE Puzzles\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/reverse-engineering\\\/#listItem\",\"name\":\"Reverse Engineering\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/\",\"name\":\"Brief RE Puzzles | Breaking Eggs And Making Omelettes\",\"description\":\"Try your hand at RE...\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/brief-re-puzzles\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2005-03-13T09:39:09-08:00\",\"dateModified\":\"2006-05-04T12:15:38-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Brief RE Puzzles | Breaking Eggs And Making Omelettes","description":"Try your hand at RE...","canonical_url":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#article","name":"Brief RE Puzzles | Breaking Eggs And Making Omelettes","headline":"Brief RE Puzzles","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2005-03-13T09:39:09-08:00","dateModified":"2006-05-04T12:15:38-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#webpage"},"articleSection":"Reverse Engineering"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/reverse-engineering\/#listItem","name":"Reverse Engineering"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/reverse-engineering\/#listItem","position":2,"name":"Reverse Engineering","item":"https:\/\/multimedia.cx\/eggs\/category\/reverse-engineering\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#listItem","name":"Brief RE Puzzles"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#listItem","position":3,"name":"Brief RE Puzzles","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/reverse-engineering\/#listItem","name":"Reverse Engineering"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/","name":"Brief RE Puzzles | Breaking Eggs And Making Omelettes","description":"Try your hand at RE...","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2005-03-13T09:39:09-08:00","dateModified":"2006-05-04T12:15:38-07:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"Brief RE Puzzles | Breaking Eggs And Making Omelettes","og:description":"Try your hand at RE...","og:url":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/","article:published_time":"2005-03-13T16:39:09+00:00","article:modified_time":"2006-05-04T19:15:38+00:00","twitter:card":"summary","twitter:title":"Brief RE Puzzles | Breaking Eggs And Making Omelettes","twitter:description":"Try your hand at RE..."},"aioseo_meta_data":{"post_id":"42","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 21:42:25","updated":"2025-12-31 18:08:46","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/reverse-engineering\/\" title=\"Reverse Engineering\">Reverse Engineering<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBrief RE Puzzles\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs\/"},{"label":"Reverse Engineering","link":"https:\/\/multimedia.cx\/eggs\/category\/reverse-engineering\/"},{"label":"Brief RE Puzzles","link":"https:\/\/multimedia.cx\/eggs\/brief-re-puzzles\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":0,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}