Living off the Land with Connectwise: How I Built An Attack Platform & Botnet in 23 lines of Python!

Ken Pyle (Partner · CYBIR)

AppSec Village @ DEF CON 31 · Day 1 · AppSec Village

Overview

This talk, presented by Ken Pyle at AppSec Village @ DEF CON 31, unveils a series of critical vulnerabilities and misconfigurations within Connectwise Control and ScreenConnect, popular RMM (Remote Monitoring and Management) software used by MSPs (Managed Service Providers) and large organizations. Pyle demonstrates how he leveraged these weaknesses to construct a sophisticated attack platform and botnet, capable of bypassing firewalls, evading detection, and achieving remote code execution, all with minimal code. The presentation underscores a fundamental disconnect between application developers and network security, emphasizing that a lack of understanding of the OSI model and basic network principles creates glaring security holes.

Watch on YouTube

Visual summary for Living off the Land with Connectwise: How I Built An Attack Platform & Botnet in 23 lines of Python! by Ken Pyle
Visual summary for Living off the Land with Connectwise: How I Built An Attack Platform & Botnet in 23 lines of Python! by Ken Pyle

Key moments

  1. 0:00 Introduction and speaker's zero-day hunting background
  2. 7:40 ConnectWise disclosure, downplaying, and high-severity CVEs
  3. 14:00 Abusing wildcard SSL certificates and code signing flaws
  4. 27:00 Exploiting the 'Port Test Tool' with Server-Side Request Forgery
  5. 37:00 Inventing HTTP status code 666 for data exfiltration
  6. 47:00 Live demo: Remote agent installation via frame injection
  7. 51:00 Call to action: Developers, understand networks, be responsible

Living off the Land with Connectwise: How I Built An Attack Platform & Botnet in 23 lines of Python!

Speakers: Ken Pyle (Partner, CYBIR)

Conference: AppSec Village @ DEF CON 31

YouTube: https://www.youtube.com/watch?v=fbNVUgmstSc

Overview

This talk, presented by Ken Pyle at AppSec Village @ DEF CON 31, unveils a series of critical vulnerabilities and misconfigurations within Connectwise Control and ScreenConnect, popular RMM (Remote Monitoring and Management) software used by MSPs (Managed Service Providers) and large organizations. Pyle demonstrates how he leveraged these weaknesses to construct a sophisticated attack platform and botnet, capable of bypassing firewalls, evading detection, and achieving remote code execution, all with minimal code. The presentation underscores a fundamental disconnect between application developers and network security, emphasizing that a lack of understanding of the OSI model and basic network principles creates glaring security holes.

Pyle's research showcases how seemingly innocuous features and common operational oversights can be chained together to create devastating attack surfaces. He coined a novel technique, HTTP status code injection, to exfiltrate data and deliver client-side exploits. The talk serves as a stark warning about the security posture of critical supply chain management (SCM) software, highlighting the dangers of relying on vendor assurances without thorough independent verification. It challenges the industry to reconsider how vulnerabilities are disclosed, analyzed, and acknowledged, advocating for a more holistic approach to security that bridges the gap between application and network domains.

Background

▶ Watch: Introduction and speaker's zero-day hunting background (0:00)

Ken Pyle, a seasoned exploit developer and self-proclaimed "prolific zero-day hunter," began his detailed disclosure process to Connectwise regarding his findings in October 2022. Initially, the vulnerabilities were downplayed by the vendor as "minimally impactful," despite subsequent patching efforts. Pyle, frustrated by the lack of acknowledgment and the dismissal of his work, escalated the issue to MITRE, the CVE Numbering Authority (CNA) of last resort. This resulted in the assignment of CVEs with a severity rating of 9.8, a stark contrast to the vendor's initial assessment.

The controversy deepened when, coincidentally with a blog post by Pyle detailing his findings, Connectwise released an advisory warning about phishing campaigns and client-side exploitation—tactics bearing striking similarities to Pyle's research. Further, a third-party company published an analysis dismissing Pyle's work, which Pyle critically re-evaluated, finding "potential omissions and issues." This contentious environment fueled Pyle's motivation to publicly present his full research, demonstrating how the vulnerabilities, when chained together, formed a robust "attack platform" for living off the land—a strategy where attackers leverage existing tools and functionalities of a compromised system to achieve their objectives, making detection difficult. Pyle's argument centers on the idea that these issues stem from a fundamental misunderstanding of network interactions by application developers, a gap he, as a former MSP engineer, intrinsically understands.

