T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/browser_guard.py:28- Finding
Unnecessary Access to Sensitive Agent Session Logs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/browser_guard.py, lines 28-43
Vulnerability Type: Least-privilege violation through unnecessary access to agent session logs
Risk Level: MediumVulnerable Code
python p.add_argument("--sessions-dir", default=os.path.expanduser("~/.openclaw/agents/main/sessions")) p.add_argument("--file-limit", type=int, default=12) p.add_argument("--unavailable-threshold", type=int, default=2) args = p.parse_args() pattern = os.path.join(args.sessions_dir, "hle_eval_*.jsonl") files = recent_files(pattern, args.file_limit) browser_calls = 0 unavailable_hits = 0 for fp in files: tail = read_tail(fp) if not tail: continue browser_calls += tail.count('"toolName":"browser"') + tail.count('"name":"browser"') unavailable_hits += tail.lower().count("no connected browser-capable nodes")The associated file-reading implementation appears at
scripts/browser_guard.py, lines 16-24:python def read_tail(path: str, max_bytes: int = 20000) -> str: try: size = os.path.getsize(path) start = max(0, size - max_bytes) with open(path, "rb") as f: f.seek(start) return f.read().decode("utf-8", errors="ignore") except Exception: return ""Technical Analysis
The browser availability guard enumerates up to 12 recent JSONL files under the default directory
~/.openclaw/agents/main/sessionsand reads as much as 20 KB from the end of each file. Agent session logs may contain prompts, responses, tool activity, and other sensitive conversation context.This access is not required to determine current browser availability. The same script already executes
openclaw browser status --jsonat lines 49-55 and uses itsrunningandcdpReadyfields. Reading historical session content therefore expands the Skill's access beyond its stated browser-status function and violates the principle of least privilege.The current implementat ...[truncated 1914 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove session-log enumeration and the
read_tail()operation from the browser availability workflow. -
Determine availability solely from the structured result of:
python subprocess.run( ["openclaw", "browser", "status", "--json"], check=False, capture_output=True, text=True, timeout=15, ) -
Remove the
--sessions-dir,--file-limit, and--unavailable-thresholdoptions if they are no longer required. -
If historical failure tracking is essential, require explicit user opt-in and use a dedicated status or telemetry file that contains no prompts, responses, or tool arguments.
-
Minimize retained information to non-sensitive counters and timestamps, and document every local data source the Skill accesses.
-
Add automated tests confirming that an availability check does not open files in agent session directories.
-
Consider applying process-level sandboxing or filesystem allowlisting so the guard can access only the browser-status executable and other resources strictly required for its task.
-
