mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
Translated ['src/network-services-pentesting/pentesting-web/vmware-esx-v
This commit is contained in:
parent
a72cc21946
commit
79c73d3449
@ -110,6 +110,7 @@
|
||||
- [Checklist - Linux Privilege Escalation](linux-hardening/linux-privilege-escalation-checklist.md)
|
||||
- [Linux Privilege Escalation](linux-hardening/privilege-escalation/README.md)
|
||||
- [Android Rooting Frameworks Manager Auth Bypass Syscall Hook](linux-hardening/privilege-escalation/android-rooting-frameworks-manager-auth-bypass-syscall-hook.md)
|
||||
- [Vmware Tools Service Discovery Untrusted Search Path Cve 2025 41244](linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md)
|
||||
- [Arbitrary File Write to Root](linux-hardening/privilege-escalation/write-to-root.md)
|
||||
- [Cisco - vmanage](linux-hardening/privilege-escalation/cisco-vmanage.md)
|
||||
- [Containerd (ctr) Privilege Escalation](linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,146 @@
|
||||
# VMware Tools service discovery LPE (CWE-426) via regex-based binary discovery (CVE-2025-41244)
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
Diese Technik missbraucht regex-gesteuerte Service-Discovery-Pipelines, die laufende Prozess-Commandlines parsen, um Service-Versionen zu ermitteln und anschließend ein Kandidaten-Binary mit einem "version"-Flag auszuführen. Wenn permissive Patterns untrusted, vom Angreifer kontrollierte Pfade akzeptieren (z. B. /tmp/httpd), führt der privilegierte Collector ein beliebiges Binary aus einem untrusted Speicherort aus, was zu Local privilege escalation führt. NVISO dokumentierte dies in VMware Tools/Aria Operations Service Discovery als CVE-2025-41244.
|
||||
|
||||
- Impact: Local privilege escalation to root (or to the privileged discovery account)
|
||||
- Root cause: Untrusted Search Path (CWE-426) + permissive regex matching of process command lines
|
||||
- Affected: open-vm-tools/VMware Tools on Linux (credential-less discovery), VMware Aria Operations SDMP (credential-based discovery via Tools/proxy)
|
||||
|
||||
## How VMware service discovery works (high level)
|
||||
|
||||
- Credential-based (legacy): Aria führt Discovery-Skripte innerhalb des Guests über VMware Tools aus und verwendet konfigurierte privilegierte Zugangsdaten.
|
||||
- Credential-less (modern): Die Discovery-Logik läuft innerhalb von VMware Tools und ist im Guest bereits privilegiert.
|
||||
|
||||
Beide Modi führen letztlich Shell-Logik aus, die Prozesse mit listening sockets scannt, einen passenden Command-Pfad mittels regex extrahiert und das erste argv-Token mit einem version-Flag ausführt.
|
||||
|
||||
## Root cause and vulnerable pattern (open-vm-tools)
|
||||
|
||||
In open-vm-tools stimmt das serviceDiscovery-Plugin-Skript get-versions.sh Kandidaten-Binaries mit weit gefassten regulären Ausdrücken ab und führt das erste Token ohne jegliche trusted-path-Validierung aus:
|
||||
```bash
|
||||
get_version() {
|
||||
PATTERN=$1
|
||||
VERSION_OPTION=$2
|
||||
for p in $space_separated_pids
|
||||
do
|
||||
COMMAND=$(get_command_line $p | grep -Eo "$PATTERN")
|
||||
[ ! -z "$COMMAND" ] && echo VERSIONSTART "$p" "$("${COMMAND%%[[:space:]]*}" $VERSION_OPTION 2>&1)" VERSIONEND
|
||||
done
|
||||
}
|
||||
```
|
||||
Es wird mit freizügigen Mustern aufgerufen, die \S (Nicht-Leerzeichen) enthalten und problemlos mit Nicht-Systempfaden in benutzerschreibbaren Verzeichnissen übereinstimmen:
|
||||
```bash
|
||||
get_version "/\S+/(httpd-prefork|httpd|httpd2-prefork)($|\s)" -v
|
||||
get_version "/usr/(bin|sbin)/apache\S*" -v
|
||||
get_version "/\S+/mysqld($|\s)" -V
|
||||
get_version "\.?/\S*nginx($|\s)" -v
|
||||
get_version "/\S+/srm/bin/vmware-dr($|\s)" --version
|
||||
get_version "/\S+/dataserver($|\s)" -v
|
||||
```
|
||||
- Die Extraktion verwendet grep -Eo und nimmt das erste Token: ${COMMAND%%[[:space:]]*}
|
||||
- Keine whitelist/allowlist von vertrauenswürdigen Systempfaden; jeder entdeckte listener mit einem passenden Namen wird mit -v/--version ausgeführt
|
||||
|
||||
Dies schafft eine untrusted search path execution primitive: beliebige binaries, die in world-writable Verzeichnissen liegen (z. B. /tmp/httpd), werden von einer privilegierten Komponente ausgeführt.
|
||||
|
||||
## Exploitation (both credential-less and credential-based modes)
|
||||
|
||||
Preconditions
|
||||
- Sie können einen unprivilegierten Prozess ausführen, der auf dem guest einen listening socket öffnet.
|
||||
- Der discovery job ist aktiviert und läuft periodisch (historisch ~5 Minuten).
|
||||
|
||||
Steps
|
||||
1) Stage ein binary in einem Pfad, der einem der permissive regexes entspricht, z. B. /tmp/httpd oder ./nginx
|
||||
2) Führe es als niedrig-privilegierter Benutzer aus und stelle sicher, dass es einen listening socket öffnet
|
||||
3) Warte auf den discovery cycle; der privilegierte collector wird automatisch ausführen: /tmp/httpd -v (oder ähnlich), wodurch dein Programm als root ausgeführt wird
|
||||
|
||||
Minimal demo (using NVISO’s approach)
|
||||
```bash
|
||||
# Build any small helper that:
|
||||
# - default mode: opens a dummy TCP listener
|
||||
# - when called with -v/--version: performs the privileged action (e.g., connect to an abstract UNIX socket and spawn /bin/sh -i)
|
||||
# Example staging and trigger
|
||||
cp your_helper /tmp/httpd
|
||||
chmod +x /tmp/httpd
|
||||
/tmp/httpd # run as low-priv user and wait for the cycle
|
||||
# After the next cycle, expect a root shell or your privileged action
|
||||
```
|
||||
Typische Prozessabfolge
|
||||
- Credential-based: /usr/bin/vmtoolsd -> /bin/sh /tmp/VMware-SDMP-Scripts-.../script_...sh -> /tmp/httpd -v -> /bin/sh -i
|
||||
- Credential-less: /bin/sh .../get-versions.sh -> /tmp/httpd -v -> /bin/sh -i
|
||||
|
||||
Artefakte (credential-based)
|
||||
Wiederhergestellte SDMP-Wrapper-Skripte unter /tmp/VMware-SDMP-Scripts-{UUID}/ können die direkte Ausführung des bösartigen Pfads zeigen:
|
||||
```bash
|
||||
/tmp/httpd -v >"/tmp/VMware-SDMP-Scripts-{UUID}/script_-{ID}_0.stdout" 2>"/tmp/VMware-SDMP-Scripts-{UUID}/script_-{ID}_0.stderr"
|
||||
```
|
||||
## Generalizing the technique: regex-driven discovery abuse (portable pattern)
|
||||
|
||||
Viele Agents und Monitoring-Suites führen Version-/Service-Erkennung durch, indem sie:
|
||||
- Prozesse mit hörenden Sockets enumerieren
|
||||
- argv/command lines mit permissiven regexes durchsuchen (z. B. Muster, die \S enthalten)
|
||||
- den gefundenen Pfad mit einem harmlosen Flag wie -v, --version, -V, -h ausführen
|
||||
|
||||
Wenn die Regex untrusted paths akzeptiert und der Pfad aus einem privilegierten Kontext ausgeführt wird, erhält man CWE-426 Untrusted Search Path execution.
|
||||
|
||||
Abuse recipe
|
||||
- Benennen Sie Ihr Binary wie gängige Daemons, die die Regex wahrscheinlich matched: httpd, nginx, mysqld, dataserver
|
||||
- Platzieren Sie es in einem beschreibbaren Verzeichnis: /tmp/httpd, ./nginx
|
||||
- Stellen Sie sicher, dass es der Regex entspricht und einen beliebigen Port öffnet, um enumeriert zu werden
|
||||
- Warten Sie auf den geplanten Collector; Sie erhalten eine automatische privilegierte Invocation von <path> -v
|
||||
|
||||
Masquerading note: This aligns with MITRE ATT&CK T1036.005 (Match Legitimate Name or Location) to increase match probability and stealth.
|
||||
|
||||
Reusable privileged I/O relay trick
|
||||
- Bauen Sie Ihren Helfer so, dass er bei privilegierter Invocation (-v/--version) eine Verbindung zu einem bekannten Rendezvous herstellt (z. B. ein Linux abstract UNIX socket wie @cve) und stdio zu /bin/sh -i bridged. Das vermeidet Artefakte auf der Festplatte und funktioniert in vielen Umgebungen, in denen dasselbe Binary mit einem Flag erneut aufgerufen wird.
|
||||
|
||||
## Detection and DFIR guidance
|
||||
|
||||
Hunting queries
|
||||
- Ungewöhnliche Kinder von vmtoolsd oder get-versions.sh wie /tmp/httpd, ./nginx, /tmp/mysqld
|
||||
- Jegliche Ausführung von Nicht-System-Absolute-Pfaden durch discovery scripts (achten Sie auf Leerzeichen in ${COMMAND%%...}-Expansions)
|
||||
- ps -ef --forest zur Visualisierung von Abstammungsbäumen: vmtoolsd -> get-versions.sh -> <non-system path>
|
||||
|
||||
On Aria SDMP (credential-based)
|
||||
- Untersuchen Sie /tmp/VMware-SDMP-Scripts-{UUID}/ auf transiente Skripte und stdout/stderr-Artefakte, die die Ausführung von Angreifer-Pfaden zeigen
|
||||
|
||||
Policy/telemetry
|
||||
- Alarmieren, wenn privilegierte Collector aus Nicht-System-Präfixen ausgeführt werden: ^/(tmp|home|var/tmp|dev/shm)/
|
||||
- File-integrity-Monitoring für get-versions.sh und VMware Tools plugins
|
||||
|
||||
## Mitigations
|
||||
|
||||
- Patch: Apply Broadcom/VMware updates for CVE-2025-41244 (Tools and Aria Operations SDMP)
|
||||
- Disable or restrict credential-less discovery where feasible
|
||||
- Validate trusted paths: restrict execution to allowlisted directories (/usr/sbin, /usr/bin, /sbin, /bin) and only exact known binaries
|
||||
- Avoid permissive regexes with \S; prefer anchored, explicit absolute paths and exact command names
|
||||
- Drop privileges for discovery helpers where possible; sandbox (seccomp/AppArmor) to reduce impact
|
||||
- Monitor for and alert on vmtoolsd/get-versions.sh executing non-system paths
|
||||
|
||||
## Notes for defenders and implementers
|
||||
|
||||
Safer matching and execution pattern
|
||||
```bash
|
||||
# Bad: permissive regex and blind exec
|
||||
COMMAND=$(get_command_line "$pid" | grep -Eo "/\\S+/nginx(\$|\\s)")
|
||||
[ -n "$COMMAND" ] && "${COMMAND%%[[:space:]]*}" -v
|
||||
|
||||
# Good: strict allowlist + path checks
|
||||
candidate=$(get_command_line "$pid" | awk '{print $1}')
|
||||
case "$candidate" in
|
||||
/usr/sbin/nginx|/usr/sbin/httpd|/usr/sbin/apache2)
|
||||
"$candidate" -v 2>&1 ;;
|
||||
*)
|
||||
: # ignore non-allowlisted paths
|
||||
;;
|
||||
esac
|
||||
```
|
||||
## Referenzen
|
||||
|
||||
- [NVISO – You name it, VMware elevates it (CVE-2025-41244)](https://blog.nviso.eu/2025/09/29/you-name-it-vmware-elevates-it-cve-2025-41244/)
|
||||
- [Broadcom Sicherheitshinweis für CVE-2025-41244](https://support.broadcom.com/web/ecx/support-content-notification/-/external/content/SecurityAdvisories/0/36149)
|
||||
- [open-vm-tools – serviceDiscovery/get-versions.sh (stable-13.0.0)](https://github.com/vmware/open-vm-tools/blob/stable-13.0.0/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh)
|
||||
- [MITRE ATT&CK T1036.005 – Match Legitimate Name or Location](https://attack.mitre.org/techniques/T1036/005/)
|
||||
- [CWE-426: Untrusted Search Path](https://cwe.mitre.org/data/definitions/426.html)
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
@ -1,16 +1,26 @@
|
||||
# VMware ESX / vCenter Pentesting
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
# Aufzählung
|
||||
## Aufklärung
|
||||
```bash
|
||||
nmap -sV --script "http-vmware-path-vuln or vmware-version" -p <PORT> <IP>
|
||||
msf> use auxiliary/scanner/vmware/esx_fingerprint
|
||||
msf> use auxiliary/scanner/http/ms15_034_http_sys_memory_dump
|
||||
```
|
||||
# Bruteforce
|
||||
## Bruteforce
|
||||
```bash
|
||||
msf> auxiliary/scanner/vmware/vmware_http_login
|
||||
```
|
||||
Wenn Sie gültige Anmeldeinformationen finden, können Sie weitere Metasploit-Scanner-Module verwenden, um Informationen zu erhalten.
|
||||
Wenn Sie gültige Anmeldeinformationen finden, können Sie weitere metasploit scanner modules verwenden, um Informationen zu erhalten.
|
||||
|
||||
### Siehe auch
|
||||
|
||||
Linux LPE via VMware Tools service discovery (CWE-426 / CVE-2025-41244):
|
||||
|
||||
{{#ref}}
|
||||
../../linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md
|
||||
{{#endref}}
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user