T06 · System Persistence
- Location
scripts/clawusage.ps1.txt:150- Finding
Long-Lived Hidden Scheduled Task Executes Mutable Scripts with Policy Bypass
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its usage-monitoring purpose, but it uses sensitive OpenClaw credentials/session data and installs a long-lived hidden background task with weak containment.
Review this before installing if you would not want a skill to read OpenClaw auth/session files, query ChatGPT usage with your local token, cache usage/session snapshots under your profile, or install a hidden recurring Windows scheduled task. Only enable auto alerts if you accept those behaviors and know how to run auto off to remove the task.
scripts/clawusage.ps1.txt:150Long-Lived Hidden Scheduled Task Executes Mutable Scripts with Policy Bypass
scripts/clawusage-auto-worker.ps1.txt:63Command Injection Through Unsafe Construction of cmd.exe Command Lines
SKILL.md:65Recursive Script Discovery Permits Local Payload Substitution
The skill explicitly writes executable runtime files into a persistent directory under the user's profile ($env:USERPROFILE\.clawusage\skill-runtime) but does not disclose that behavior in the user-facing description. This is dangerous because it creates or overwrites local script files in a trusted per-user location, which can surprise users, complicate auditing, and increase the blast radius if the packaged scripts or resolved source directory are tampered with.
The skill runs PowerShell with -ExecutionPolicy Bypass, which suppresses an important local safeguard, yet the description does not warn users that this will occur. In context, this is more dangerous because the skill locates script files dynamically, copies them to a runtime directory, and then executes them directly, so bypassing execution policy materially lowers resistance to malicious or tampered script content.
The Language parameter is constrained with ValidateSet("english", "chinese"), forcing output into one of two specific languages. This is a locale/language restriction with no broader user opt-in or justification for excluding other languages.
The manifest describes checking Codex usage and managing idle alerts/language, but this code additionally scans local JSONL session logs to aggregate per-message token usage history. Reading and processing detailed local conversation telemetry is not obviously required for idle reminder delivery, and the manifest does not clearly justify this deeper log-mining capability.
The auto-worker derives the last active channel, target, account, last activity time, idle duration, and optional local token summaries from local session data, then sends a composed message through the external openclaw messaging command. Even though this appears intended for idle alerts, it transmits behavioral metadata to an external messaging sink without explicit in-file consent or validation of whether the recovered target/channel is appropriate for notification.
The script registers a scheduled task that launches PowerShell with -ExecutionPolicy Bypass, which disables a key policy guard for every automated execution of the worker script. In this skill context, the task runs repeatedly and uses script paths and state derived from the local environment, so if the referenced script or its directory is modified, the bypass makes execution more permissive and reduces defense-in-depth.
The ValidateSet limits language selection to only "english" or "chinese", which is a natural-language locale restriction. The file does not indicate that this limitation is optional, user-configurable beyond those two choices, or justified by a region-specific requirement.
The script reads a locally stored bearer token from the user's OpenClaw auth profile and uses it to make a direct request to chatgpt.com. That exceeds a purely local monitoring role and creates an undisclosed credential-handling/data-egress path; even if intended to improve accuracy, it expands trust boundaries and could expose account-scoped data or normalize token reuse by skills.
Accessing auth-profiles.json to locate and extract bearer tokens is sensitive behavior not clearly necessary for a chat-triggered usage monitor. In a skill context, local credential access materially increases risk because the skill runs with user context and can silently expand from status reporting into credential use.
The script not only accesses a local bearer token but transmits it in an Authorization header to an external service without any user-facing disclosure in the skill. Secret use without transparency is dangerous because users invoking a simple monitoring command may not realize credentials are being harvested from disk and used for outbound requests.
The script serializes notification state and writes it to clawusage-auto-state.json, persisting session key, target, account, and timestamps under the user's profile. There is no confirmation, user-facing notice, or inline documentation warning that this tracking file is created and updated.
When caching is enabled, the script creates a directory under the user profile and writes snapshot JSON containing usage and session details. The file lacks a user-facing warning or explanatory comment near the write path that local data will be persisted to disk.
No suspicious patterns detected.