{"id":7295,"date":"2020-05-30T12:12:39","date_gmt":"2020-05-30T12:12:39","guid":{"rendered":"http:\/\/www.hexacorn.com\/blog\/?p=7295"},"modified":"2020-05-30T12:33:54","modified_gmt":"2020-05-30T12:33:54","slug":"feed-the-children-feed-them-well","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2020\/05\/30\/feed-the-children-feed-them-well\/","title":{"rendered":"Feed the children, feed them well"},"content":{"rendered":"\n<p>This is a quick blurb about idea I <a href=\"https:\/\/twitter.com\/Hexacorn\/status\/1266682108698861569?s=20\">shared<\/a> on Twitter today. <\/p>\n\n\n\n<p>When you create a child process system calls a combo of these two functions:<\/p>\n\n\n\n<ul><li>NtAllocateVirtualMemory<\/li><li>NtWriteVirtualMemory<\/li><\/ul>\n\n\n\n<p>One could intercept these calls (using a hardware breakpoint, patching, or even tracing), and when memory buffer is allocated, extend the allocation size literally creating a code\/data cave. Then when the writing is done, build a buffer that will contain the original data meant to be written &amp; appended buffer e.g. shellcode that will fill-in the cave.<\/p>\n\n\n\n<p>Now it&#8217;s only a matter of executing the code, which could be done using GUI-based tricks (e.g. Propagate, or common windows callback procedures).<\/p>\n\n\n\n<p>Note: the APIs may need to be changed on 64-bit system if the parent and child process are mixed architecture (NtWow64AllocateVirtualMemory64 &amp; NtWow64WriteVirtualMemory64).<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a quick blurb about idea I shared on Twitter today. When you create a child process system calls a combo of these two functions: NtAllocateVirtualMemory NtWriteVirtualMemory One could intercept these calls (using a hardware breakpoint, patching, or even &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2020\/05\/30\/feed-the-children-feed-them-well\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7295"}],"collection":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/comments?post=7295"}],"version-history":[{"count":5,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7295\/revisions"}],"predecessor-version":[{"id":7301,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7295\/revisions\/7301"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=7295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=7295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=7295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}