Key Findings

▶ Watch: Abusing wildcard SSL certificates and code signing flaws (14:00)

Pyle's research uncovered a multifaceted attack surface within Connectwise Control, stemming from a combination of design flaws, misconfigurations, and operational oversights. The key findings include:

  • Weak SSL Inspection Bypass: Organizations often whitelist *.screenconnect.com in their SSL inspection rules, inadvertently disabling security scrutiny for any subdomain within that wildcard.
  • FQDN Takeover and Subdomain Abuse: Pyle demonstrated the ability to register expired subdomains (e.g., company.screenconnect.com) previously used by organizations, effectively taking control of their former FQDNs. If the original company's security controls were not updated, this allowed Pyle to inherit their whitelisted trust.
  • Universal Wildcard SSL Certificates: Connectwise issued the same wildcard SSL certificate to all instances, regardless of whether they were corporate accounts or free trials. This undermined the cryptographic principle of key control and allowed attackers to leverage trusted certificates.
  • Compromised Code Signing: The click-once installer for the Connectwise agent contained an "unregulated space" in its metadata. Modifying this space allowed attackers to inject arbitrary code without invalidating the code signing certificate. This bypassed hash banning by AV (Antivirus) and EDR (Endpoint Detection and Response) solutions, which rely on file hashes and code signatures for trust.
  • Insecure Agent Delivery (HTTP): The Connectwise agent was often transmitted via plain HTTP, making it vulnerable to man-in-the-middle (MiTM) attacks. Attackers could intercept, modify, and re-sign the executable before delivery, achieving backdoored system access without social engineering.
  • Unauthenticated Diagnostic "Port Test Tool" Leading to SSRF: The most critical finding was an unauthenticated, publicly accessible "Port Test Tool" designed to test network connectivity. This tool was susceptible to Server-Side Request Forgery (SSRF), allowing Pyle to control the destination IP address and port of HTTP requests originating from Connectwise's own servers.
  • SSRF as a Blind Proxy and Port Scanner: The SSRF vulnerability transformed Connectwise's servers into a proxy, enabling Pyle to perform internal port scanning (e.g., targeting 127.0.0.1 via DNS tricks like lb.corp.xyz) and bypass egress firewall rules, as traffic originated from a trusted Connectwise IP.
  • Content Enumeration via SSRF: By observing the HTTP status codes returned by the SSRF, Pyle could enumerate content on internal and external web servers, effectively turning the tool into a Durbuster equivalent.
  • Novel HTTP Status Code Injection ("HTTP 666"): Pyle discovered that the text portion of HTTP status codes (e.g., "OK" in "200 OK") was not sanitized and could be controlled by an attacker's server. By setting up a custom web server to return a malicious payload within the status code text (e.g., "666 <script>alert('XSS')</script>"), he could inject cross-site scripting (XSS) directly into the Connectwise web interface, as the application integrated this text directly into its rendered page.
  • C2 and Exfiltration via DNS/HTTP Beaconing: The SSRF and status code injection provided two one-way communication channels that could be combined for two-way communication. Pyle demonstrated encoding Base64 payloads within HTTP requests or the injected status code text, creating covert C2 (Command and Control) and data exfiltration channels.
  • No-Click Client-Side Exploitation: By embedding a malicious Connectwise agent download within a hidden iframe on a compromised webpage (or a registered FQDN), Pyle could trigger an automatic, "no-click" installation of his backdoored agent, granting system access.
  • Metadata Leakage (Debugging Symbols): Pyle found that Connectwise's click-once installer contained debugging symbols, revealing internal network paths and usernames (e.g., C:\Users\username\Source\screenconnect\work\MK\bootstrapper\release\ClickOnceRunner). This metadata could be used to map Connectwise's internal network and identify developer practices.

These findings collectively painted a picture of a widely deployed, critical piece of infrastructure software with significant, chained vulnerabilities, primarily rooted in a lack of holistic security understanding.

Technical Deep Dive

▶ Watch: Exploiting the 'Port Test Tool' with Server-Side Request Forgery (27:00)

The technical core of Pyle's attack chain revolves around abusing the Connectwise Control ecosystem, specifically its ScreenConnect component, through a series of interconnected vulnerabilities.

