Skip to content

Commit fb8e025

Browse files
RageLtManbusterb
authored andcommitted
Force datastore validation by option set
cmd_psh_payload relies on datastore options to have a proper data type down the call chain. When modules are created with string values for all data store options, a conditional naively checking what should be a boolean value for false/nil? would return true for a string representation of "false." Ensure that datastore options are validated prior to using them to set variables passed into Rex methods.
1 parent f24bfe7 commit fb8e025

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/msf/core/exploit/powershell.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def run_hidden_psh(ps_code, payload_arch, encoded)
188188
#
189189
# @return [String] Powershell command line with payload
190190
def cmd_psh_payload(pay, payload_arch, opts = {})
191+
options.validate(datastore)
191192
opts[:persist] ||= datastore['Powershell::persist']
192193
opts[:prepend_sleep] ||= datastore['Powershell::prepend_sleep']
193194
opts[:method] ||= datastore['Powershell::method']

0 commit comments

Comments
 (0)