Attempt to Establish Microsoft Dev Tunnel

Detects the Microsoft devtunnel command line client started with the host or connect subcommand, which exposes a local port through, or connects to, a tunnel relayed by Microsoft Dev Tunnels infrastructure. The client is signed by Microsoft and its traffic goes to trusted Microsoft domains, which makes it a Living-Off-The-Land vector for command and control and for exposing internal services.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/11/23"
  3integration = ["endpoint"]
  4maturity = "production"
  5updated_date = "2026/11/23"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Detects the Microsoft devtunnel command line client started with the host or connect subcommand, which exposes a
 11local port through, or connects to, a tunnel relayed by Microsoft Dev Tunnels infrastructure. The client is signed by
 12Microsoft and its traffic goes to trusted Microsoft domains, which makes it a Living-Off-The-Land vector for command
 13and control and for exposing internal services.
 14"""
 15false_positives = [
 16    """
 17    Developers use Microsoft Dev Tunnels to share a local web application or API during development and testing.
 18    Verify the user, the parent process and the exposed port before adding exceptions.
 19    """,
 20]
 21from = "now-9m"
 22index = ["logs-endpoint.events.process-*"]
 23language = "eql"
 24license = "Elastic License v2"
 25name = "Attempt to Establish Microsoft Dev Tunnel"
 26note = """## Triage and analysis
 27
 28### Investigating Attempt to Establish Microsoft Dev Tunnel
 29
 30Microsoft Dev Tunnels lets a user expose a local port to the internet through a relay hosted by Microsoft. The `devtunnel host` subcommand publishes one or more local ports, and `devtunnel connect` attaches to an existing tunnel and forwards its ports to the local host. Because the client is signed by Microsoft and only talks to `*.devtunnels.ms` and `global.rel.tunnels.api.visualstudio.com`, adversaries use it to reach a compromised host from the outside, to bridge into internal networks, or to carry command and control traffic that blends with legitimate developer activity.
 31
 32### Possible investigation steps
 33
 34- Review `process.command_line` for the exposed ports (`-p`/`--port-numbers`), whether anonymous access was allowed (`--allow-anonymous`), and any tunnel ID passed to `connect`.
 35- Identify how the binary got on the host. Check `process.executable` against standard installation paths and look for recent file creation events for `devtunnel` or `devtunnel.exe` in user writable or temporary directories.
 36- Examine the parent process. A shell, script interpreter, Office application or remote management tool as parent is more suspicious than an IDE or terminal used interactively by a developer.
 37- Search for a preceding `devtunnel user login` or `devtunnel create` execution and for authentication with a GitHub or Microsoft account that is not associated with the user.
 38- Review network events from the process and from the services listening on the exposed ports to see what was accessed through the tunnel.
 39
 40### False positive analysis
 41
 42- Software developers commonly use Dev Tunnels from Visual Studio, Visual Studio Code or the command line to test webhooks and share local services. Confirm the user's role and whether the tunnel was expected.
 43- If Dev Tunnels is approved in the environment, add exceptions scoped to the expected users or hosts together with `process.parent.executable`.
 44
 45### Response and remediation
 46
 47- If the activity is not authorized, terminate the devtunnel process and remove the binary.
 48- Block `*.devtunnels.ms` and `global.rel.tunnels.api.visualstudio.com` at the proxy or firewall where Dev Tunnels is not used.
 49- Investigate the services exposed through the tunnel for unauthorized access and review the host for persistence that would restart the tunnel.
 50- Rotate credentials of the account used to authenticate the tunnel if it is suspected to be compromised.
 51"""
 52references = [
 53    "https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/cli-commands",
 54]
 55risk_score = 47
 56rule_id = "66e69fb6-878b-4659-8d17-723abbadad70"
 57setup = """## Setup
 58
 59This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
 60
 61Setup instructions: https://ela.st/install-elastic-defend
 62"""
 63severity = "medium"
 64tags = [
 65    "Domain: Endpoint",
 66    "OS: Windows",
 67    "OS: Linux",
 68    "OS: macOS",
 69    "Use Case: Threat Detection",
 70    "Tactic: Command and Control",
 71    "Data Source: Elastic Defend",
 72    "Resources: Investigation Guide",
 73    "Rule Type: Event Correlation (EQL)",
 74    "Platform: Windows",
 75    "Platform: Linux",
 76    "Platform: macOS",
 77]
 78timestamp_override = "event.ingested"
 79type = "eql"
 80
 81query = '''
 82process where host.os.type in ("windows", "linux", "macos") and event.type == "start" and
 83  event.action in ("exec", "start") and
 84  (process.name : ("devtunnel", "devtunnel.exe") or ?process.pe.original_file_name : "devtunnel.exe") and 
 85  process.args : ("host", "connect") and
 86  not process.args : ("create", "delete", "list", "show", "update", "token", "access", "port", "user")
 87'''
 88
 89
 90[[rule.threat]]
 91framework = "MITRE ATT&CK"
 92[[rule.threat.technique]]
 93id = "T1102"
 94name = "Web Service"
 95reference = "https://attack.mitre.org/techniques/T1102/"
 96[[rule.threat.technique.subtechnique]]
 97id = "T1102.002"
 98name = "Bidirectional Communication"
 99reference = "https://attack.mitre.org/techniques/T1102/002/"
100
101
102[[rule.threat.technique]]
103id = "T1572"
104name = "Protocol Tunneling"
105reference = "https://attack.mitre.org/techniques/T1572/"
106
107
108[rule.threat.tactic]
109id = "TA0011"
110name = "Command and Control"
111reference = "https://attack.mitre.org/tactics/TA0011/"

Triage and analysis

Investigating Attempt to Establish Microsoft Dev Tunnel

Microsoft Dev Tunnels lets a user expose a local port to the internet through a relay hosted by Microsoft. The devtunnel host subcommand publishes one or more local ports, and devtunnel connect attaches to an existing tunnel and forwards its ports to the local host. Because the client is signed by Microsoft and only talks to *.devtunnels.ms and global.rel.tunnels.api.visualstudio.com, adversaries use it to reach a compromised host from the outside, to bridge into internal networks, or to carry command and control traffic that blends with legitimate developer activity.

Possible investigation steps

  • Review process.command_line for the exposed ports (-p/--port-numbers), whether anonymous access was allowed (--allow-anonymous), and any tunnel ID passed to connect.
  • Identify how the binary got on the host. Check process.executable against standard installation paths and look for recent file creation events for devtunnel or devtunnel.exe in user writable or temporary directories.
  • Examine the parent process. A shell, script interpreter, Office application or remote management tool as parent is more suspicious than an IDE or terminal used interactively by a developer.
  • Search for a preceding devtunnel user login or devtunnel create execution and for authentication with a GitHub or Microsoft account that is not associated with the user.
  • Review network events from the process and from the services listening on the exposed ports to see what was accessed through the tunnel.

False positive analysis

  • Software developers commonly use Dev Tunnels from Visual Studio, Visual Studio Code or the command line to test webhooks and share local services. Confirm the user's role and whether the tunnel was expected.
  • If Dev Tunnels is approved in the environment, add exceptions scoped to the expected users or hosts together with process.parent.executable.

Response and remediation

  • If the activity is not authorized, terminate the devtunnel process and remove the binary.
  • Block *.devtunnels.ms and global.rel.tunnels.api.visualstudio.com at the proxy or firewall where Dev Tunnels is not used.
  • Investigate the services exposed through the tunnel for unauthorized access and review the host for persistence that would restart the tunnel.
  • Rotate credentials of the account used to authenticate the tunnel if it is suspected to be compromised.

References

Related rules

to-top