T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/scanner.py:112
- Finding
- Semantic analysis fails open and reports a safe default without performing analysis## Vulnerability Details **File Location**: `scripts/scanner.py:112-131`, `scripts/semantic_analyzer.py:132-163` **Vulnerability Type**: Fail-open security analysis and misleading risk classification **Risk Level**: High ### Vulnerable Code ```python # Determine if Layer 2 should run run_layer2 = deep or layer1_result.has_suspicious layers_used = ["Layer 1 (Rules)"] layer2_result = None layer2_prompt = None if run_layer2: layers_used.append("Layer 2 (Semantic)") frontmatter = get_frontmatter(skill_dir) or {} full_content = get_skill_content(skill_dir) layer2_prompt = semantic_analyzer.build_analysis_prompt( name=frontmatter.get("name", skill_name), description=frontmatter.get("description", ""), full_content=full_content, ) # NOTE: In actual OpenClaw usage, the agent would process this prompt # and feed back the JSON result. For CLI standalone testing, we use # the default result. layer2_result = semantic_analyzer.get_default_result() else: layer2_result = semantic_analyzer.get_default_result() ``` The default result is explicitly classified as safe: ```python def get_default_result(self) -> dict: """Return a default (safe) result when LLM analysis is not performed.""" return { "prompt_injection": { "detected": False, "confidence": 0.0, "evidence": [], "technique": "none", "explanation": "Layer 2 analysis not performed", }, "permission_analysis": { "declared_purpose": "unknown", "actual_capabilities": [], "overprivileged": False, "explanation": "Layer 2 analysis not performed", }, "data_access": { "sensitive_data_accessed": [], "data_sent_externally": False, "external_endpoints": [], }, "hidd ...[truncated 2297 chars]
- Remediation
- ## Remediation Suggestions - Represent missing semantic analysis as `unknown`, `incomplete`, or `analysis_unavailable`, never `safe`. - Do not add `"Layer 2 (Semantic)"` to `layers_used` unless an actual semantic response has been received and validated. - Implement a defined response-input mechanism, API callback, or direct model integration that feeds the analysis result into `parse_llm_response()` and the scorer. - Validate semantic responses against a strict schema, including field types, allowed risk values, and confidence ranges. - Fail closed for `--deep`: return a nonzero status or an incomplete-assessment warning if semantic analysis cannot be performed. - Prevent metadata bonuses from masking an unavailable security layer. - Clearly distinguish “not detected” from “not analyzed” in JSON and Markdown reports.