The initial entry points often leveraged lax network security practices. When organizations configured their firewalls and SSL inspection to whitelist *.screenconnect.com, they effectively created a blind spot. Pyle exploited this by registering expired FQDNs that were previously used by Connectwise customers. For instance, if oldcompany.screenconnect.com was whitelisted and later expired, Pyle could register it. Any client still configured to trust or connect to this domain, or any user susceptible to phishing to this now-controlled domain, would fall under Pyle's influence, bypassing established security controls. This is further exacerbated by Connectwise issuing the same wildcard SSL certificate to all instances, whether legitimate corporate deployments or anonymous trial accounts. This meant Pyle's rogue instances appeared as cryptographically legitimate as any paying customer's.

A critical vulnerability lay in the Connectwise agent's click-once installer. While signed with a legitimate code signing certificate, Pyle discovered an "unregulated space" within its metadata. By injecting arbitrary data into this space, he could alter the file's hash without invalidating the digital signature. This rendered traditional hash banning by AV and EDR solutions ineffective, as the hash changed with each modification, and the signature remained valid. Compounding this, the agent was often delivered over insecure HTTP, allowing for man-in-the-middle (MiTM) attacks. An attacker could intercept the download, inject their malicious payload into the unregulated space, and then forward the backdoored, yet still legitimately signed, executable to the target. Pyle demonstrated this by having a modified client execute an arbitrary HTTP request to an IP of his designation, proving that code execution could be achieved within a signed executable. This directly violated the Integrity aspect of the CIA Triad.

The linchpin of Pyle's attack platform was the Connectwise Port Test Tool. This web-based diagnostic utility, designed to help users test external connectivity to their Connectwise instances, was unauthenticated and publicly accessible. Users would input a hostname/IP and a port, and the Connectwise server would attempt a connection. Pyle identified this as a classic Server-Side Request Forgery (SSRF) vulnerability. When he submitted a POST request to this tool, the Connectwise server (identified by its IP, e.g., 52.221.111.41) would perform 3-5 DNS requests and then generate an HTTP request to the user-controlled target. Crucially, this request originated from the Connectwise server's IP address, not Pyle's.

This SSRF became a potent weapon:

  1. Port Scanner and Internal Network Mapper: By iterating through ports and targeting specific internal IP addresses (e.g., 127.0.0.1 via DNS resolution tricks like lb.corp.xyz), Pyle could map internal networks and identify open ports behind firewalls that whitelisted *.screenconnect.com traffic.
  2. Firewall Bypass and Proxy: Since the traffic originated from Connectwise's trusted IP, it bypassed most egress firewall rules. The SSRF effectively acted as a limited proxy, allowing Pyle to tunnel traffic out of otherwise highly restricted environments, including critical infrastructure.
  3. Content Enumeration: The tool returned a "succeeded" message for successful connections. However, Pyle discovered that if the target server returned an HTTP status code, the Connectwise tool would sometimes relay this information. This allowed him to perform Durbuster-like content enumeration by checking for various HTTP status codes (e.g., 200, 404) against lists of common directory names.

Pyle's most novel contribution was HTTP status code injection. He realized that while the numerical HTTP status code (e.g., 200, 404) was recorded, the accompanying text (e.g., "OK", "Not Found") was often unmonitored and unsanitized. By controlling a target server that the SSRF would query, Pyle configured it to return a custom HTTP status code, such as "HTTP/1.1 666 <script>alert('XSS')</script>". When the Connectwise web page integrated this status message, it directly rendered the injected JavaScript, leading to XSS because the browser considered it legitimate content from a trusted source. This technique provided a covert channel for delivering client-side exploits with virtually no IOCs (Indicators of Compromise) on the Connectwise side.

Combining these techniques, Pyle built a full C2 and exfiltration mechanism. He could encode Base64 payloads within the arbitrary HTTP requests generated by the SSRF or embed them within the injected HTTP status code text. His external Amazon EC2 server, configured with strict firewall rules to only accept traffic from Connectwise's IP, would receive these payloads, decode them, and process them. This demonstrated a two-way communication channel built from two one-way channels, allowing data exfiltration and command delivery through a trusted, monitored, and unauthenticated service.

Finally, Pyle showed how to achieve no-click client-side exploitation. By hosting a malicious Connectwise agent (backdoored using the code signing vulnerability) on one of his controlled Connectwise instances, he could then embed an iframe containing the download URL into any web page he could inject content into (e.g., via the XSS from status code injection, or a compromised subdomain). Using the hidden tag within the iframe, the agent would download and install automatically, granting system-level access to the victim's machine. This attack was further refined by manipulating the target web page's content, making it appear as a legitimate "port testing module download," tricking users into allowing the installation (though even without interaction, it could install).

