T08 · Insecure Dependencies
- Location
scripts/submit_dataify_ebay_products.py:11- Finding
Untrusted Sibling-Directory Module Import Enables Arbitrary Code Execution and API Token Exposure
- Content
View full analysis
Vulnerability Details
File Location:
scripts/submit_dataify_ebay_products.py, lines 11–14 and 258–264
Vulnerability Type: Untrusted external module loading and supply-chain exposure
Risk Level: HighComplete Vulnerable 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_taskThe imported function subsequently receives the API token:
python if not args.no_wait: try: final_result = complete_task(task_id, api_token, args.wait_timeout) except RuntimeError as exc: print(str(exc), file=sys.stderr) return 1 print(json.dumps(final_result, ensure_ascii=False, indent=2))Technical Analysis
The script constructs a path outside the audited Skill package, prepends it to
sys.path, and importstask_runtimefrom that location. The referenced module is not included in the audited project, is not version-pinned, and is not subject to any source or integrity verification.Because the sibling directory is inserted at the beginning of Python's module search path, a
task_runtime.pyfile placed there takes precedence over normally installed modules of the same name. Python executes top-level module code immediately during import. Consequently, malicious code can execute even when the user specifies--no-waitor before the Builder request is submitted.When normal waiting behavior is used, the imported
complete_taskfunction is additionally passedapi_token, which contains the value read fromDATAIFY_API_TOKEN. The external component therefore receives a bearer credential with no enforced trust boundary or interface isolation.Although asynchronous task monitoring is part of the Skill's declared functionality, dynamically trusting an unaudited si ...[truncated 2233 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the runtime
sys.pathmodification. Do not prepend a sibling directory outside the audited Skill package to Python's import path. - Package the monitoring implementation with the Skill. Include
task_runtimein a controlled package within the project and use an explicit relative or package import. - Alternatively, use a pinned dependency. If monitoring must be shared, distribute it through a trusted package source with an exact version and cryptographic hash verification.
- Verify component integrity. Where an external runtime is unavoidable, resolve a canonical expected path and verify the module against a trusted digest or signed manifest before loading it.
- Fail closed. If the expected module is unavailable or fails integrity verification, terminate before reading or transmitting the API token.
- Reduce credential exposure. Avoid passing the bearer token to arbitrary helper code. Keep authenticated network operations in a small, audited component and expose only narrowly scoped results to other modules.
- Use scoped credentials where supported. Configure the Dataify token with only the permissions required to submit and monitor the relevant tasks, and rotate it after any suspected module-path compromise.
- Add security tests. Verify that a forged
task_runtime.pyin nearby or current working directories cannot be imported and that the resolved module path remains inside the approved package location.
- Remove the runtime
