{"id":45,"date":"2005-03-13T18:20:14","date_gmt":"2005-03-14T01:20:14","guid":{"rendered":"\/?p=45"},"modified":"2006-05-18T10:47:46","modified_gmt":"2006-05-18T17:47:46","slug":"automated-memory-excavation","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/","title":{"rendered":"Automated Memory Excavation"},"content":{"rendered":"<p>Sometimes, multimedia programs are modular which facilitates reverse engineering. But what if they are not modular or are just standalone programs that do one thing well?<\/p>\n<p><!--more--><\/p>\n<p>Many multimedia program architectures are highly modular in order to allow easy expandability for new codecs and container formats. Since the modules conform to well-defined interfaces, usually exporting one or more functions from a standard API, such modular platforms provide an excellent jumping-off point for reverse engineering. But what happens when you encounter a standalone player where all of the decoding code is hidden in there somewhere amidst megabytes of unrelated code? Or, in the case of Apple&#8217;s QuickTime Player, many of the core codecs are rolled up into one mega-DLL?<\/p>\n<p>In situations like this, I like to use a chase-the-data-through-the-buffers strategy. I will need to come up with a better name for that. It operates on the following simple logical premise:<\/p>\n<ul>\n<li>Somewhere in this big, binary module, there is the entry point to a decoding function, a decoding function that I want.<\/li>\n<li>One of the parameters to that decoding function will need to be a pointer to encoded data.<\/li>\n<li>Question: Where does that data come from? Answer: On disk.<\/li>\n<li>Solution: Intercept the data when it is read from the disk.<\/li>\n<\/ul>\n<p>I once had access to a debugger that could be made to stop when a particular area of memory was read from. I would put a breakpoint on the standard Windows ReadFile() function. I would wait until I recognized the buffer of data being read from the file (since I had the sample file open in a hex editor in a different window). Then I would put a read breakpoint over the entire data buffer which would lead me straight to the core decoding function.<\/p>\n<p>I do not have access to that debugger anymore and it seems to be a fairly rare feature in modern debuggers. Besides, using debuggers just encourages one to step through the code. I want cool software tools that do tedious work for me.<\/p>\n<p>So, let&#8217;s brainstorm a new program. Operating on a similar logical premise as above, feed it a buffer pattern you wish to match. The pattern would be, for example, the first 16 bytes of the first keyframe of a file that contains data in a format that is still only decodable by a binary codec. The program would then set the x86 CPU trap flag, so that every instruction causes a breakpoint handler to be invoked, and the custom breakpoint handler would search memory for that pattern.<\/p>\n<p>Seems like a big task. I think I would break it down like this:<\/p>\n<ul>\n<li>wait for data to be moved into a register<\/li>\n<li>if new data in register appears to be a reasonable data memory location (need some heuristics on this one), start doing a pattern match starting at that address<\/li>\n<li>log to a file every match (likely more than one occurrence), and the address of the mov instruction that placed the data buffer into a register<\/li>\n<li>log to a separate file the last memory location that was about to be checked&#8211; use this intelligence on subsequent runs after the profiling program has accessed illegal memory<\/li>\n<\/ul>\n<p>Nutty, and not something I am likely to get started on soon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How about a tool that searches for a pattern through memory as a program is running?<\/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-45","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=\"How about a tool that searches for a pattern through memory as a program is running?\" \/>\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\/automated-memory-excavation\/\" \/>\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=\"Automated Memory Excavation | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"How about a tool that searches for a pattern through memory as a program is running?\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2005-03-14T01:20:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2006-05-18T17:47:46+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Automated Memory Excavation | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"How about a tool that searches for a pattern through memory as a program is running?\" \/>\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\\\/automated-memory-excavation\\\/#article\",\"name\":\"Automated Memory Excavation | Breaking Eggs And Making Omelettes\",\"headline\":\"Automated Memory Excavation\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2005-03-13T18:20:14-08:00\",\"dateModified\":\"2006-05-18T10:47:46-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/automated-memory-excavation\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/automated-memory-excavation\\\/#webpage\"},\"articleSection\":\"Reverse Engineering\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/automated-memory-excavation\\\/#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\\\/automated-memory-excavation\\\/#listItem\",\"name\":\"Automated Memory Excavation\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/automated-memory-excavation\\\/#listItem\",\"position\":3,\"name\":\"Automated Memory Excavation\",\"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\\\/automated-memory-excavation\\\/#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\\\/automated-memory-excavation\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/automated-memory-excavation\\\/\",\"name\":\"Automated Memory Excavation | Breaking Eggs And Making Omelettes\",\"description\":\"How about a tool that searches for a pattern through memory as a program is running?\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/automated-memory-excavation\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2005-03-13T18:20:14-08:00\",\"dateModified\":\"2006-05-18T10:47:46-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":"Automated Memory Excavation | Breaking Eggs And Making Omelettes","description":"How about a tool that searches for a pattern through memory as a program is running?","canonical_url":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/#article","name":"Automated Memory Excavation | Breaking Eggs And Making Omelettes","headline":"Automated Memory Excavation","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2005-03-13T18:20:14-08:00","dateModified":"2006-05-18T10:47:46-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/#webpage"},"articleSection":"Reverse Engineering"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/#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\/automated-memory-excavation\/#listItem","name":"Automated Memory Excavation"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/#listItem","position":3,"name":"Automated Memory Excavation","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\/automated-memory-excavation\/#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\/automated-memory-excavation\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/","name":"Automated Memory Excavation | Breaking Eggs And Making Omelettes","description":"How about a tool that searches for a pattern through memory as a program is running?","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2005-03-13T18:20:14-08:00","dateModified":"2006-05-18T10:47:46-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":"Automated Memory Excavation | Breaking Eggs And Making Omelettes","og:description":"How about a tool that searches for a pattern through memory as a program is running?","og:url":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/","article:published_time":"2005-03-14T01:20:14+00:00","article:modified_time":"2006-05-18T17:47:46+00:00","twitter:card":"summary","twitter:title":"Automated Memory Excavation | Breaking Eggs And Making Omelettes","twitter:description":"How about a tool that searches for a pattern through memory as a program is running?"},"aioseo_meta_data":{"post_id":"45","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\tAutomated Memory Excavation\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":"Automated Memory Excavation","link":"https:\/\/multimedia.cx\/eggs\/automated-memory-excavation\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/45","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=45"}],"version-history":[{"count":0,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}