T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/generateJWTtoken.py:22- Finding
Shared credential file is loaded without variable-level least-privilege controls
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a disclosed QWeather JWT token generator, with some avoidable credential-handling and logging risks users should understand.
Install only if you are comfortable letting the skill read your QWeather private key and QWeather identifiers, overwrite ~/.myjwtkey/last-token.dat, and create masked logs under /tmp/cslog. Keep ~/.openclaw/.env and ~/.myjwtkey/ed25519-private.pem private and user-owned; avoid storing unrelated secrets in the shared .env file if this skill will run unchanged.
scripts/generateJWTtoken.py:22Shared credential file is loaded without variable-level least-privilege controls
scripts/generateJWTtoken.py:41Predictable log file in a shared temporary directory permits symlink-based file access
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
生成和风天气 JWT Token 的工具。
环境变量(支持从 ~/.openclaw/.env 自动加载):
QWEATHER_SUB 和风账户的用户标识(sub 字段)
QWEATHER_KID 和风账户的密钥 ID(kid 字段)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
生成和风天气 JWT Token 的工具。
环境变量(支持从 ~/.openclaw/.env 自动加载):
QWEATHER_SUB 和风账户的用户标识(sub 字段)
QWEATHER_KID 和风账户的密钥 ID(kid 字段)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
生成和风天气 JWT Token 的工具。
环境变量(支持从 ~/.openclaw/.env 自动加载):
QWEATHER_SUB 和风账户的用户标识(sub 字段)
QWEATHER_KID 和风账户的密钥 ID(kid 字段)
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
生成和风天气 JWT Token 的工具。
环境变量(支持从 ~/.openclaw/.env 自动加载):
QWEATHER_SUB 和风账户的用户标识(sub 字段)
QWEATHER_KID 和风账户的密钥 ID(kid 字段)
The script loads secrets from '~/.openclaw/.env' with override=True, which forcibly replaces existing environment variables with values from a local file. If that file is writable by another local user/process or symlinked, the script could be tricked into using attacker-controlled identifiers, causing token generation under unexpected identities or operational misuse; automatic secret loading also broadens the trusted input surface.
import dotenv
# 优先加载 ~/.openclaw/.env(OpenClaw 标准配置位置)
# 若 OpenClaw 已将 env 注入了当前进程,此调用不会覆盖已存在的变量
dotenv.load_dotenv(os.path.expanduser("~/.openclaw/.env"), override=True)
except ImportError:
# 未安装 dotenv 时跳过,完全依赖环境继承
pass
The skill documents and invokes capabilities that access environment variables, read a private key from disk, write a token to disk, and execute a shell command, but it does not declare any tool scope or permission boundaries. In an agent environment, this weakens least-privilege controls and can allow broader-than-expected access to secrets and filesystem state, increasing the blast radius if the skill is misused or compromised.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
必须位于 ~/.myjwtkey/ed25519-private.pem,权限应为 600。
chmod 600 ~/.myjwtkey/ed25519-private.pem
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
"""将 token 写入 ~/.myjwtkey/last-token.dat,返回文件路径。"""
token_file = os.path.expanduser("~/.myjwtkey/last-token.dat")
os.makedirs(os.path.dirname(token_file), exist_ok=True)
with open(token_file, "w", encoding="utf-8") as f:
f.write(token)
os.chmod(token_file, 0o600)
return token_file