T09 · Insecure Skill Coding Practices
- Location
SKILL.md:92- Finding
Overbroad loading of unrelated secrets from environment files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 92–108
Vulnerability Type: Overbroad credential-file access and process-environment modification
Risk Level: MediumVulnerable Code
python if os.environ.get('HUANGLI_API_TOKEN'): return env_paths = [ Path.home() / '.openclaw' / '.env', Path.cwd() / '.env', ] for p in env_paths: if p.exists(): for line in p.read_text().splitlines(): line = line.strip() if not line or line.startswith('#'): continue if '=' in line: k, v = line.split('=', 1) k, v = k.strip(), v.strip() if k and k not in os.environ: os.environ[k] = v breakTechnical Analysis
The Skill requires only
HUANGLI_API_TOKEN, but its fallback loader reads the entire first available.envfile and copies every parsed entry into the process environment. The searched locations include both the OpenClaw configuration directory and the current working directory.This exceeds the minimum privileges required for the declared calendar-query functionality. Unrelated passwords, API keys, database credentials, and service tokens stored in the same file become available process-wide to other code executing in the Agent process.
The custom parser also does not correctly implement standard
.envsyntax, including quoted values, escaping, multiline values, andexportdeclarations. This can cause malformed configuration or unexpected environment values.The subsequent network request sends only
HUANGLI_API_TOKENto the documented HTTPS endpoint. There is no evidence that this Skill directly transmits the other imported values, so the issue is excessive secret exposure rather than confirmed exfiltration.Attack Path
HUANGLI_API_TOKENis absent from the process environment.- The Skill is invoked to perfo ...[truncated 1264 chars]
- Remediation
View remediation
Remediation Suggestions
- Prefer OpenClaw's declared secret-injection mechanism and remove manual
.envdiscovery entirely. - If fallback loading is required, parse only the
HUANGLI_API_TOKENentry and keep it in a local variable rather than importing every entry intoos.environ. - Do not inspect the current working directory's
.envfile, because its trust boundary may differ from the OpenClaw configuration directory. - Use a maintained
.envparser when file-based configuration is unavoidable. - Validate configuration-file ownership and restrictive permissions before reading it.
- Never log or include the Bearer token in error messages or formatted results.
- Retain HTTPS certificate verification and restrict requests to the documented
xungufa.comendpoint.
- Prefer OpenClaw's declared secret-injection mechanism and remove manual