Pyle also noted that the Connectwise client application itself was a wrapped web browser, making it potentially exploitable through browser-specific vulnerabilities. He also highlighted the presence of debugging symbols in the distributed software, exposing internal file paths and usernames, which could aid in further mapping Connectwise's internal network architecture.

Demo / Proof of Concept

▶ Watch: Live demo: Remote agent installation via frame injection (47:00)

Pyle provided a compelling live demonstration of the no-click client-side exploitation and the HTTP status code injection attack. The demonstration began with Pyle showing a specially crafted URL, which, when accessed, would trigger the malicious payload. This URL incorporated the "HTTP 666" status code injection, designed to serve a hidden iframe that initiated the download of a backdoored Connectwise agent.

In the video, Pyle enters the malicious URL into a web browser on a target machine. He explicitly states that all typical antivirus and security controls are active on this system. Upon hitting enter, the browser makes a request to Pyle's controlled server, which returns the custom "HTTP 666" status code containing the embedded malicious content. The demonstration visually highlights the "666" return code, confirming the successful injection.

Crucially, the hidden iframe within the injected content triggers the automatic download of the malicious Connectwise agent. The agent, despite being backdoored, is signed with a legitimate Connectwise code signing certificate (due to the "unregulated space" vulnerability), allowing it to bypass AV and EDR checks. Pyle shows the agent downloading and then executing on the victim's machine. The agent then calls back to Pyle's rogue Connectwise instance, which he had anonymously set up in their cloud infrastructure.

The demo concludes with Pyle gaining system-level access to the victim's machine. He emphasizes that this provides a persistent shell and a "trampoline" into the victim's network, mirroring tactics used by advanced persistent threat (APT) groups. The entire process requires minimal user interaction, demonstrating the severity of chaining these seemingly disparate vulnerabilities. Pyle also mentions a psychological trick of altering the Port Test page's text to say "Please wait while the port connect client is downloaded to your computer," making the automatic installation appear legitimate to a user who might observe it.

Defensive Implications

▶ Watch: Call to action: Developers, understand networks, be responsible (51:00)

The findings presented by Ken Pyle highlight critical areas where organizations and vendors must strengthen their defensive postures. The core message is a call for a holistic understanding of how applications interact with the network, moving beyond isolated layer 7 (application) security to encompass layer 2/3 (network) considerations.

  1. Enhanced Network Perimeter Security and Monitoring:
  • Strict SSL Inspection: Organizations must re-evaluate SSL inspection rules. Instead of blindly whitelisting *.screenconnect.com, implement granular whitelisting for specific, known FQDNs and constantly monitor for anomalous subdomains.
  • Egress Filtering: Implement robust egress firewall rules that prevent any internal host from making arbitrary outbound connections, even to "trusted" cloud services like Connectwise. All outbound traffic should be strictly controlled and monitored.
  • DNS Monitoring: Actively monitor internal and external DNS requests for suspicious patterns, especially those resolving to loopback addresses (127.0.0.1) or unusual external IPs, as these can indicate SSRF or DNS beaconing attempts.
  • Traffic Baselines: Establish baselines for normal network traffic to Connectwise instances and immediately investigate any deviations in volume, destination, or protocol, as these could signal C2 or DDOS activity.
  1. Application Security Best Practices:
  • Comprehensive Input Sanitization: Developers must implement rigorous input sanitization on all data inputs, both client-side and server-side, for all layers of the OSI model. This includes often-overlooked fields like the text portion of HTTP status codes, which Pyle demonstrated could be exploited for XSS and HTTP status code injection.
  • Secure File Downloads: All executable downloads must occur over HTTPS with strong integrity checks. Any modification to a signed executable should invalidate its signature.
  • Framing Mitigations: Implement robust framing mitigations (e.g., X-Frame-Options, Content Security Policy) to prevent hidden iframes from silently downloading and installing software.
  • Authentication and Authorization: Diagnostic tools, especially those capable of making outbound network requests, should never be unauthenticated and publicly accessible. Strong authentication and granular authorization are paramount.
  • Secure Code Signing Practices: Vendors must ensure that their code signing certificates are applied securely, without "unregulated spaces" that allow for arbitrary code injection while maintaining signature validity. This requires careful build pipeline security and regular audits.
  1. Operational Security and Vendor Management:
  • Proactive FQDN Management: Organizations should actively monitor and manage their domain registrations, ensuring that old or retired FQDNs are not allowed to expire and be re-registered by attackers.
  • Regular Security Audits: Conduct independent security audits and penetration tests of critical RMM and SCM software, focusing on how different components interact and how they are deployed in real-world environments.
  • Vendor Accountability: Hold vendors accountable for thorough vulnerability analysis and clear, timely disclosures. Organizations should not solely rely on vendor assurances but perform their own due diligence.
  • Developer Education: Invest in training for application developers on network fundamentals, the OSI model, and the broader implications of their application's network interactions. This directly addresses Pyle's central thesis.
  • Metadata Stripping: Ensure that production builds of software are stripped of unnecessary metadata, such as debugging symbols and internal file paths, to prevent information leakage that aids attackers in mapping internal networks.

