rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34k stars 13.95k forks source link

shell_to_meterpreter: PAYLOAD_OVERRIDE does not override payload configuration on Windows #17918

Open bcoles opened 1 year ago

bcoles commented 1 year ago

The purpose of an override option is to override behaviour. This allows operators to force behaviour where existing automation logic fails.

The optional PAYLOAD_OVERRIDE option is used to force-set a payload. Presumably, the operator is smart enough to choose an appropriate payload. Thus, the operator does not care about any other automation magic and simply wants Metasploit to get out of their way.

The module performs some automatic platform detection and payload selection. The selected payload is also validated against the detected platform. Normally this is fine, but the platform detection can fail (#17896) and the operator doesn't care about the validation when force-setting a payload. Thus the error message and return here is counter-productive when force-setting a payload:

https://github.com/rapid7/metasploit-framework/blob/0436e8bad998d035e6558ebcbb2e878eaf898ce6/modules/post/multi/manage/shell_to_meterpreter.rb#L82-L100

While it is tempting to do the following, this will fail as the local arch (larch and psh_arch) are used when invoking PowerShell later.

      else
        unless datastore['PAYLOAD_OVERRIDE']
          print_error('Target is running Windows on an unsupported architecture such as Windows ARM!')
          return nil
        end
      end
github-actions[bot] commented 1 year ago

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.