# qbee-agent: Local Privilege Escalation and Arbitrary File Tampering via Symlink Following in createFile helper

qbee-agent's createFile helper follows symlinks, letting a managed user point ~/.ssh at /root/.ssh and get their key written into root's authorized_keys.

- Payout: Research
- Severity: high
- Program: qbee-agent
- Found by: ttzero25
- Disclosed: 2026-11-17
- CVE: CVE-2026-62336
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-xhv5-8fpq-g7hf
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-xhv5-8fpq-g7hf
- Tags: area:cloud domain:infra impact:integrity impact:privesc kind:research platform:ghsa sev:high tech:go tech:linux technique:source-review vuln:path-traversal vuln:privilege-escalation vuln:race-condition

**Target:** qbee-agent file manager (app/configuration/file_manager.go) on managed devices
**Root cause:** The createFile helper resolves symlinks during privileged file writes instead of using O_NOFOLLOW, and does not validate ownership of the target path, so a user-controlled symlink redirects root-privileged writes/chowns.
**Steps:**
1. As a managed unprivileged user whose account is in the SSH Keys bundle, remove or replace `~/.ssh` with a symlink to `/root/.ssh`.
2. Wait for the next configuration apply; qbee-agent follows the symlink and writes the user's server-provisioned public key into `/root/.ssh/authorized_keys`.
3. Log in as root over SSH using the corresponding private key.
4. Secondary: with `fs.protected_symlinks=0`, symlink `/tmp/.bundle.raucb.part` to a system file such as `/etc/shadow` and trigger a RAUC update deployment to truncate/overwrite it.
5. Tertiary: symlink the partial download path to a sensitive file when a file-distribution destination sits under a user-owned directory, causing `file.Chown()` on the target.
**Exploitation:** Attacker needs a local unprivileged account managed by the SSH Keys bundle. They swap their own ~/.ssh for a symlink to /root/.ssh; because the link lives in their home directory, fs.protected_symlinks does not apply. On the next agent config apply, the agent writes the attacker's provisioned public key into /root/.ssh/authorized_keys, giving immediate root SSH access.
**Escalation:** Chained from a low-privileged managed account to full root via SSH key injection; alternate vectors reach arbitrary file overwrite/DoS and file re-ownership.
**Insight:** Agent/daemon file managers that write into user home directories as root are prime symlink targets: check whether the write path uses O_NOFOLLOW and whether fs.protected_symlinks actually covers the directory (it doesn't when the link sits in the user's own home).

