T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/arc-shield.sh:251
- Finding
- Strict mode emits sensitive input before blocking it<![CDATA[ ## Vulnerability Details **File Location**: `scripts/arc-shield.sh:251-256`; `scripts/output-guard.py:267-273` **Vulnerability Type**: Fail-open sensitive-data disclosure **Risk Level**: High ### Vulnerable Code ```bash elif [[ "$MODE" == "strict" ]]; then echo "$INPUT" if [[ $FOUND_CRITICAL -gt 0 ]]; then echo -e "\n${RED}[BLOCKED]${NC} Critical secrets detected. Message blocked." >&2 exit 1 fi ``` ```python elif args.strict: print(text) critical_count = len([f for f in guard.findings if f.severity == CRITICAL]) if critical_count > 0: guard.print_report() print("\n[BLOCKED] Critical secrets detected. Message blocked.", file=sys.stderr) sys.exit(1) ``` ### Technical Analysis Both implementations write the complete, unredacted input to standard output before checking whether critical findings require the message to be blocked. Process exit status does not retract data already written to stdout. This violates the expected behavior of a strict output security boundary. Any caller that captures, logs, pipes, or forwards scanner output can receive the secret even though the scanner subsequently returns a failure status. ### Attack Path 1. An outbound message contains a recognized credential, such as a GitHub personal access token. 2. The message is passed to either scanner with `--strict`. 3. The scanner prints the original message, including the credential, to stdout. 4. A parent process, pipeline, hook, command substitution, or logging system captures that output. 5. The scanner exits with status 1 only after the sensitive content has already been disclosed. ### Impact Assessment No additional operating-system privileges are obtained. The affected scope is the full input message, including any credentials, private keys, PII, or tokens it contains. Disclosure can occur to downstream processes, terminal capture, CI output, hook consumers, or external messaging integrations. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions - Complete detection before writing any message content. - In strict mode, emit no stdout when a blocking finding exists. - Print the original input only after confirming that no finding meets the blocking threshold. - Ensure diagnostics contain categories and counts only, not matched values. - Add tests asserting that stdout is empty when strict mode returns a blocking status. - Apply the same fail-closed behavior to both Bash and Python implementations. ]]>
