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

Cypress ctm200 command injection #19426

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

0x45dd
Copy link
Contributor

@0x45dd 0x45dd commented Aug 28, 2024

Architecture Support: Added support for ARM-based payloads alongside the existing command-based payloads, including the use of the CmdStager mixin for ARM targets.
TARGETURI Handling: Updated the TARGETURI option to handle non-standard installation directories by defaulting to / and adjusted the request path accordingly.
Option Cleanup: Removed explicit datastore options (RHOST, LHOST, LPORT) as they are included with the payload and no longer needed in the module's options.

 This module exploits a command injection vulnerability in the Cypress Solutions CTM-200 version 2.7.1.
          By injecting commands via the `fw_url` POST parameter in the `ctm-config-upgrade.sh` script,
          an attacker can execute arbitrary commands as the root user.
@bwatters-r7
Copy link
Contributor

bwatters-r7 commented Aug 28, 2024

It looks like this is failing our liniting process:

Rubocop failed. Please run rubocop -a modules/exploits/linux/http/cypress_ctm200_command_injection.rb and verify all issues are resolved

If you have any questions, let us know!

@bwatters-r7 bwatters-r7 added the needs-linting The module needs additional work to pass our automated linting rules label Aug 28, 2024
Copy link

Thanks for your pull request! Before this pull request can be merged, it must pass the checks of our automated linting tools.

We use Rubocop and msftidy to ensure the quality of our code. This can be ran from the root directory of Metasploit:

rubocop <directory or file>
tools/dev/msftidy.rb <directory or file>

You can automate most of these changes with the -a flag:

rubocop -a <directory or file>

Please update your branch after these have been made, and reach out if you have any problems.

1 file inspected, 40 offenses detected, 34 offenses corrected, 2 more offenses can be corrected with `rubocop -A`
@wvu
Copy link
Contributor

wvu commented Aug 28, 2024

Deleted a bunch of files?

@bwatters-r7
Copy link
Contributor

bwatters-r7 commented Aug 29, 2024

This is the second PR I've seen in the last 24 hours with files deleted that I think was unintended....?
#19368

'Arch' => [ARCH_CMD, ARCH_ARM],
'Targets' => [
['Automatic', {}],
['ARM Linux', { 'Arch' => ARCH_ARM }]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
['ARM Linux', { 'Arch' => ARCH_ARM }]
['ARM Linux', { 'Arch' => ARCH_ARM }],
['CMD Linux', { 'Arch' => ARCH_CMD }]

def exploit
if target.name == 'ARM Linux'
# Use CmdStager for ARM payloads
cmd_exec payload.encoded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where cmd_exec defined for this context?
To use CmdStager, you must implement the execute_command method, then call the builtin execute_cmdstager method that will use your execute_command method. See https://docs.metasploit.com/docs/development/developing-modules/guides/how-to-use-command-stagers.htm

Copy link

Thanks for your pull request! Before this can be merged, we need the following documentation for your module:

Comment on lines +36 to +39
'Payload' => {
'Space' => 2048,
'BadChars' => ''
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These settings probably need to be different between the two targets.

Comment on lines +48 to +50
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/reverse_netcat'
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be defined in the target, if it needs to be defined at all. As it is now, it'll be an invalid payload for the ARM target.

@bwatters-r7
Copy link
Contributor

Deleted a bunch of files?

I think the author's antivirus ate them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-docs needs-linting The module needs additional work to pass our automated linting rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants