{"id":4137,"date":"2024-08-31T14:14:27","date_gmt":"2024-08-31T12:14:27","guid":{"rendered":"https:\/\/andreas-klingler.de\/infosec\/?p=4137"},"modified":"2024-08-31T14:32:31","modified_gmt":"2024-08-31T12:32:31","slug":"unquoted-service-path-hijacking","status":"publish","type":"post","link":"https:\/\/infosec.andreas-klingler.de\/?p=4137","title":{"rendered":"Unquoted Service Path hijacking"},"content":{"rendered":"\n<ol class=\"wp-block-list\">\n<li>Check if there is some ser\u00advice in a path which con\u00adtains spaces (out\u00adside of the win\u00addows direc\u00adto\u00adry):<br><code>wmic service get name,pathname | findstr \/i \/v \"C:\\Windows\\\" | findstr \/i \/v \"\"\"<\/code><br>Alter\u00adna\u00adtive\u00adly in Pow\u00ader\u00adshell: <a href=\"https:\/\/andreas-klingler.de\/infosec\/?p=4141\" data-type=\"post\" data-id=\"4141\">See the Win\u00addows Ser\u00advice Exploita\u00adtion article.<\/a><\/li>\n\n\n\n<li>Check that it is pos\u00adsi\u00adble to restart the ser\u00advice, e.g. via <code>Start-Service $serviceName<\/code> in Powershell.<\/li>\n\n\n\n<li>If this is pos\u00adsi\u00adble, check if we can write some\u00adwhere. For exam\u00adple, the exe\u00adcute\u00adable ser\u00advice is C:\\Program Files\\Super App\\SuperApp.exe. Then, the fol\u00adlow\u00ading direc\u00adto\u00adries should be checked with icacls:&nbsp;<ol class=\"wp-block-list\">\n<li><code>C:\\Program.exe<\/code><\/li>\n\n\n\n<li><code>C:\\Program Files\\Super.exe<\/code><\/li>\n\n\n\n<li><code>C:\\Program Files\\Super App\\SuperApp.exe<\/code><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>If you have write access, com\u00adpile a bina\u00adry e.g. <a href=\"https:\/\/andreas-klingler.de\/infosec\/?p=4119\" data-type=\"post\" data-id=\"4119\">from the Bina\u00adry hijack\u00ading post <\/a>and place it there and \u20acprof\u00adit.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wp_typography_post_enhancements_disabled":false,"footnotes":""},"categories":[471],"tags":[503],"class_list":["post-4137","post","type-post","status-publish","format-standard","hentry","category-privesc","tag-service-path-hijacking"],"_links":{"self":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/4137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4137"}],"version-history":[{"count":3,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/4137\/revisions"}],"predecessor-version":[{"id":4151,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/4137\/revisions\/4151"}],"wp:attachment":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}