🔴 [CRITICAL] CB-002: Arbitrary File System Read/Write #11

Open
opened 2026-02-20 08:50:03 +00:00 by Alpha · 0 comments

Security Finding from Audit

Parent issue: #1

Severity

CRITICAL 🔴

CVSS Score

9.1

CWE

CWE-22 (Path Traversal), CWE-732 (Incorrect Permission Assignment)

Location

cobot/plugins/tools/plugin.py, _read_file(), _write_file()


Description

The file tools use Path.expanduser().resolve() but enforce no sandbox. The "protected paths" list only covers 8 specific agent source files. Any other file readable/writable by the process user is accessible.

Exploitable Paths:

  • /etc/passwd, /etc/shadow (if readable), ~/.ssh/id_rsa
  • ~/.cobot/cobot.yml (contains API keys if not using env vars)
  • Nostr identity files containing nsec private keys
  • /proc/self/environ — exposes all environment variables including secrets

Recommendation

  • Implement a workspace sandbox: all file operations must resolve within ~/.cobot/workspace/
  • Use os.path.commonpath() or similar to verify resolved paths stay within bounds
  • Block access to /proc, /sys, dotfiles, and sensitive directories

From: Cobot Whitebox Security Audit (February 14, 2026)
Finding ID: CB-002

## Security Finding from Audit > Parent issue: #1 ### Severity **CRITICAL** 🔴 ### CVSS Score 9.1 ### CWE CWE-22 (Path Traversal), CWE-732 (Incorrect Permission Assignment) ### Location `cobot/plugins/tools/plugin.py, _read_file(), _write_file()` --- ### Description The file tools use `Path.expanduser().resolve()` but enforce no sandbox. The "protected paths" list only covers 8 specific agent source files. Any other file readable/writable by the process user is accessible. **Exploitable Paths:** - `/etc/passwd`, `/etc/shadow` (if readable), `~/.ssh/id_rsa` - `~/.cobot/cobot.yml` (contains API keys if not using env vars) - Nostr identity files containing nsec private keys - `/proc/self/environ` — exposes all environment variables including secrets --- ### Recommendation - Implement a workspace sandbox: all file operations must resolve within `~/.cobot/workspace/` - Use `os.path.commonpath()` or similar to verify resolved paths stay within bounds - Block access to `/proc`, `/sys`, dotfiles, and sensitive directories --- *From: Cobot Whitebox Security Audit (February 14, 2026)* *Finding ID: CB-002*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot#11
No description provided.