<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs" -->

---
title: The Accidental C2: Exploring Dev Tunnels for Remote Access
description: A deep technical analysis of VS Code Dev Tunnels from a red team perspective, revealing that the feature is far more than simple port forwarding. The post...
canonical: https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The Accidental C2: Exploring Dev Tunnels for Remote Access | daily.dev
og:description: A deep technical analysis of VS Code Dev Tunnels from a red team perspective, revealing that the feature is far more than simple port forwarding. The post...
og:url: https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs
og:image: https://api.daily.dev/og/posts/6tLG72mxS.png
og:image:alt: The Accidental C2: Exploring Dev Tunnels for Remote Access
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The Accidental C2: Exploring Dev Tunnels for Remote Access

**[SpecterOps](https://daily.dev/sources/specterops)** · 19 min read · 0 upvotes · 0 comments

## Summary

A deep technical analysis of VS Code Dev Tunnels from a red team perspective, revealing that the feature is far more than simple port forwarding. The post dissects four protocol layers: a REST management API, a WebSocket tunnel, a non-standard SSH connection using the russh crate, and a MsgPack RPC layer exposing commands like spawn, fs_read, fs_write, and sys_kill. The author introduces Ouroboros, a Rust tool that wraps these RPC commands for offensive use. The post also covers authentication attack paths including Device Code Phishing against GitHub OAuth, FOCI token pivoting in Entra ID, and BroCI (Nested App Authentication) abuse to gain access to an organization's dev tunnels. A candid reflection on LLM-assisted research (using Claude Code and a custom rig called Bishop) rounds out the post.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://specterops.io/blog/2026/05/06/dev-tunnels-the-accidental-c2>

## Questions this post answers

### What protocol layers does VS Code Dev Tunnels use under the hood?

VS Code Dev Tunnels uses four stacked layers: a REST management API against global.rel.tunnels.api.visualstudio.com to enumerate tunnels and obtain JWT connect tokens, a WebSocket tunnel to the relay server, a non-standard SSH connection over that WebSocket using the russh crate with None authentication and HMAC_SHA256_ETM MAC, and finally a MsgPack RPC layer that exposes commands including spawn, fs_read, fs_write, fs_connect, and sys_kill.

_Developers and red teamers tracking VS Code attack surface changes find new research like this on daily.dev._

### What RPC commands are available over VS Code Dev Tunnels and what can they do?

The MsgPack RPC layer in VS Code Dev Tunnels exposes spawn_cli (run a command via the VS Code server binary), spawn (execute a command directly), fs_read, fs_write, fs_connect (tunnel a named pipe or Unix socket), fs_stat, fs_rm, fs_mkdirp, fs_readdir, fs_rename, and sys_kill. These give a connected client full remote code execution and file system access on the tunnel host.

_Red teamers building offensive tooling around VS Code can follow this research thread on daily.dev._

### Can a stolen Entra ID token from one Microsoft app be used to access VS Code Dev Tunnels?

Yes. The Dev Tunnels Service resource (46da2f7e-b5ef-422a-88d4-2a7f9de6a0b2) is accessible from multiple Entra clients. If any FOCI member token is compromised, its refresh token can be exchanged for a Dev Tunnels access token. At time of research there were 49 FOCI clients. BroCI (Nested App Authentication) via AzurePortal Console App also provides a path if an Azure Portal session is available.

_Staying current on Entra ID token abuse paths matters for any team defending Microsoft 365 environments — daily.dev surfaces this research as it drops._

## Similar posts on daily.dev

- [I turned my desktop into a remote coding server using VS Code's hidden tunnel feature](https://daily.dev/posts/i-turned-my-desktop-into-a-remote-coding-server-using-vs-code-s-hidden-tunnel-feature-z4cxlhy7b) · XDA Developers · 3 upvotes · 0 comments
- [Stop Coding Through Remote Desktop. Use VS Code Remote Tunnels Instead](https://daily.dev/posts/stop-coding-through-remote-desktop-use-vs-code-remote-tunnels-instead-5gc5vlwh0) · We Are .NET · 1 upvotes · 0 comments
- [VS Code has a tunnel feature buried in the account menu, and it turned my desktop into a machine I can code on from any browser](https://daily.dev/posts/vs-code-has-a-tunnel-feature-buried-in-the-account-menu-and-it-turned-my-desktop-into-a-machine-i-c-b86q4cas4) · XDA Developers · 0 upvotes · 0 comments
- [Coding agent security: Claude Code, tunnels and LaunchAgents — Elastic Security Labs](https://daily.dev/posts/coding-agent-security-claude-code-tunnels-and-launchagents-elastic-security-labs-x1zklhxxc) · Elastic Security Labs · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#rust](https://daily.dev/tags/rust), [#vscode](https://daily.dev/tags/vscode)

[View this post on daily.dev](https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The Accidental C2: Exploring Dev Tunnels for Remote Access","url":"https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs"},"datePublished":"2026-08-23T12:16:32.221Z","dateModified":"2026-08-23T12:17:40.173Z","description":"A deep technical analysis of VS Code Dev Tunnels from a red team perspective, revealing that the feature is far more than simple port forwarding. The post...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d41f6949d6c90afda0479a0016e6804c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/d41f6949d6c90afda0479a0016e6804c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"SpecterOps","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SpecterOps","logo":"https://media.daily.dev/image/upload/s--lR36Z4gn--/f_auto,q_auto/v1787487384/logos/specterops?_a=BAMAMicg0","url":"https://daily.dev/sources/specterops"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,rust,vscode","timeRequired":"PT19M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SpecterOps","item":"https://daily.dev/sources/specterops"},{"@type":"ListItem","position":3,"name":"The Accidental C2: Exploring Dev Tunnels for Remote Access"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/the-accidental-c2-exploring-dev-tunnels-for-remote-access-6tlg72mxs#faq","mainEntity":[{"@type":"Question","name":"What protocol layers does VS Code Dev Tunnels use under the hood?","acceptedAnswer":{"@type":"Answer","text":"VS Code Dev Tunnels uses four stacked layers: a REST management API against global.rel.tunnels.api.visualstudio.com to enumerate tunnels and obtain JWT connect tokens, a WebSocket tunnel to the relay server, a non-standard SSH connection over that WebSocket using the russh crate with None authentication and HMAC_SHA256_ETM MAC, and finally a MsgPack RPC layer that exposes commands including spawn, fs_read, fs_write, fs_connect, and sys_kill. Developers and red teamers tracking VS Code attack surface changes find new research like this on daily.dev."}},{"@type":"Question","name":"What RPC commands are available over VS Code Dev Tunnels and what can they do?","acceptedAnswer":{"@type":"Answer","text":"The MsgPack RPC layer in VS Code Dev Tunnels exposes spawn_cli (run a command via the VS Code server binary), spawn (execute a command directly), fs_read, fs_write, fs_connect (tunnel a named pipe or Unix socket), fs_stat, fs_rm, fs_mkdirp, fs_readdir, fs_rename, and sys_kill. These give a connected client full remote code execution and file system access on the tunnel host. Red teamers building offensive tooling around VS Code can follow this research thread on daily.dev."}},{"@type":"Question","name":"Can a stolen Entra ID token from one Microsoft app be used to access VS Code Dev Tunnels?","acceptedAnswer":{"@type":"Answer","text":"Yes. The Dev Tunnels Service resource (46da2f7e-b5ef-422a-88d4-2a7f9de6a0b2) is accessible from multiple Entra clients. If any FOCI member token is compromised, its refresh token can be exchanged for a Dev Tunnels access token. At time of research there were 49 FOCI clients. BroCI (Nested App Authentication) via AzurePortal Console App also provides a path if an Azure Portal session is available. Staying current on Entra ID token abuse paths matters for any team defending Microsoft 365 environments — daily.dev surfaces this research as it drops."}}]}
```

