|
9 | 9 |
|
10 | 10 | We only support the latest published version. Please upgrade before reporting issues. |
11 | 11 |
|
| 12 | +## Threat Model |
| 13 | + |
| 14 | +TermBeam exposes a real shell over the network. The risk depends entirely on **how** you run it. Understanding the operating modes below helps you make informed decisions. |
| 15 | + |
| 16 | +### Operating Modes |
| 17 | + |
| 18 | +TermBeam has three access layers that combine to determine your risk profile: |
| 19 | + |
| 20 | +| Mode | Command | Who Can Connect | Auth | Risk | |
| 21 | +| ----------------------------- | ------------------------------------------ | ------------------------------------- | --------------------------------- | --------- | |
| 22 | +| **Default (private tunnel)** | `termbeam` | Only you (Microsoft login + password) | Auto-password + tunnel owner auth | ✅ Low | |
| 23 | +| **Public tunnel** | `termbeam --public` | Anyone with the URL + password | Auto-password | ⚠️ Medium | |
| 24 | +| **LAN-only (localhost)** | `termbeam --no-tunnel` | Local machine only | Auto-password | ✅ Low | |
| 25 | +| **LAN-only (all interfaces)** | `termbeam --no-tunnel --lan` | Any device on your network | Auto-password | ⚠️ Medium | |
| 26 | +| **Localhost, no password** | `termbeam --no-tunnel --no-password` | Local processes only | None | ⚠️ Medium | |
| 27 | +| **LAN, no password** | `termbeam --no-tunnel --no-password --lan` | Anyone on your network | None | 🔴 High | |
| 28 | + |
| 29 | +> **Note:** `--public --no-password` is rejected by the CLI — TermBeam refuses to start with a public tunnel and no password. |
| 30 | +
|
| 31 | +### Private Tunnel (Default) |
| 32 | + |
| 33 | +The default mode creates an ephemeral [Azure DevTunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/) that requires **two layers of authentication**: |
| 34 | + |
| 35 | +1. **Microsoft account login** — only the tunnel owner can access the URL |
| 36 | +2. **TermBeam password** — auto-generated on each run |
| 37 | + |
| 38 | +This is the safest way to access your terminal remotely. The tunnel URL is HTTPS, the connection is encrypted end-to-end, and the URL is unguessable. |
| 39 | + |
| 40 | +### Public Tunnel |
| 41 | + |
| 42 | +With `--public`, the tunnel URL is accessible to anyone who has it — no Microsoft login required. Password authentication is still enforced and required. This mode is useful for sharing temporary access, but the terminal is effectively internet-accessible and protected only by the password and rate limiting (5 attempts/min/IP). |
| 43 | + |
| 44 | +### LAN Exposure |
| 45 | + |
| 46 | +With `--lan` or `--host 0.0.0.0`, TermBeam binds to all network interfaces. Any device on your local network can reach the server. On trusted home networks this may be acceptable; on shared or public networks (coffee shops, coworking spaces, hotel Wi-Fi) this is risky. |
| 47 | + |
| 48 | +## Safe Defaults |
| 49 | + |
| 50 | +Out of the box, TermBeam is configured conservatively: |
| 51 | + |
| 52 | +- ✅ **Password auto-generated** — a strong random password is created on every run |
| 53 | +- ✅ **Localhost bind** — server listens on `127.0.0.1` only, not reachable from the network |
| 54 | +- ✅ **Private tunnel** — tunnel requires Microsoft account login (owner-only access) |
| 55 | +- ✅ **Ephemeral tunnel** — tunnel URL is deleted when TermBeam exits |
| 56 | +- ✅ **Security headers** — X-Frame-Options, CSP, no-cache, nosniff on all responses |
| 57 | +- ✅ **Rate-limited login** — 5 attempts per minute per IP |
| 58 | +- ✅ **httpOnly cookies** — tokens not accessible to JavaScript |
| 59 | +- ✅ **WebSocket origin validation** — cross-origin connections rejected |
| 60 | +- ✅ **Shell path validation** — only detected shells allowed, arbitrary paths rejected |
| 61 | + |
| 62 | +You do not need to change any defaults to use TermBeam safely. |
| 63 | + |
| 64 | +## Dangerous Modes |
| 65 | + |
| 66 | +The following flags increase your attack surface. Use them only when you understand the trade-offs. |
| 67 | + |
| 68 | +### `--public` — Public tunnel access |
| 69 | + |
| 70 | +Removes the Microsoft login requirement from the tunnel. Anyone with the URL can attempt to log in. Mitigated by password auth and rate limiting, but the terminal is internet-facing. |
| 71 | + |
| 72 | +**When acceptable:** Sharing temporary access with someone who doesn't have a Microsoft account. |
| 73 | +**Mitigation:** Use a strong password. Close TermBeam when done. |
| 74 | + |
| 75 | +### `--no-password` — Disable authentication |
| 76 | + |
| 77 | +Removes password protection entirely. Any client that can reach the server has full terminal access. |
| 78 | + |
| 79 | +**When acceptable:** Localhost-only use on a single-user machine where no untrusted local processes are running. |
| 80 | +**Never combine with:** `--public` (CLI rejects this) or `--lan` on shared networks. |
| 81 | + |
| 82 | +### `--lan` / `--host 0.0.0.0` — Bind to all interfaces |
| 83 | + |
| 84 | +Makes the server reachable from any device on your local network. Combined with `--no-password`, this gives any network device unrestricted terminal access. |
| 85 | + |
| 86 | +**When acceptable:** Trusted home network with password enabled. |
| 87 | +**Not recommended:** Public Wi-Fi, shared office networks, or any network with untrusted devices. |
| 88 | + |
| 89 | +### Combining dangerous flags |
| 90 | + |
| 91 | +| Combination | Result | Risk | |
| 92 | +| ------------------------ | -------------------------------------- | --------- | |
| 93 | +| `--public` | Internet-accessible, password required | ⚠️ Medium | |
| 94 | +| `--no-password` | No auth, localhost only | ⚠️ Medium | |
| 95 | +| `--lan` | LAN-accessible, password required | ⚠️ Medium | |
| 96 | +| `--lan --no-password` | LAN-accessible, no auth | 🔴 High | |
| 97 | +| `--public --no-password` | **Blocked by CLI** | — | |
| 98 | + |
| 99 | +## Quick Safety Checklist |
| 100 | + |
| 101 | +Before running TermBeam, verify: |
| 102 | + |
| 103 | +- [ ] **Password is enabled** — don't use `--no-password` unless localhost-only on a trusted machine |
| 104 | +- [ ] **Tunnel is private** — don't use `--public` unless you specifically need anonymous tunnel access |
| 105 | +- [ ] **Bind is localhost** — don't use `--lan` or `--host 0.0.0.0` unless you need LAN access |
| 106 | +- [ ] **Close when done** — TermBeam is not a daemon; don't leave it running unattended |
| 107 | +- [ ] **Check the network** — on shared/public Wi-Fi, stick to defaults (private tunnel + localhost) |
| 108 | +- [ ] **Review the password** — if using `--password`, ensure it's strong (12+ chars, mixed case/symbols) |
| 109 | + |
| 110 | +## Work vs Personal Machine |
| 111 | + |
| 112 | +### Personal machine (home network) |
| 113 | + |
| 114 | +Default settings are appropriate. If you need LAN access (e.g., phone on the same Wi-Fi), `--lan` with the auto-generated password is reasonable. |
| 115 | + |
| 116 | +### Work machine (corporate network) |
| 117 | + |
| 118 | +- **Use defaults** (private tunnel + auto-password) — this routes through your Microsoft account |
| 119 | +- **Avoid `--public`** — a public tunnel on a corporate device exposes the terminal to the internet |
| 120 | +- **Avoid `--lan`** on corporate networks — other devices on the network could discover the server |
| 121 | +- **Don't use for production** — TermBeam is a development tool, not a production remote access solution |
| 122 | + |
| 123 | +### Not recommended |
| 124 | + |
| 125 | +- Running TermBeam with `--public` on machines with access to customer data or secrets |
| 126 | +- Using `--no-password --lan` on any network you don't fully control |
| 127 | +- Leaving TermBeam running unattended for extended periods |
| 128 | +- Using TermBeam as a replacement for SSH, VPN, or proper remote access infrastructure |
| 129 | + |
12 | 130 | ## Reporting a Vulnerability |
13 | 131 |
|
14 | 132 | **Please do NOT open a public GitHub issue for security vulnerabilities.** |
@@ -44,7 +162,7 @@ Instead, report vulnerabilities privately: |
44 | 162 | When running TermBeam: |
45 | 163 |
|
46 | 164 | - Always use a **strong password** (`--generate-password` or `--password`) |
47 | | -- Bind TermBeam to **localhost** (`--host 127.0.0.1`) unless you need LAN access (default is `0.0.0.0`) |
| 165 | +- Bind TermBeam to **localhost** (`--host 127.0.0.1`) unless you need LAN access (default is `127.0.0.1`) |
48 | 166 | - Use a **reverse proxy with TLS** (nginx, Caddy) for production deployments |
49 | 167 | - Keep dependencies **up to date** (`npm update`) |
50 | 168 | - Review the [Security documentation](https://dorlugasigal.github.io/TermBeam/security/) for detailed guidance |
0 commit comments