Translated ['src/linux-hardening/privilege-escalation/vmware-tools-servi

This commit is contained in:
Translator 2025-10-01 10:27:04 +00:00
parent 548b5621ce
commit 3f8afc1c82
4 changed files with 521 additions and 305 deletions

View File

@ -110,6 +110,7 @@
- [Checklist - Linux Privilege Escalation](linux-hardening/linux-privilege-escalation-checklist.md) - [Checklist - Linux Privilege Escalation](linux-hardening/linux-privilege-escalation-checklist.md)
- [Linux Privilege Escalation](linux-hardening/privilege-escalation/README.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) - [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) - [Arbitrary File Write to Root](linux-hardening/privilege-escalation/write-to-root.md)
- [Cisco - vmanage](linux-hardening/privilege-escalation/cisco-vmanage.md) - [Cisco - vmanage](linux-hardening/privilege-escalation/cisco-vmanage.md)
- [Containerd (ctr) Privilege Escalation](linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md) - [Containerd (ctr) Privilege Escalation](linux-hardening/privilege-escalation/containerd-ctr-privilege-escalation.md)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
# VMware Tools service discovery LPE (CWE-426) via regex-based binary discovery (CVE-2025-41244)
{{#include ../../banners/hacktricks-training.md}}
यह तकनीक उन regex-driven service discovery pipelines का दुरुपयोग करती है जो चल रहे process command lines को parse करके service versions का अनुमान लगाती हैं और फिर candidate binary को "version" flag के साथ execute करती हैं। जब permissive patterns untrusted, attacker-controlled paths (उदा., /tmp/httpd) को स्वीकार करते हैं, तो privileged collector untrusted स्थान से arbitrary binary को execute कर देता है, जिससे local privilege escalation हो सकता है। NVISO ने इसे VMware Tools/Aria Operations Service Discovery में CVE-2025-41244 के रूप में दस्तावेजीकृत किया।
- प्रभाव: Local privilege escalation to root (or to the privileged discovery account)
- मूल कारण: Untrusted Search Path (CWE-426) + permissive regex matching of process command lines
- प्रभावित: 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 (उच्च-स्तरीय)
- Credential-based (legacy): Aria, configured privileged credentials का उपयोग करके, VMware Tools के माध्यम से guest के अंदर discovery scripts चलाता है।
- Credential-less (modern): Discovery logic VMware Tools के अंदर चलता है, जो पहले से ही guest में privileged होता है।
दोनों मोड अंततः shell logic चलाते हैं जो listening sockets वाले processes को scan करता है, regex के जरिए matching command path निकालता है, और पहले argv token को version flag के साथ execute करता है।
## Root cause and vulnerable pattern (open-vm-tools)
open-vm-tools में, serviceDiscovery plugin script get-versions.sh candidate binaries को broad regular expressions से match करता है और किसी भी trusted-path validation के बिना पहले token को execute करता है:
```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
}
```
यह permissive patterns में \S (non-whitespace) होने के साथ बुलाया जाता है, जो user-writable स्थानों में non-system paths से आसानी से मेल खा लेगा:
```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
```
- निष्कर्षण के लिए grep -Eo का उपयोग किया जाता है और पहला टोकन लिया जाता है: ${COMMAND%%[[:space:]]*}
- कोई whitelist/allowlist of trusted system paths नहीं है; किसी भी discovered listener जिसका नाम मैच करता है उसे -v/--version के साथ execute किया जाता है
This creates an untrusted search path execution primitive: world-writable निर्देशिकाओं (e.g., /tmp/httpd) में स्थित arbitrary binaries को एक privileged component द्वारा execute किया जाता है।
## Exploitation (दोनों credential-less और credential-based मोड)
Preconditions
- आप एक unprivileged process चला सकते हैं जो guest पर एक listening socket खोलता है।
- discovery job सक्षम है और आवधिक रूप से चलता है (इतिहासिक रूप से ~5 मिनट)।
Steps
1) permissive regexes में से किसी एक से मेल खाने वाले path में एक binary stage करें, जैसे /tmp/httpd या ./nginx
2) इसे low-privileged user के रूप में चलाएँ और सुनिश्चित करें कि यह कोई listening socket खोलता है
3) discovery cycle का इंतजार करें; privileged collector स्वचालित रूप से execute करेगा: /tmp/httpd -v (या समान), आपके प्रोग्राम को root के रूप में चलाते हुए
Minimal demo (using NVISOs 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
```
सामान्य प्रक्रिया वंशावली
- 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
आर्टिफैक्ट्स (credential-based)
पुनःप्राप्त SDMP wrapper scripts under /tmp/VMware-SDMP-Scripts-{UUID}/ may show direct execution of the दुष्ट पथ:
```bash
/tmp/httpd -v >"/tmp/VMware-SDMP-Scripts-{UUID}/script_-{ID}_0.stdout" 2>"/tmp/VMware-SDMP-Scripts-{UUID}/script_-{ID}_0.stderr"
```
## तकनीक का सामान्यीकरण: regex-driven discovery abuse (portable pattern)
कई agents और monitoring suites version/service discovery को निम्न तरीकों से लागू करते हैं:
- listening sockets वाले processes की enumeration करना
- argv/command lines को permissive regexes (जैसे \S वाले पैटर्न) से grep करना
- मैच हुए path को किसी benign flag के साथ execute करना जैसे -v, --version, -V, -h
यदि regex untrusted paths को स्वीकार करता है और वह path privileged context से execute होता है, तो CWE-426 Untrusted Search Path execution हो सकता है।
दुरुपयोग विधि
- अपने binary का नाम उन सामान्य daemons जैसा रखें जिनसे regex मेल खाने की संभावना हो: httpd, nginx, mysqld, dataserver
- इसे किसी writable directory में रखें: /tmp/httpd, ./nginx
- सुनिश्चित करें कि यह regex से मैच करता है और किसी भी पोर्ट को खोलता है ताकि इसे enumerate किया जा सके
- शेड्यूल्ड collector का इंतजार करें; आपको स्वतः ही privileged invocation मिलेगा: <path> -v
Masquerading note: यह MITRE ATT&CK T1036.005 (Match Legitimate Name or Location) के अनुरूप है ताकि मैच की संभावना और stealth बढ़ सके।
पुन: प्रयोज्य privileged I/O relay ट्रिक
- अपने helper को इस तरह बनाएं कि privileged invocation (-v/--version) पर यह किसी ज्ञात rendezvous से कनेक्ट करे (उदा., Linux abstract UNIX socket जैसे @cve) और stdio को /bin/sh -i से ब्रिज करे। यह on-disk artifacts से बचता है और उन कई वातावरणों में काम करता है जहाँ वही binary फ्लैग के साथ फिर से invoke किया जाता है।
## Detection and DFIR guidance
Hunting queries
- vmtoolsd या get-versions.sh के अनपेक्षित children जैसे /tmp/httpd, ./nginx, /tmp/mysqld
- discovery scripts द्वारा non-system absolute paths का कोई भी execution (दिखने के लिए ${COMMAND%%...} expansions में spaces की तलाश करें)
- ps -ef --forest से ancestry trees को visualize करें: vmtoolsd -> get-versions.sh -> <non-system path>
On Aria SDMP (credential-based)
- /tmp/VMware-SDMP-Scripts-{UUID}/ की जाँच करें transient scripts और stdout/stderr artifacts के लिए जो attacker paths के execution को दिखाते हों
Policy/telemetry
- जब privileged collectors non-system prefixes से execute हों तो alert जनरेट करें: ^/(tmp|home|var/tmp|dev/shm)/
- get-versions.sh और VMware Tools plugins पर file integrity monitoring लागू करें
## Mitigations
- Patch: CVE-2025-41244 (Tools and Aria Operations SDMP) के लिए Broadcom/VMware updates लागू करें
- जहाँ संभव हो credential-less discovery को disable या restrict करें
- trusted paths को validate करें: execution को allowlisted directories (/usr/sbin, /usr/bin, /sbin, /bin) तक सीमित करें और केवल exact known binaries की अनुमति दें
- \S जैसी permissive regexes से बचें; anchored, explicit absolute paths और exact command names को प्राथमिकता दें
- जहाँ संभव हो discovery helpers के privileges ड्रॉप करें; प्रभाव कम करने के लिए sandbox (seccomp/AppArmor) का उपयोग करें
- vmtoolsd/get-versions.sh द्वारा non-system paths के execution के लिए monitor और alert करें
## Notes for defenders and implementers
सुरक्षित matching और 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
```
## संदर्भ
- [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 advisory for 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}}

