T03 · Remote Payload Retrieval and Execution
- Location
scripts/runner.py:180- Finding
Mutable Remote Repository Scripts Are Discovered and Executed Without Integrity Verification
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:14-18,scripts/runner.py:63-76, andscripts/runner.py:180-191
Vulnerability Type: Remote payload retrieval and execution without version pinning or integrity verification
Risk Level: HighVulnerable Code
SKILL.md:14-18instructs users to clone a mutable remote repository without selecting a reviewed commit or verifying its integrity:bash git clone https://codeup.aliyun.com/6364d32c1d6d547e3e84d9fc/ZLQA.gitscripts/runner.py:63-76trusts any interface directory containing a file namedrun_tests.py:python # Scan interface directories (subdirectories containing run_tests.py) interfaces = {} for item in os.listdir(gmt_api_dir): item_path = os.path.join(gmt_api_dir, item) if os.path.isdir(item_path): run_script = os.path.join(item_path, 'run_tests.py') if os.path.exists(run_script): interfaces[item] = item_path if not interfaces: return f"[ERROR] No interface test directory found (must contain run_tests.py)"The original messages in the source are localized, but the executable behavior is shown without alteration.
scripts/runner.py:180-191subsequently executes the discovered script with the current user's privileges:python # Set cases to execute set_execute_cases(script_path, case_ids) # Execute tests result = subprocess.run( ['python', 'run_tests.py'], cwd=interface_dir, capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=120 )Technical Analysis
The documented setup process retrieves a repository from an external URL without pinning a commit, validating a cryptographic digest, or verifying a trusted signature. The effective code executed by the Skill can therefore change after this Skill package has been reviewed.
During initialization, the runner treats the mere presence of `r ...[truncated 2524 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin the external project to a specifically reviewed commit hash or immutable signed release rather than cloning the default branch.
- Publish an allowlist manifest containing the approved relative path and SHA-256 digest of every executable test script.
- Verify the manifest signature and each script digest immediately before execution; fail closed on missing, modified, or unexpected files.
- Do not authorize scripts based only on the filename
run_tests.py. Register only explicitly approved interfaces and canonicalize all configured paths before use. - Store the expected repository origin and commit identifier in
skill_config.json, then verify the checkout against both values before every run. - Execute external tests in an isolated environment, such as a disposable container or restricted worker account, with a read-only project mount where feasible.
- Expose only the minimum required configuration to the test process. Keep signing secrets in a dedicated secret store and provide scoped, short-lived credentials.
- Deny outbound network access by default and allow only the specific GM API endpoints required for testing.
- Invoke the intended interpreter through
sys.executableafter validating the runtime environment, rather than resolving a genericpythonexecutable fromPATH. - Record the verified commit, script digest, execution time, and selected interface in an audit log so test runs can be traced to exact reviewed code.
