English · Русский
NerveForge deliberately exposes a local machine through a public tunnel. The bearer token is a
credential, not a security boundary. Do not publish it in issues, screenshots, chat logs or
example configs. The local panel receives the token only from the loopback address
127.0.0.1:8767/bootstrap; the browser keeps it in localStorage until you press "Forget".
- In
automode the Cloudflare Quick Tunnel (cloudflared tunnel --url …) is chosen whencloudflaredis installed; otherwise Tailscale Funnel (tailscale funnel --bg --https=443 <port>); otherwise local only. Both tunnels are public: anyone who knows the address reaches the panel. The only protection is the bearer token plus an explicitly armed full access. --tunnel tailscale|cloudflared|noneforces a mode;--tunnel nonestays on127.0.0.1.--keep-funnelkeeps the Funnel after exit; by default the program runstailscale funnel reset.- Make sure Tailscale Funnel is allowed in the tailnet ACL (
autogroup:memberby default) and that MagicDNS and HTTPS are enabled.
POST /api/full-access/config (bearer plus the exact passphrase yesiknow) enables an arbitrary
shell remotely — a deliberate change from 6.x, where arming was local only. The passphrase
guards against a stray click; it is not a second factor. Anyone who knows both the token and the
address can send the same phrase.
Once armed:
- commands run without a sandbox and without the approval queue, with an arbitrary
cwd; - on Linux an explicit
sudo: trueis available throughsudo -n; on Windows no elevation is requested, but an elevated process passes its administrative rights to every child; - a maximum timer (1–1440 minutes, default 24 hours), a 10-minute idle timeout and quick-off with process-tree termination apply (no run rate limit — deliberate, see README);
- the audit log records time, job id, shell and the SHA-256 of the command, never the text or output.
POST /api/public/scripts and /api/public/assets stay token-free. Anyone who knows the address
can create a new text file with an allowlisted extension (scripts, configs, units; 64 KiB, 5/min,
30/hour, no overwrite) in the workspace root. Any uploaded script can be executed by you or by a
build — never run one without reading it. The allowlist can be extended with
NERVEFORGE_PUBLIC_UPLOAD_EXTRA. Rate limits are not authentication. If you do not need the drop
box, remove the routes in a separate revision.
Three more token-free routes accept bodies up to 5 GiB and stream them to disk:
| Route | Accepts | Lands in |
|---|---|---|
POST /api/public/media |
audio, video, images | inbox/media |
POST /api/public/docs |
pdf, office, epub | inbox/docs |
POST /api/public/archive |
zip, 7z, tar, gz, xz | inbox/archive |
What this changes about the risk model, stated plainly:
- Size no longer limits abuse. A single request can now fill 5 GiB of disk. The hourly budget (20 uploads) caps a sustained flood at roughly 100 GiB, which is a disk-exhaustion vector on a small machine. If the machine is short on space, keep uploads on loopback or remove the routes.
- Content is not filtered. Only the extension is checked. An archive is not unpacked during upload, so nothing inside it is scanned; whatever you later extract is your call.
- Files land only in fixed subdirectories. The name is validated against traversal, control
characters, Windows device names and a length cap before a byte is read, and the file is created
with
O_EXCLso an upload can never overwrite an existing file. - Rejected requests cost no bandwidth.
Content-Lengthis compared to the class ceiling before the body is consumed; an oversized or badly named upload is refused immediately. - A partial transfer leaves nothing behind: interruption removes the half-written file.
Rate limits (3/min, 20/hour for large uploads) are still not authentication. Treat every uploaded file as untrusted input.
- Every file operation goes through
workspace_manager.safe_path, which rejects.., absolute paths,~-paths, POSIX and Windows absolute forms (C:\…,\\server\share) on every platform, and symlink/reparse points inside the workspace. config_manager.allowed_config_pathaccepts only absolute paths inside allowed directories and rejects.., NUL bytes and symlinked files where a unit file is expected.- Every response (panel, API, public routes, loopback admin) carries
Content-Security-Policy,X-Frame-Options: DENY,Referrer-Policy: no-referrer,Permissions-Policy,Cross-Origin-Opener-PolicyandX-Content-Type-Options: nosniff. The CSP forbids inline scripts and inline styles; the panel contains noonclickand no<script>withoutsrc, and a test enforces that. - Importing the module no longer creates files or tokens: the token is issued by an explicit
bootstrap()at server start, and a server without an initialised token answers401(fail closed).
Three new ways for the process to reach outside itself, and what each one refuses to do.
Downloads (POST /api/tools/install). The installer writes one file into <data dir>/tools/ with mode 0700, verified by the SHA-256 that came in the same GitHub API response
that named the release. No PATH edit, no system install, no root, no automatic download at
startup. An asset without a digest is refused, because a download that cannot be verified is a
download that should not happen. This is the same rule as cloudflared.
Subprocesses (MCP over stdio). An HTTP preset connects to a server the operator already runs;
a stdio preset starts a child only when somebody presses connect, and it is killed with
terminate_process_tree on disconnect. Nothing is spawned at startup and nothing is respawned in
the background, so "the panel opened" never means "a process started".
Talking to other servers (MCP client). Every tools/call lands in
<data dir>/mcp-audit.jsonl (0600) with token/key/secret/password/authorization/cookie
arguments replaced by ***. Results are capped at 64 KiB. A tool whose name suggests a mutation
(rename, patch, set_, write, create, delete, remove, run, exec, …) is refused with
409 until the request carries allow_mutating, and the panel only sends that after a
confirmation dialog — the gate is in the service, not in the UI.
Two risks are worth naming rather than hiding:
- A connected MCP server is code running with your privileges. A Ghidra or IDA plugin that
exposes
run_scriptruns whatever you send it. Connect only to servers you installed, and read the tool list before calling anything. - The mutation gate is name-based. MCP has no required "this changes state" flag, so a tool
called
get_and_set_xis gated and one calledapplymay not be. When it matters, prefer a read-only server or a disposable copy of the database.
The server half. python3 -m nerveforge.toolkit --serve exposes this bridge over stdio. It is
read-only unless started with --allow-write, run_command additionally needs armed full access,
and both are annotated as mutating. The two flags are separate on purpose: an agent that can write
to your workspace should have been asked for it twice.
- Use a dedicated PC or VM, without valuable data and outside any corporate network.
- Do not run NerveForge as administrator unless you really must.
- Keep full access off when you are not using it; rotate the token on any suspicion (a restart creates a new one).
- Do not publish Funnel or Quick Tunnel URLs.
- Report vulnerabilities privately, without tokens or real addresses.
In 7.0.0 /api/local-bootstrap trusted client-supplied Host and Origin headers. Tailscale
Funnel forwards them verbatim, so a remote client could claim 127.0.0.1:8766 and receive the
bearer token. That route now always answers 403 on the public listener; the token is issued only
by the separate loopback listener 127.0.0.1:8767 which validates the local panel origin. Full
access is still armed remotely through /api/full-access/config with the passphrase.