T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/cleanup.py:493- Finding
Cleanup Workflow Bypasses Confirmation for Packages and Skills
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:123-127,SKILL.md:150-181,scripts/cleanup.py:493-515
Vulnerability Type: Missing authorization check before destructive operations
Risk Level: HighThe documented cleanup workflow invokes
cleanup.pyusing the complete tracking file before obtaining the explicit confirmation required for dependency and Skill removal.Relevant workflow instructions:
markdown - **6+ items** → Agent runs `cleanup.py` in two phases: 1. **Preview**: `python "<skill_dir>/scripts/cleanup.py" --track-file "<workspace>/.workbuddy/session-track.json" --dry-run` 2. **Execute**: `python "<skill_dir>/scripts/cleanup.py" --track-file "<workspace>/.workbuddy/session-track.json"` - **User explicitly requests one-click cleanup** → Use `cleanup.py` regardless of item count.The later confirmation requirement states:
markdown For each Class B item, present a grouped confirmation prompt: - If user replies **全部删除** → uninstall/remove all Class B items. - If user replies **全部保留** → skip all, close the log. - If user replies **逐一确认** → iterate through each item and ask individually.The invoked CLI nevertheless processes all Class B entries automatically:
python if args.track_file: track_path = Path(args.track_file) if not track_path.exists(): print(f"❌ session-track.json not found: {args.track_file}", file=sys.stderr) sys.exit(2) manifest, workspace = load_track_as_manifest(str(track_path)) if manifest.get("temp_files"): print("\n── Temp Files ──") summary["temp_files"] = delete_files( manifest["temp_files"], dry_run, workspace=workspace ) if manifest.get("pip_packages"): print("\n── Pip Packages ──") summary["pip"] = uninstall_pip(manifest["pip_packages"], dry_run) if manifest.get("npm_packages"): print("\n─ ...[truncated 2067 chars]- Remediation
View remediation
Remediation Suggestions
- Make
--track-fileprocess onlytemp_filesby default. - Require explicit flags for every destructive Class B category, such as:
--confirmed-pip--confirmed-npm--confirmed-skills
- Generate a separate approval manifest containing only the canonical resources displayed to and approved by the user.
- Bind confirmation to a digest of the approved manifest so the tracking file cannot be changed between preview and execution.
- Re-display canonical paths and package names immediately before execution.
- Refuse to process Class B resources in unattended or one-click mode unless explicit confirmation is supplied.
- Add regression tests proving that a normal
--track-filecleanup never removes packages or Skills.
- Make
