T08 · Insecure Dependencies
Error
- Location
- scripts/social_suite.py:30
- Finding
- Unverified Dynamic Loading and Execution of External Skill Components<![CDATA[ ## Vulnerability Details **File Location**: `scripts/social_suite.py`, lines 30-45 **Vulnerability Type**: Untrusted local dependency loading **Risk Level**: High ### Vulnerable Code ```python def _import_from_path(module_name: str, file_path: str): """Import a Python module from an absolute path.""" spec = importlib.util.spec_from_file_location(module_name, file_path) if spec is None or spec.loader is None: return None module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module def _find_skill_script(skill_dir_name: str, script_name: str) -> str | None: """Find a skill script in standard locations.""" candidates = [ Path.home() / ".claude" / "skills" / skill_dir_name / "scripts" / script_name, Path.home() / "Desktop" / "openclaw-skills-publish" / skill_dir_name / "scripts" / script_name, ] for c in candidates: if c.exists(): return str(c) return None ``` The returned paths are subsequently loaded at lines 72-76, 103-106, and 135-138: ```python compound_path = _find_skill_script("phy-content-compound", "content_compound.py") if compound_path: try: compound = _import_from_path("content_compound", compound_path) ``` ```python humanizer_path = _find_skill_script("phy-content-humanizer-audit", "content_humanizer_audit.py") if humanizer_path: try: humanizer = _import_from_path("content_humanizer_audit", humanizer_path) ``` ```python rules_path = _find_skill_script("phy-platform-rules-engine", "platform_rules.py") if rules_path: try: rules = _import_from_path("platform_rules", rules_path) ``` ### Technical Analysis The application discovers Python components in predictable directories and executes them through `exec_module()` without validating their origin, version, integrity, ownership, or permissions. Importing a Python module executes all of its top-level code before any expected function i ...[truncated 1906 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Package reviewed component implementations as pinned dependencies rather than discovering arbitrary scripts in user-controlled directories. 2. Pin each component to an approved version and verify a cryptographic digest or publisher signature before importing it. 3. Maintain an explicit installation manifest containing the canonical path, expected version, and digest of every component. 4. Resolve each candidate with `Path.resolve()` and reject symlinks, unexpected path traversal, or files outside an approved installation root. 5. Check file ownership and permissions. Reject component files or parent directories writable by untrusted users. 6. Remove the development/Desktop fallback from production releases, or require an explicit command-line option and security warning before using it. 7. Obtain explicit user approval before first executing an external Skill component. 8. Where practical, execute third-party analysis components in a restricted subprocess with minimal filesystem access, a sanitized environment, resource limits, and network access disabled. 9. Do not pass draft or library data to a component until its integrity and trust status have been established. ]]>
