T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- SKILL.md:21
- Finding
- Unrestricted Sensitive Context-File Access Through CONTEXT_SOURCES<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:21-28` **Vulnerability Type**: Unrestricted local file access and path traversal **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown The agent reads these values from the skill's configuration entry in `openclaw.json` (`skills.entries.nxt-pulse-agent.config`). - `PULSE_SENSITIVITY`: Integer (1-5). 1 is conservative, 5 is highly sensitive to language cues. (Default: `3`) - `MAX_CONTEXT_CHARS`: Integer. Maximum characters to read from `CONTEXT_SOURCES` per pulse to keep tokens low. (Default: `5000`) - `PULSE_COOLDOWN`: Duration string (e.g., `30m`, `4h`). Minimum time between proactivity triggers. - `DOWNTIME_KEYWORDS`: Array of strings (Optional). Manual "hard-triggers" to force Recovery Mode. Note: The agent's **Semantic Detection** automatically identifies downtime needs in any language based on context, even without keywords. - `CONTEXT_SOURCES`: Array of strings. Relative paths to files that provide user state (e.g., journals, medical logs). - `SCOPE`: `dm` (default) or `group`. Limits proactive triggers to specific conversation types. ``` Related workflow instruction at `SKILL.md:38-41`: ```markdown ### 1. The Pulse Audit When triggered, the agent performs a **Resource-Safe Audit**: 1. **State Check**: Evaluates capacity using `MAX_CONTEXT_CHARS` from sources. 2. **Sentiment Alignment**: Adjusts based on `PULSE_SENSITIVITY`. ``` ### Technical Analysis The skill directs the agent to read files supplied through `CONTEXT_SOURCES`, including explicitly sensitive categories such as journals and medical logs. It does not define an approved root directory, canonical-path validation, traversal rejection, symbolic-link handling, file-type restrictions, or source-specific user consent. Restricting reads to relative paths is not a sufficient access-control boundary. A relative value such as `../../.ssh/id_rsa` can resolve outside the intended project or memory directory. Similarly, a p ...[truncated 2039 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Restrict context sources to a dedicated, explicitly approved directory. 2. Resolve each configured path with a canonicalization function before reading it. 3. Verify that the canonical path remains beneath the approved root directory using a separator-aware containment check. 4. Reject absolute paths, traversal components, device paths, and paths that escape through symbolic links. 5. Apply an allowlist of expected file extensions and reject special files, sockets, devices, and directories. 6. Require explicit user approval before adding each context source, especially journals, medical records, credential stores, and logs. 7. Run the skill under a least-privileged operating-system account that cannot access unrelated secrets. 8. Scan and redact likely credentials, tokens, private keys, and other secrets before placing file content into model context. 9. Treat `MAX_CONTEXT_CHARS` only as a resource limit, not as a security control. 10. Document whether context is sent to an external model provider and provide an opt-out for sensitive sources. 11. Add tests covering `../` traversal, absolute paths, symbolic-link escapes, encoded traversal variants, and paths sharing only a textual prefix with the approved root. ]]>