By addressing these defensive implications, organizations can significantly reduce their exposure to sophisticated "living off the land" attacks and build more resilient security architectures against threats targeting critical supply chain management software.

Key Takeaways

  • Holistic Security is Paramount: A fundamental lack of understanding of the OSI model and network interactions by application developers creates critical vulnerabilities that can be chained for devastating effects. Application security cannot exist in a vacuum, isolated from network security.
  • "Living Off The Land" is a Major Threat: Attackers are adept at abusing legitimate, built-in functionalities and common misconfigurations in widely deployed software (like RMM tools) to bypass controls, achieve persistence, and evade detection.
  • Seemingly Benign Tools Can Be Weaponized: Diagnostic features, such as the Port Test Tool, if unauthenticated and poorly designed, can be transformed into powerful SSRF proxies, port scanners, and content enumerators, enabling internal network reconnaissance and firewall bypass.
  • Unconventional Data Channels are Exploitable: Novel techniques like HTTP status code injection demonstrate that attackers will find and exploit any unsanitized data path, even obscure ones, to deliver payloads, exfiltrate data, and bypass traditional security controls.
  • Supply Chain Software is a High-Value Target: Due to their widespread deployment and deep system access, RMM tools like Connectwise are critical infrastructure for attackers. Their security posture directly impacts thousands of organizations downstream.
  • Responsible Disclosure and Vendor Accountability Need Improvement: The talk highlights challenges in the vulnerability disclosure process, emphasizing the importance of independent CVE assignment (via MITRE) and the need for vendors to take vulnerability reports seriously, fostering a more collaborative security ecosystem.

About the Speaker(s)

Ken Pyle is a highly experienced and prolific exploit developer and zero-day hunter. He is a partner and exploit developer at Cyber, where he focuses on offensive security work, including exploit development and breach response. Pyle is also a graduate professor of cybersecurity at Chestnut Hill College, teaching subjects such as applied cryptography, advanced exploit development, and cyber warfare.

Known for his "very red side of purple" perspective, Pyle has a track record of discovering and exploiting critical infrastructure vulnerabilities. He is the individual responsible for the widely publicized hack of the Emergency Alert System (EAS) in 2022 and the discovery of the Ruckus andoru botnet earlier in 2023. His background as a former MSP engineer and security and network engineer provides him with a unique understanding of the operational realities and common pitfalls in IT environments, which he leverages in his research. Pyle is a strong advocate for fundamental network understanding and transparent vulnerability disclosure within the cybersecurity community.

Reviews

Dr. Zero (Offensive Security Researcher) — MUST SEE

Pyle absolutely dismantled Connectwise here. He took a vendor that tried to sweep his findings under the rug and used their own unauthenticated diagnostic tools to build a proxy network and botnet. This is exactly what offensive research is supposed to look like—clever bug chaining, zero vendor bullshit, and a live demo that makes EDR look stupid.

Heather Calloway (CISO) — STRONG ACCEPT

This is required viewing for your infrastructure and vendor risk teams. Pyle demonstrates how implicit trust in RMM tools—coupled with lazy firewall whitelisting—creates a catastrophic attack surface. When a vendor downplays a CVSS 9.8 chain that grants no-click persistence under a valid code signature, your enterprise risk calculation has to change.

→ Top-rated talks at AppSec Village @ DEF CON 31

All talks from AppSec Village @ DEF CON 31