{"id":2782,"date":"2015-01-13T14:37:32","date_gmt":"2015-01-13T14:37:32","guid":{"rendered":"http:\/\/www.hexacorn.com\/blog\/?p=2782"},"modified":"2015-01-13T15:46:38","modified_gmt":"2015-01-13T15:46:38","slug":"beyond-good-ol-run-key-part-24","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2015\/01\/13\/beyond-good-ol-run-key-part-24\/","title":{"rendered":"Beyond good ol\u2019 Run key, Part 24"},"content":{"rendered":"<p>Ability to load a DLL of your choice anytime someone is connecting to the internet is something that definitely deserves some attention. This is why I will describe here yet another obscure mechanism that can be abused for malicious purposes. Courtesy of Winsock 2 library (ws2_32.dll).<\/p>\n<p>When Winsock library connects to the internet it &#8216;talks&#8217; to various service providers and probes them for connectivity services. It&#8217;s actually pretty complex and I won&#8217;t pretend that I fully understand what&#8217;s going on there yet there is one thing which this library does that I do understand \ud83d\ude42<\/p>\n<p>At some stage it attempts to load a DLL as specified by the following Registry key:<\/p>\n<pre>HKLM\\SYSTEM\\CurrentControlSet\\Services\\WinSock2\\Parameters\\AutodialDLL<\/pre>\n<p>This key is quite obscure and Microsoft only describes it in a context of a very old vulnerability <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/security\/ms06-041.aspx\">MS06-041<\/a>.<\/p>\n<p>Turns out that the AutodialDLL entry points to a DLL that WinSock will load anytime it connects to the internet.<\/p>\n<p>The DLL needs to export 3 functions:<\/p>\n<ul>\n<li>WSAttemptAutodialAddr<\/li>\n<li>WSAttemptAutodialName<\/li>\n<li>WSNoteSuccessfulHostentLookup<\/li>\n<\/ul>\n<p>The result of loading the following registry key:<\/p>\n<pre>Windows Registry Editor Version 5.00\r\n\r\n[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\WinSock2\\Parameters] \"AutodialDLL\"=\"c:\\\\temp\\\\foo.dll\"<\/pre>\n<p>and dropping the file<\/p>\n<pre>c:\\temp\\foo.dll<\/pre>\n<p>(the DLL exports the aforementioned APIs) can be seen below:<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2783\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_1.png\" alt=\"autodial_1\" width=\"500\" height=\"300\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_1.png 500w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_1-300x180.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>The screenshot was taken from a Windows XP system &#8211; I simply opened and closed Internet Explorer.<\/p>\n<p>Of course, it works on Windows 10 too &#8211; just access to HKLM is slightly more difficult \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-2784\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_2.png\" alt=\"autodial_2\" width=\"486\" height=\"293\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_2.png 486w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2015\/01\/autodial_2-300x181.png 300w\" sizes=\"(max-width: 486px) 100vw, 486px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ability to load a DLL of your choice anytime someone is connecting to the internet is something that definitely deserves some attention. This is why I will describe here yet another obscure mechanism that can be abused for malicious purposes. &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2015\/01\/13\/beyond-good-ol-run-key-part-24\/\">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":[13,35,15,19,9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/2782"}],"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=2782"}],"version-history":[{"count":5,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/2782\/revisions"}],"predecessor-version":[{"id":2789,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/2782\/revisions\/2789"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=2782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=2782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=2782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}