OSINT & Modern Recon Uncover Global VPN Infrastructure
OSINT and recon that uncovers (and breaks) global OpenVPN infrastructure.
Summary
From Dare to Discovery: Uncovering a Global VPN Infrastructure with OSINT and Recon Techniques
This presentation details a comprehensive attack chain that leverages Open-Source Intelligence (OSINT) and modern reconnaissance techniques to uncover and exploit vulnerabilities within a global VPN infrastructure, primarily focusing on OpenVPN.
The Genesis: A Gaming Dare
The research began with a personal challenge: a friend's claim about using ExpressVPN led to a dare to prove the technology's flaws. This sparked an investigation into ExpressVPN's drivers.
Initial Vulnerability: Kernel Memory Corruption
Top Adapter Driver: Reverse-engineering the driver revealed a vulnerability in the miniport_send_buffer_list function. This function allocates memory and copies data, but an integer overflow can occur if a large enough value is provided for the size, leading to a kernel memory overwrite.
ProtonVPN Driver: The same bug was found in the ProtonVPN driver, suggesting a systematic issue rather than an isolated incident.
Broadening the Scope: OpenVPN as the Common Thread
YARA Rules: Yara rules were created to search for the problematic memory allocation pattern, revealing approximately 50 instances across various drivers.
OpenVPN's Ubiquity: OpenVPN was identified as a widely used open-source VPN protocol, powering services like ExpressVPN, NordVPN, and CyberGhost. Its extensive codebase and adoption across numerous platforms (Windows, Linux, macOS, iOS, Android) made it a prime target.
Vulnerability in OpenVPN: The specific vulnerability was found in the tap-windows6 repository of OpenVPN, confirming the initial hypothesis.
Deep Dive into OpenVPN Architecture
Core Components: Key components include the OpenVPN daemon (for VPN operations), OpenVPN GUI (for Windows user interface), and the tap-windows6 driver.
Client-Server Communication: Standard SSL/TLS communication with a classical handshake is used.
Windows Service Architecture: The OpenVPN service on Windows uses named pipes (OpenVPN/service) for communication with client processes. It handles startup data (directory, configuration, log file) to launch OpenVPN daemons and impersonates clients for security validation.
Plugins: OpenVPN supports plugins (DLLs) for extended functionality like credential validation and event logging.
Exploiting the Vulnerability: Local Privilege Escalation (LPE)
Stack Overflow in OpenVPN Service: A vulnerability was found in how the OpenVPN service handles messages from the OpenVPN daemon. By sending oversized data, a stack overflow can occur within the HandleMessage function, overwriting stack-allocated structures.
Canary Bypass: While stack cookies (canaries) are present, the initialization logic for these cookies involves XORing various system details, making them difficult to predict. However, the vulnerability's nature allows for crashing the process if not carefully exploited.
Named Pipe Race Conditions: Exploiting named pipes involves understanding race conditions where a client might connect to a rogue pipe if created before the legitimate service. The Superflow pipe connectivity issue also allows attackers to impersonate clients.
LPE Exploit Chain: The exploit involves:
Creating a malicious DLL (plugin).
Loading this DLL into the OpenVPN daemon.
Crushing the OpenVPN service via the inner named pipe using the stack overflow vulnerability.
The OpenVPN daemon then creates a new named pipe.
A subsequent connection to this pipe is redirected to the malicious plugin.
The malicious plugin impersonates the client and executes a malicious executable (e.g., driver_communicator.exe) with the client's privileges.
This results in Local Privilege Escalation, potentially to SYSTEM level.
Towards Remote Code Execution (RCE)
Remote Named Pipe Access: Windows allows remote access to named pipes via protocols like SMB/SMB2. This requires credentials.
Credential Harvesting: Techniques like sniffing network traffic for NTLM hashes (using tools like Responder) and cracking them (with Hashcat or John the Ripper) are employed.
Cloud-Based Cracking: Utilizing cloud platforms like Vast.ai with powerful GPUs (e.g., RTX 4090) significantly speeds up hash cracking, enabling the compromise of long passwords in minutes.
RCE Exploit Chain: The process involves:
Harvesting and cracking NTLM hashes to obtain valid credentials.
Using net use to connect to the remote machine's IPC share.
Connecting to the remote OpenVPN service's named pipe.
Passing a malicious configuration pointing to an attacker-controlled share.
Loading a malicious plugin from the attacker-controlled share.
This plugin executes code on the remote machine, demonstrating RCE (e.g., dumping files).
The Full Chain: RCE to SYSTEM and Beyond
Combining LPE and RCE: The RCE exploit can be augmented with the LPE logic to achieve SYSTEM-level privileges.
Abusing AppID Flow: The research leverages the AppID flow to gain arbitrary kernel read/write primitives. This involves overwriting specific fields in kernel structures.
Bypassing Security Measures: With kernel read/write access, attackers can disable or crash security processes like wininit.exe (a Protected Process Light - PPL) by overwriting its protection flags. This allows for stealthier operations, bypassing antivirus and other security software.
Final Attack Chain: Remote Code Execution (via plugin) -> Local Privilege Escalation (via LPE logic) -> Arbitrary Kernel Read/Write (via AppID flow abuse) -> Crushing PPL processes (e.g., wininit.exe).
Takeaways and Tools
Plugin Vulnerabilities: Weak implementations in plugin mechanisms can lead to significant security risks.
Cloud Resource Utilization: Renting cloud GPU instances is a cost-effective and efficient method for password cracking.
OSINT and Recon Synergy: OSINT and reconnaissance tools (VirusTotal, YARA rules, Shodan, ZoomEye) are invaluable for identifying widespread vulnerabilities and understanding software popularity.
Attacker Motivation: Attackers can leverage these techniques for stealth, bypassing security controls, and achieving persistent access.
Related talks
Recon Village·45 min
Levi
Introduces Ambly, an open-source dark web crawler and spider for mapping hidden Tor services and onion sites.
Recon Village·32 min
Master Chen
Demonstrates techniques and Python tooling for analyzing word frequencies, keyword trends, and linguistic patterns across Twitter data.
Recon Village·49 min
William Suthers
PIE HW based Prebellico Intel Exfiltration Botnet


