T09 · Insecure Skill Coding Practices
- Location
scripts/ocr_localize.py:159- Finding
Unrestricted OCR endpoint can disclose reviewed images and Baidu access tokens
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does the advertised marketing review work, but it needs Review because it can automatically install packages and send submitted images and OCR tokens through broadly loaded, under-scoped environment configuration.
Install only if you are comfortable with reviewed images being sent to Baidu OCR, and run it in a constrained environment with a clean, explicit OCR configuration. Do not rely on CWD or global OpenClaw dotenv files, avoid setting BAIDU_OCR_ENDPOINT unless it is allowlisted, and preinstall pinned dependencies through a trusted package source.
scripts/ocr_localize.py:159Unrestricted OCR endpoint can disclose reviewed images and Baidu access tokens
scripts/run_review.py:149Automatic installation of unpinned dependencies from environment-controlled package sources
The skill advertises material review, but it also performs runtime self-checks, DNS/network tests, credential validation, and re-execution into a local virtual environment. Those are materially different behaviors from simple review logic and can surprise the host or user, especially in environments where executing local commands or probing connectivity is sensitive.
The skill advertises material review, but it also performs runtime self-checks, DNS/network tests, credential validation, and re-execution into a local virtual environment. Those are materially different behaviors from simple review logic and can surprise the host or user, especially in environments where executing local commands or probing connectivity is sensitive.
Referenced artifact was not completely inspected
> - **v1.1.7 SkillHub 发布优化**:`scripts/run_review.py` 首次运行会在缺少依赖时自动创建 `.venv` 并安装 `requirements.txt`
The file presents a '2026年修订动态' as if it is already effective and authoritative, while the document is framed as the current PRC National Common Language Law. In a compliance-review skill, inaccurate legal-effective-date claims can directly cause users to reject lawful marketing copy or enforce non-existent rules, creating legal, operational, and trust risks.
The run_ocr path sends image slices or the full image to Baidu OCR, which transmits user content to an external service without any explicit runtime notice or consent mechanism in this script. Because the skill reviews marketing materials that may include unreleased campaigns, customer data, pricing, or regulated claims, silent third-party transmission creates a significant confidentiality and compliance risk.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
def _get_baidu_access_token():
"""Get Baidu OCR access token from env or API key/secret."""
access_token = os.environ.get('BAIDU_ACCESS_TOKEN', '').strip()
if access_token:
return access_token
The request destination is influenced by environment-controlled values such as BAIDU_OCR_ENDPOINT, and the fallback path sends the request through an external curl process. In adversarial or misconfigured environments, this can redirect uploaded image data and OCR credentials/tokens to an unintended host, creating SSRF-like outbound exfiltration risk that is more concerning because this skill processes user-provided marketing assets.
def _post_form(url, params, timeout):
"""Post form data as JSON response; fall back to curl if Python DNS fails."""
import json
import subprocess
import urllib.parse
Loading credentials from a .env file in the current working directory is particularly risky because the CWD may be user-controlled or attacker-influenced. This can inject secrets or malicious configuration into the skill run, and it also causes the skill to access credentials unrelated to its review function.
def load_dotenv_files(env):
candidates = [
Path.cwd() / ".env",
SKILL_DIR / ".env",
Path.home() / ".openclaw" / ".env",
Path.home() / ".config" / "openclaw" / "gateway.env",
Reading a .env file from the skill directory is not inherently credential harvesting if that file is part of the skill's documented local configuration. Unlike CWD or global host files, this is closer to normal app configuration, though it should still be limited to explicitly required variables.
def load_dotenv_files(env):
candidates = [
Path.cwd() / ".env",
SKILL_DIR / ".env",
Path.home() / ".openclaw" / ".env",
Path.home() / ".config" / "openclaw" / "gateway.env",
]
Reading ~/.openclaw/.env pulls host-level secrets into this skill even though they may belong to other tools or workflows. This is a clear least-privilege violation and increases the chance that unrelated credentials are exposed to the skill or its subprocesses.
candidates = [
Path.cwd() / ".env",
SKILL_DIR / ".env",
Path.home() / ".openclaw" / ".env",
Path.home() / ".config" / "openclaw" / "gateway.env",
]
loaded = []
Copying the full host environment into the skill process causes all ambient secrets, tokens, proxy settings, and execution-related variables to become available to the launcher and all spawned subprocesses. In the context of a review skill, this is unnecessarily broad and especially dangerous because the script also reads additional dotenv files and performs network- and package-related operations.
parser.add_argument("--live", action="store_true", help="与 --self-check 搭配,实际调用一次百度 OCR")
args, passthrough = parser.parse_known_args()
env = os.environ.copy()
env.pop("__PYVENV_LAUNCHER__", None)
loaded_env_files = load_dotenv_files(env)
python_bin = choose_python()
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
return
if Path(sys.executable) == local_python:
return
env = os.environ.copy()
env["MARKETING_REVIEW_VENV_REEXEC"] = "1"
env.pop("__PYVENV_LAUNCHER__", None)
os.execve(str(local_python), [str(local_python), str(Path(__file__).resolve()), *sys.argv[1:]], env)
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
return
if Path(sys.executable) == local_python:
return
env = os.environ.copy()
env["MARKETING_REVIEW_VENV_REEXEC"] = "1"
env.pop("__PYVENV_LAUNCHER__", None)
os.execve(str(local_python), [str(local_python), str(Path(__file__).resolve()), *sys.argv[1:]], env)
os.system() and os exec-family calls run shell commands with the process's full privileges, enabling arbitrary command execution.
env = os.environ.copy()
env["MARKETING_REVIEW_VENV_REEXEC"] = "1"
env.pop("__PYVENV_LAUNCHER__", None)
os.execve(str(local_python), [str(local_python), str(Path(__file__).resolve()), *sys.argv[1:]], env)
reexec_with_skill_venv()
os.system() and os exec-family calls run shell commands with the process's full privileges, enabling arbitrary command execution.
env = os.environ.copy()
env["MARKETING_REVIEW_VENV_REEXEC"] = "1"
env.pop("__PYVENV_LAUNCHER__", None)
os.execve(str(local_python), [str(local_python), str(Path(__file__).resolve()), *sys.argv[1:]], env)
reexec_with_skill_venv()
The skill declares capabilities that require shell, filesystem, environment-variable access, and outbound network access, but it does not explicitly scope or constrain those permissions. That increases the blast radius if the skill is mis-triggered, modified, or used in an unexpected host environment, because it can read credentials, invoke external services, and write files without a clear least-privilege contract.
The trigger phrases are broad enough to overlap with ordinary requests about reviewing images, documents, or materials, which raises the chance of accidental activation. In a skill that can invoke shell commands, read env secrets, and make outbound OCR requests, accidental invocation can expose data or perform actions the user did not intend.
The activation guidance says the assistant will 'automatically recognize' review requests, but it does not clearly delimit when auto-activation should be suppressed. This ambiguity matters because the skill can process user-uploaded files and potentially send their contents to external OCR, so a loose trigger model creates privacy and consent risks.
The knowledge base explicitly includes national and Zhejiang language-law references, suggesting the skill may enforce language-related compliance rules. In this file, the user is not offered any language or locale choice, and the locale restriction is not clearly framed as only applying to region-specific compliance cases.
The document title and the entire skill reference content are presented only in Chinese, with no indication that users may choose another language or locale. Under the policy rule for natural-language violations, forcing a specific language without user opt-in is reportable unless the locale restriction is explicitly justified.
Suspicious Unicode normalization or mixed-script content
This markdown file includes prescriptive language rules such as banning traditional Chinese characters and requiring standard language forms, but it does not state that the skill is China-specific or offer any user language/locale choice. That creates a natural-language locale policy issue because the document effectively forces a specific language convention by default.
Suspicious Unicode normalization or mixed-script content
Suspicious Unicode normalization or mixed-script content
Suspicious Unicode normalization or mixed-script content