Fix module metadata platform list comparison #18823
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue in
Msf::Modules::Metadata::Obj#parse_platform_list
, which resulted in a wrong module compatible platform list. String comparison for platform names was done with#casecmp
, which returns -1, 0 or 1. The correct method to use is#casecmp?
, which returns a boolean value.This has been found while testing the
multi/http/manageengine_servicedesk_plus_saml_rce_cve_2022_47966
module with theUnix Command
target. Since this module has some character restrictions, an encoder is automatically selected according to the architecture and the platform. Due to this issue, the resulting encoder wasencoder/cmd/powershell_base64
, which is not compatible withlinux
payloads.One way to show the issue is to add a breakpoint in
#execute_command
and inspect the command to be sent.Before this fix
After this fix
Another way to verify if the issue is fixed is to generate a payload forcing the encoding:
Before this fix
After this fix