{"id":7936,"date":"2022-01-22T01:08:59","date_gmt":"2022-01-22T01:08:59","guid":{"rendered":"https:\/\/www.hexacorn.com\/blog\/?p=7936"},"modified":"2022-01-22T01:10:03","modified_gmt":"2022-01-22T01:10:03","slug":"beyond-good-ol-run-key-part-137","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2022\/01\/22\/beyond-good-ol-run-key-part-137\/","title":{"rendered":"Beyond good ol\u2019 Run key, Part 137"},"content":{"rendered":"\n<p>This is a neat persistence trick you can use&#8230; if you got access to TrustedInstaller&#8230;<\/p>\n\n\n\n<p>The <em>wininet.dll<\/em> library in Windows 10+ extends the functionality of <em>InternetErrorDlg<\/em> function to reach out to a configurable Registry location that supports handling of unknown error messages. The function takes the error code as an argument and reaches out to the following location:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">HKLM\\SOFTWARE\\Microsoft\\Windows\\\nCurrentVersion\\Internet Settings\\LUI\\&lt;error&gt;<\/pre>\n\n\n\n<p>It then reads the value in a form of an expandable string and extracts library name from it by splitting it from the exported API name using an exclamation mark as a separator. And if a given error code doesn&#8217;t have an entry the function defaults to value &#8216;0&#8217; which by default points to:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">%SystemRoot%\\system32\\wininetlui.dll!InternetErrorDlgEx<\/pre>\n\n\n\n<p>I was curious if I could force the loading of my own payload and after launching Process Monitor with a filter on \\Lui path I was able to quickly trigger error 12040 (ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR). I then added an entry for my own test library and was able to load my DLL \ud83d\ude42<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/01\/LUI-1.png\"><img decoding=\"async\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/01\/LUI-1.png\" alt=\"\" class=\"wp-image-7940\" width=\"580\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/01\/LUI-1.png 891w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/01\/LUI-1-300x283.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/01\/LUI-1-768x725.png 768w\" sizes=\"(max-width: 891px) 100vw, 891px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>There are at least two caveats:<\/p>\n\n\n\n<ul><li>You need TrustedInstaller rights to add\/modify the registry entry<\/li><li>User needs to use Internet Explorer (I couldn&#8217;t trigger it in Edge)<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This is a neat persistence trick you can use&#8230; if you got access to TrustedInstaller&#8230; The wininet.dll library in Windows 10+ extends the functionality of InternetErrorDlg function to reach out to a configurable Registry location that supports handling of unknown &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2022\/01\/22\/beyond-good-ol-run-key-part-137\/\">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":[35],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7936"}],"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=7936"}],"version-history":[{"count":4,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7936\/revisions"}],"predecessor-version":[{"id":7942,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7936\/revisions\/7942"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=7936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=7936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=7936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}