T09 · Insecure Skill Coding Practices
- Location
scripts/collect-openclaw-diagnostics.sh:97- Finding
Diagnostics Bundle Uses Inherited and Potentially Permissive Filesystem Permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/collect-openclaw-diagnostics.sh, lines 97-113
Vulnerability Type: Sensitive diagnostic data stored without explicit restrictive permissions
Risk Level: Mediumbash if [ -z "$OUTPUT_DIR" ]; then OUTPUT_DIR="./openclaw-diagnostics-$(date -u +%Y%m%dT%H%M%SZ)" fi if [ -e "$OUTPUT_DIR" ] && [ ! -d "$OUTPUT_DIR" ]; then echo "Output path exists but is not a directory: $OUTPUT_DIR" >&2 exit 1 fi if ! mkdir -p "$OUTPUT_DIR"/{commands,configs,logs,plugins}; then echo "Could not create diagnostics output directory: $OUTPUT_DIR" >&2 exit 1 fi COMMAND_INDEX="$OUTPUT_DIR/commands/command-index.tsv" FILE_INDEX="$OUTPUT_DIR/file-index.tsv" if ! printf 'name\tstatus\toutput\n' > "$COMMAND_INDEX"; then echo "Could not write command index: $COMMAND_INDEX" >&2 exit 1 fiTechnical Analysis
The collector creates directories and files without setting a restrictive
umaskor explicitly assigning private permissions. Their effective permissions therefore depend on the caller's inherited process environment. With a commonumaskof022, generated directories are normally created with mode0755and files with mode0644.The resulting bundle can contain operating-system details, OpenClaw status output, configuration metadata, plugin information, service state, and recent log excerpts. When optional flags are enabled, it can also contain redacted configuration contents and Git remote details. Although the script applies pattern-based redaction, such redaction cannot reliably recognize every proprietary credential format, personal identifier, conversation fragment, or application-specific secret.
The script also accepts an existing directory as
OUTPUT_DIRwithout verifying its owner, permissions, or whether path components are symbolic links. This increases the risk when a user selects a shared or attacker- ...[truncated 1681 chars]- Remediation
View remediation
Remediation Suggestions
- Set a restrictive mask before creating any output:
bash umask 077 - Create the top-level output directory with mode
0700and generated files with mode0600. - Refuse an existing output directory unless it is owned by the current effective user and is not accessible by group or other users.
- Resolve and validate the output path before writing. Reject symbolic-link output directories and unsafe parent directories.
- Create a new directory atomically rather than reusing a potentially attacker-controlled directory.
- Retain the existing redaction and manual-review controls, but state clearly that they do not replace access controls.
- Offer an explicit cleanup command or approved automatic deletion workflow for diagnostics that the user elects not to share.
- Set a restrictive mask before creating any output:
