cloudflare / cloudflare/cloudflared

Unsecured cloudflared service tunnel secret storage on Windows

Open
#666 1 comment 2 reactions 1 assignee Claimed by @abelinkinbio View on GitHub
Priority: Normal Type: Bug
Dominant language
Go
Stars
15.6k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

I really like the centralized configuration feature of Cloudflare Tunnel. The recommended way to run a tunnel as a service on Windows is to use `cloudflared service install `, where the token is a JSON document encoded in base64 that allows cloudflared to fetch the centralized configuration and run the tunnel. The token includes the tunnel's secret.

The problem with this command, on Windows at least, is that cloudflared saves the token in the executable path of the service. Therefore, the tunnel token can be read by any user regardless of privileges, which is not necessary since the service runs as the `Local System` user. A service's path is not an appropriate way to store a secret.

To test this, run the PS command `Get-WmiObject win32_service | ?{$_.Name -eq 'cloudflared'} | select PathName` as an unprivileged user and you’ll see the token. This is a big issue since the origin of the tunnel is likely to be trusted by users, who will then send their RDP/SSH/HTTP credentials to whatever service is routed by the tunnel. If tunnel credentials are stolen, an attacker can steal whatever data is sent to the origin.

This token should be stored in a file where only administrators or the `System` user can read.

Related Cloudflare Community post: https://community.cloudflare.com/t/insecure-cloudflared-credential-storage-on-windows/391387

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.