T05 · Unauthorized Access and Privilege Escalation
Error
- Location
- scripts/backup_full_system.sh:18
- Finding
- Excessive Collection and Unencrypted Cloud Upload of Sensitive Configuration<![CDATA[ ## Vulnerability Details **File Location**: `scripts/backup_full_system.sh`, lines 18-46 **Vulnerability Type**: Excessive privileged data access and plaintext sensitive-data transfer **Risk Level**: High ### Vulnerable Code ```bash # 2. SAO LƯU DANH SÁCH PHẦN MỀM & CRON apt-mark showmanual > $TMP_DIR/apt_packages.txt pip list --format=freeze > $TMP_DIR/python_libraries.txt 2>/dev/null crontab -l > $TMP_DIR/crontab_bak.txt 2>/dev/null # 3. SAO LƯU FILE CẤU HÌNH NGƯỜI DÙNG (Biến môi trường) cp ~/.bashrc ~/.profile ~/.bash_logout $TMP_DIR/ 2>/dev/null cp -r ~/.config $TMP_DIR/user_configs 2>/dev/null # 4. SAO LƯU CẤU HÌNH HỆ THỐNG (Cần quyền sudo cho các file nhạy cảm) # Sao lưu cấu hình Tailscale (nếu có) if [ -d "/etc/tailscale" ]; then sudo cp -r /etc/tailscale $TMP_DIR/etc_tailscale 2>/dev/null fi # Sao lưu các file dịch vụ tự tạo (Systemd) sudo cp /etc/systemd/system/openclaw* $TMP_DIR/systemd_services 2>/dev/null # 5. SAO LƯU TẬP TIN TRONG THƯ MỤC NGƯỜI DÙNG (Không bao gồm thư mục và file log) echo "--- ĐANG SAO LƯU TẬP TIN NGƯỜI DÙNG ---" mkdir -p $TMP_DIR/user_files # Tìm các file (không phải thư mục), không chứa 'log' trong tên, nằm trực tiếp trong PARENT_DIR find "$PARENT_DIR" -maxdepth 1 -type f ! -iname "*log*" -exec cp {} "$TMP_DIR/user_files/" \; 2>/dev/null # 6. ĐÓNG GÓI TẤT CẢ (Dữ liệu Bot + Cấu hình hệ thống) echo "--- ĐANG NÉN DỮ LIỆU ---" sudo tar -czf $BACKUP_DIR/$FILENAME -C $PARENT_DIR $SOURCE_NAME full_system_info # 7. ĐẨY LÊN GOOGLE DRIVE echo "--- ĐANG TẢI LÊN GOOGLE DRIVE ---" rclone copy $BACKUP_DIR/$FILENAME gdrive:OpenClaw_Backups ``` ### Technical Analysis The script recursively collects the entire `~/.config` directory, Tailscale configuration, shell startup files, cron entries, systemd service definitions, top-level user files, and the complete `.openclaw` directory. Several of these locations commonly contain access tokens, cloud credentials, private keys, authentication state, environment variables, command ...[truncated 2476 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace broad recursive collection with an explicit allowlist of OpenClaw files required for restoration. 2. Exclude credentials, private keys, authentication databases, tokens, Tailscale state, and unrelated application data by default. 3. Do not copy all of `~/.config`; identify only the specific non-secret configuration files needed by OpenClaw. 4. Remove Tailscale and systemd collection unless the user explicitly opts in after being shown the exact paths and risks. 5. Create an encrypted archive before upload using an authenticated encryption mechanism such as `age`, GPG, or an encrypted rclone remote. 6. Store encryption keys separately from the archive and cloud destination. 7. Validate and display the resolved rclone destination before transfer, and require confirmation for first use or destination changes. 8. Apply restrictive permissions with `umask 077` and verify that staging files and archives are readable only by the intended user. 9. Avoid `sudo` for the general archive operation. If privileged files are genuinely required, use a narrowly scoped helper or explicit allowlist. 10. Check all copy, archive, encryption, and upload exit statuses and abort securely if any stage fails. 11. Update the documentation to accurately enumerate collected data, privileged access, retention behavior, encryption requirements, and residual cloud risks. ]]>
