Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't change the main modules datastore options #18746

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

zeroSteiner
Copy link
Contributor

@zeroSteiner zeroSteiner commented Jan 25, 2024

This fixes an issue that @adfoster-r7 noticed while testing another PR of mine. When datastore options are passed on the command line in msfconsole using the command KEY=VALUE syntax, the datastore options should not be reflected in the output of show options because they should have only effected the module for that specific command invocation. This was not the case for the generate command that is available to payloads.

Testing Steps

  • Start msfconsole
  • Use a payload module (payload/cmd/windows/adduser is a good test case because the datastore options are visible in the output)
  • Run the generate command, and set one or more options on the command line
  • See that the options were incorporated into the payload that was generated
  • See that the options are not reflected in the output of show options

New And Fixed

msf6 payload(cmd/windows/adduser) > show options 

Module options (payload/cmd/windows/adduser):

   Name    Current Setting  Required  Description
   ----    ---------------  --------  -----------
   CUSTOM                   no        Custom group name to be used instead of default
   PASS    Metasploit$1     yes       The password for this user
   USER    metasploit       yes       The username to create
   WMIC    false            yes       Use WMIC on the target to resolve administrators group


View the full module info with the info, or info -d command.

msf6 payload(cmd/windows/adduser) > generate -f raw USER=smcintyre
cmd.exe /c net user smcintyre Metasploit$1 /ADD && net localgroup Administrators smcintyre /ADD
msf6 payload(cmd/windows/adduser) > show options 

Module options (payload/cmd/windows/adduser):

   Name    Current Setting  Required  Description
   ----    ---------------  --------  -----------
   CUSTOM                   no        Custom group name to be used instead of default
   PASS    Metasploit$1     yes       The password for this user
   USER    metasploit       yes       The username to create
   WMIC    false            yes       Use WMIC on the target to resolve administrators group


View the full module info with the info, or info -d command.

msf6 payload(cmd/windows/adduser) >

Old And Broken

msf6 payload(cmd/windows/adduser) > show options 

Module options (payload/cmd/windows/adduser):

   Name    Current Setting  Required  Description
   ----    ---------------  --------  -----------
   CUSTOM                   no        Custom group name to be used instead of default
   PASS    Metasploit$1     yes       The password for this user
   USER    metasploit       yes       The username to create
   WMIC    false            yes       Use WMIC on the target to resolve administrators group


View the full module info with the info, or info -d command.

msf6 payload(cmd/windows/adduser) > generate -f raw USER=smcintyre
cmd.exe /c net user smcintyre Metasploit$1 /ADD && net localgroup Administrators smcintyre /ADD
msf6 payload(cmd/windows/adduser) > show options 

Module options (payload/cmd/windows/adduser):

   Name    Current Setting  Required  Description
   ----    ---------------  --------  -----------
   CUSTOM                   no        Custom group name to be used instead of default
   PASS    Metasploit$1     yes       The password for this user
   USER    smcintyre        yes       The username to create
   WMIC    false            yes       Use WMIC on the target to resolve administrators group


View the full module info with the info, or info -d command.

msf6 payload(cmd/windows/adduser) >

@smcintyre-r7 smcintyre-r7 added library rn-fix release notes fix labels Jan 25, 2024
@adfoster-r7 adfoster-r7 merged commit 2f97f86 into rapid7:master Jan 25, 2024
36 checks passed
@adfoster-r7
Copy link
Contributor

Release Notes

Fixes a module bug when using the generate OPTION=VALUE syntax. Previously the module's datastore would be unintentionally updated with the new option value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library rn-fix release notes fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants