T07 · Tool Hijacking and Spoofing
- Location
scripts/google_maps_reviews.py:16- Finding
Untrusted External Runtime Import Enables Arbitrary Code Execution and Token Theft
- Content
View full analysis
Vulnerability Details
File Location:
scripts/google_maps_reviews.py:16-19andscripts/google_maps_reviews.py:190-195
Vulnerability Type: Untrusted local module loading and tool spoofing
Risk Level: HighVulnerable Code
python TASK_RUNTIME_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "dataify-task-operations", "scripts")) if TASK_RUNTIME_DIR not in sys.path: sys.path.insert(0, TASK_RUNTIME_DIR) from task_runtime import complete_task, extract_task_idThe imported function is subsequently given the API credential:
python try: final_result = complete_task(task_id, token, args.wait_timeout, args.timeout) except RuntimeError as exc: print(str(exc), file=sys.stderr) return 1Technical Analysis
The script constructs a path outside the audited Skill package and inserts it at the beginning of
sys.path. Python then importstask_runtimefrom that externally controlled location. The referenced module is not included in the audited project, so its implementation, integrity, provenance, and network behavior cannot be verified.Prepending the directory gives it import priority. Any process or user able to create or replace
../../dataify-task-operations/scripts/task_runtime.pycan cause attacker-controlled Python code to execute automatically when the legitimate script starts. The importedcomplete_taskfunction is also passed the normalized bearer token, task identifier, and timeout values, providing a direct credential-disclosure opportunity.This external runtime is relevant to asynchronous result collection, but importing an unverified sibling module with execution privileges and giving it the raw credential exceeds the minimum trust boundary needed for the declared functionality.
Attack Path
- An attacker gains write access to the expected sibling path, or causes the Skill to run in a directory layout containing an atta ...[truncated 1234 chars]
- Remediation
View remediation
Remediation Suggestions
- Bundle the required task-runtime implementation inside the audited Skill package and import it through a package-relative import.
- Alternatively, use a version-pinned, integrity-verified dependency installed from a trusted package source.
- Do not prepend writable or externally managed directories to
sys.path. - If an external runtime is unavoidable, resolve a fixed file path and verify its cryptographic digest or signature before loading it.
- Apply restrictive ownership and write permissions to all runtime code directories.
- Reduce credential exposure by keeping authentication inside a small, audited client component instead of passing the raw bearer token into externally loaded functions.
- Add startup validation that rejects symlinks, unexpected ownership, or group/world-writable runtime files.
- Include the runtime in future security-audit scope and test import resolution in the actual deployment layout.