View File

@ -1,16 +1,26 @@
# VMware ESX / vCenter Pentesting
{{#include ../../banners/hacktricks-training.md}} {{#include ../../banners/hacktricks-training.md}}
# गणना ## Enumeration
```bash ```bash
nmap -sV --script "http-vmware-path-vuln or vmware-version" -p <PORT> <IP> nmap -sV --script "http-vmware-path-vuln or vmware-version" -p <PORT> <IP>
msf> use auxiliary/scanner/vmware/esx_fingerprint msf> use auxiliary/scanner/vmware/esx_fingerprint
msf> use auxiliary/scanner/http/ms15_034_http_sys_memory_dump msf> use auxiliary/scanner/http/ms15_034_http_sys_memory_dump
``` ```
# ब्रूटफोर्स ## Bruteforce
```bash ```bash
msf> auxiliary/scanner/vmware/vmware_http_login msf> auxiliary/scanner/vmware/vmware_http_login
``` ```
यदि आप मान्य क्रेडेंशियल्स पाते हैं, तो आप अधिक मेटास्प्लोट स्कैनर मॉड्यूल का उपयोग करके जानकारी प्राप्त कर सकते हैं। यदि आपको मान्य क्रेडेंशियल्स मिलते हैं, तो जानकारी प्राप्त करने के लिए आप और metasploit scanner modules का उपयोग कर सकते हैं।
### यह भी देखें
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}} {{#include ../../banners/hacktricks-training.md}}