Potential Protocol Tunneling via Cloudflared
Description
Identifies the use of Cloudflare Tunnel (cloudflared) to expose a local service or create an outbound tunnel. Adversaries may abuse quick tunnels (e.g. tunnel --url http://127.0.0.1:80) or named tunnels to proxy C2 traffic or exfiltrate data through Cloudflare's edge while evading direct connection blocking.
Query · eql
process where host.os.type == "windows" and event.type == "start" and (process.name : "cloudflared.exe" or ?process.pe.original_file_name == "cloudflared.exe" or ?process.code_signature.subject_name : "Cloudflare, Inc.") and process.args : "tunnel"
Implementation guide
This rule is designed for data generated by Elastic Defend, which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
Analyst notes
Investigating Potential Protocol Tunneling via Cloudflared
Cloudflare Tunnel (cloudflared) is a legitimate tool for exposing local services through Cloudflare's edge. Adversaries abuse it to create quick or named tunnels for C2, data exfiltration, or ingress tool transfer while evading direct connection blocking.
Possible investigation steps
- Confirm the process command line for
tunnel,--url, ortunnel runto validate cloudflared tunnel usage. - Identify the parent process and process executable path; cloudflared run from temp or user writable locations is more suspicious than from Program Files.
- For quick tunnel (
--url http://...), identify the local URL and whether it could be a C2 callback or proxy. - Correlate with network data for outbound connections to Cloudflare IPs or trycloudflare.com-style hostnames around the same time.
- Review the user and session that started the tunnel; look for other suspicious logon or execution from the same context.
False positive analysis
- Legitimate use of Cloudflare Tunnel for development or internal services may trigger this rule; consider allowlisting by path or user for approved use cases.
Response and remediation
- If unauthorized tunnel use is confirmed: isolate the host, terminate the cloudflared process, and block cloudflared or Cloudflare tunnel domains at DNS/firewall where policy permits.
- Rotate credentials for any accounts that may have been exposed over the tunnel.