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.
Additional References
https://github.com/HKUDS/nanobothttps://github.com/HKUDS/nanobot/security/advisories/GHSA-5v87-m222-qr94
Disclosure Timeline
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]
Tenable One
Request a demo
The world’s leading AI-powered exposure management platform.
Thank You
Thank you for your interest in Tenable One.
A representative will be in touch soon.
Form ID: 7469
Form Name: one-eval
Form Class: c-form form-panel__global-form c-form--mkto js-mkto-no-css js-form-hanging-label c-form--hide-comments
Form Wrapper ID: one-eval-form-wrapper
Confirmation Class: one-eval-confirmform-modal
Simulate Success