T09 · Insecure Skill Coding Practices
- Location
src/index.py:137- Finding
Caller-Controlled runner_command Enables Arbitrary Command Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its crawler-wrapper purpose, but it allows overly broad command execution and can expose browser credentials in returned output and job files.
Review this skill before installing. Use it only in a dedicated workspace, avoid supplying browser_auth unless you accept that it may appear in command output or job files, keep Playwright storage-state files private, and do not allow untrusted prompts or workflows to set runner_command.
src/index.py:137Caller-Controlled runner_command Enables Arbitrary Command Execution
src/index.py:159Browser Authentication Credentials Are Returned and Persisted in Plaintext
SKILL.md:274Security-Critical Crawler Dependency Lacks Integrity Verification
_get_runner_command accepts an arbitrary runner_command from input/context and uses it as the executable prefix for all actions. That means the skill can be turned from a red-crawler wrapper into a general command launcher, enabling arbitrary command execution with the permissions of the agent/runtime; in this skill context, that is especially dangerous because the advertised purpose is narrowly scoped contact discovery, so callers may not expect general code execution.
The skill clearly describes shell execution, filesystem reads/writes, browser automation, network access, and handling of sensitive session-state files, but it does not declare an explicit tool scope such as permissions or allowed-tools. That makes the operational boundary unclear and increases the chance of over-broad execution or unintended access when invoked by an agent.
The skill is explicitly designed to collect contact information and manage Playwright storage-state session files, both of which are sensitive. Although there are some operational safety notes later, the command descriptions themselves do not present a clear user-facing privacy warning, consent expectation, or handling guidance for personal data and authentication artifacts.
The example prompts use very broad natural-language phrases like '帮我抓取一批小红书博主' and '我要登录小红书' that can map directly to actions performing crawling or authentication. In an agent setting, such broad triggers increase the risk of accidental invocation of browser automation, login flows, or data collection without sufficiently explicit user intent or parameter confirmation.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
sudo apt-get update
sudo apt-get install -y git python3 python3-pip
The manifest describes a skill whose purpose is to run the installed red-crawler CLI for Xiaohongshu contact discovery. In addition to discovery actions, the code exposes bootstrap, job_status, job_logs, job_stop, and ack_event actions and later writes heartbeat, job, log, and event files to manage long-running jobs, which is broader operational behavior than the description claims.
Browser auth and proxy credentials are appended as command-line arguments, which commonly exposes secrets through process listings, job metadata, logs, and returned command strings. In this file the skill also stores/display commands and argv in job records, increasing the chance those credentials are written to disk or surfaced to users unintentionally.
The login flow writes authenticated browser session state to a caller-supplied path, creating a reusable credential artifact on disk. If that file is stored in an insecure location, reused across users, or exposed through workspace access, an attacker may hijack the authenticated session.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
def run_command(argv, cwd):
return subprocess.run(argv, cwd=cwd, capture_output=True, text=True)
def _tail_file(path, max_lines):
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
with stdout_path.open("a", encoding="utf-8") as stdout_handle, stderr_path.open(
"a", encoding="utf-8"
) as stderr_handle:
process = subprocess.Popen(
wrapper_command,
cwd=_workspace_root(resolved),
stdout=stdout_handle,
The background job runner executes job["argv"] loaded from a JSON job file, and that argv ultimately derives from user-controlled resolved values including runner_command. Because there is no allowlist or integrity protection on the stored job definition, an attacker who can influence skill input or tamper with the job file can cause execution of arbitrary local programs under the skill's privileges.
with stdout_path.open("a", encoding="utf-8") as stdout_handle, stderr_path.open(
"a", encoding="utf-8"
) as stderr_handle:
process = subprocess.Popen(
job["argv"],
cwd=job["workspace_path"],
stdout=stdout_handle,
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.
"resolved": resolved,
}
job_path.parent.mkdir(parents=True)
job_path.write_text(json.dumps(job), encoding="utf-8")
class FakePopen:
pid = 9876
This file launches external commands through subprocess.run and subprocess.Popen for crawl, bootstrap, and job wrapper execution. Although subprocess execution is central to the skill's purpose, there is no visible docstring/comment or user-facing notice in this file explaining that external commands will be launched and may continue running in the background.