T07 · Tool Hijacking and Spoofing
Error
- Location
- scripts/pipeline.py:18
- Finding
- Execution of an Unpackaged and Unaudited External Uploader## Vulnerability Details **File Location**: `scripts/pipeline.py`, lines 18–23 and 245–260 **Vulnerability Type**: External tool hijacking through hard-coded mutable paths **Risk Level**: High ### Vulnerable Code ```python sys.path.insert(0, '/root/.openclaw/workspace/projects/content/vanyan_video_factory') # ── Config ────────────────────────────────────────────────────────────────── QUOTE_LIBRARY = "/root/.openclaw/workspace/projects/content/tsw_quote_library.json" OUTPUT_DIR = "/root/tsw_videos/noltx_output" AUDIO_DIR = "/root/tsw_videos/noltx_audio" CLIP_CACHE_DIR = "/root/tsw_videos/clip_library" LOG_FILE = "/root/.openclaw/workspace/agents/tsw/cron.log" YT_UPLOADER = "/root/.openclaw/workspace/projects/content/yt_uploader.py" ``` ```python def upload_to_youtube(video_path, title, description): try: result = subprocess.run( ["python3", YT_UPLOADER, video_path, title, description], capture_output=True, text=True, timeout=300 ) if result.returncode == 0: log.info(f"YouTube upload: {result.stdout.strip()[:200]}") return True else: log.warning(f"YouTube upload failed: {result.stderr.strip()[:200]}") return False except Exception as e: log.error(f"Upload error: {e}") return False ``` ### Technical Analysis The pipeline executes `yt_uploader.py` from a hard-coded path outside the audited project. That uploader is not included in the supplied directory, so its behavior, credential handling, network destinations, and YouTube privacy configuration cannot be verified. The script also prepends an external directory to `sys.path`. Because the directory is placed first in Python's module search order, a malicious module placed there could shadow imported packages such as `requests`, `edge_tts`, or `moviepy`. Although the subprocess call uses an argument list and is not directly vulnerable to shell inje ...[truncated 1074 chars]
- Remediation
- ## Remediation Suggestions - Package the uploader inside the audited project and review it together with the pipeline. - Remove the external `sys.path.insert` operation and use normal package imports. - Resolve project resources relative to `Path(__file__)` rather than hard-coded workspace paths. - If an external executable is unavoidable, configure its path explicitly, verify its ownership and permissions, and validate it against a trusted cryptographic hash before execution. - Run the pipeline as a dedicated, unprivileged service account rather than root. - Implement YouTube uploading directly through the reviewed Google API client and explicitly set and verify the intended privacy status. - Restrict write access to all executable code and dependency directories.
