Nanobot - bwrap Sandbox Bypass

High

Synopsis

In nanobot >= 0.2.1 < 0.4.1, the `exec` tool accepts an agent-selected shell override but validates it only by file name and executable bit, then launches that file on the host ahead of the command bwrap is meant to contain.

The default `write_file` and sandboxed `exec` tools both operate inside the workspace. An authenticated WebSocket user can therefore have the agent stage an executable named `bash` there and select it as the interpreter. Nanobot runs it outside bwrap under the non-root `nanobot` service account, yielding unsandboxed access to every host resource available to that account.

`_resolve_shell` is meant to restrict the interpreter to `sh`, `bash`, or `zsh`, but for an absolute path it only checks `path.name` and the executable bit, then returns the path unchanged. By then `_prepare_command` has replaced the command with `wrap_command(...)`, so the sandbox covers only the `-c` argument, and `_spawn` runs the workspace file as the program itself. `ExecSessionManager._spawn` shares this code, so persistent sessions are affected too.

The bypass reproduces with `restrictToWorkspace=true` and `sandbox=bwrap`. The agent writes a workspace `bash` that copies an out-of-workspace canary then `exec`s `/bin/bash "$@"`, runs `chmod +x ./bash`, and calls a command with `shell` set to that path. A direct `cat` of the canary is rejected, but the override call returns 0 and the copied file appears outside the workspace, while the requested command still runs normally.

Exploitation depends on the model following these instructions, but once the arguments reach `ExecTool` the workspace file is always the process spawned outside the sandbox.

Solution

Update to Nanobot version 0.4.1 or later.

Disclosure Timeline

September 28, 2026 : Reported through Github
October 05, 2026 : Tenable asking for update
October 05, 2026 : The vendor has confirmed receipt and is working on a fix.
October 05, 2026: The vendor has shared the fix and is requesting verification.
October 06, 2026: Tenable has confirmed the fix.
October 12, 2026 : Tenable asking for update
October 19, 2026 : Tenable asking for update
November 03, 2026: Tenable asking for update
November 04, 2026: The vendor requests to verify additional fixes.
November 04, 2026: Tenable has confirmed the fix.
November 04, 2026: The Vendor will communicate the actual merge commits as well as the planned publication date, once the latter has been confirmed.
November 04, 2026: The fix has been merged into main and is awaiting a release.
November 06, 2026: The fix is released in version 0.4.1

All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.

Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.

For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.

If you have questions or corrections about this advisory, please email [email protected]