{"id":74,"date":"2026-10-22T15:43:16","date_gmt":"2026-10-22T04:43:16","guid":{"rendered":"https:\/\/davidshoon.com\/?p=74"},"modified":"2026-10-22T15:43:16","modified_gmt":"2026-10-22T04:43:16","slug":"use-after-free-exploit-techneeq","status":"publish","type":"post","link":"https:\/\/blog.davidshoon.com\/?p=74","title":{"rendered":"Use-after-free exploit techneeq"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Use-after-free depends on the codebase you&#8217;re working on to determine whether it&#8217;s exploitable&#8230; but given an example code base, it&#8217;s insidiously easy to create&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;stdlib.h>\n#include &lt;string.h>\n\nvoid func()\n{\n\tprintf(\"Hello world\\n\");\n}\n\nvoid func2()\n{\n\tprintf(\"How did I get here?\\n\");\n}\n\n\nstruct s_ops {\n\tvoid (* f) ();\n};\n\n\nint main()\n{\n\tstruct s_ops *a = malloc(sizeof(struct s_ops));\n\t\n\ta->f = func;\n\n\ta->f();\n\n\tfree(a); \/\/ use-after-free... free here, and use 'a' again later on\n\n\tstruct s_ops *b = malloc(sizeof(struct s_ops));\n\tb->f = func2;\n\n\n\ta->f();\n\t\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Hello world\nHow did I get here?<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Use-after-free depends on the codebase you&#8217;re working on to determine whether it&#8217;s exploitable&#8230; but given an example code base, it&#8217;s insidiously easy to create&#8230; Output:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":1,"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":75,"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions\/75"}],"wp:attachment":[{"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.davidshoon.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}