T06 · System Persistence
Error
- Location
- scripts/setup_cron.py:20
- Finding
- Persistent system-wide scheduling of background transcript monitoring<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup_cron.py:20-37, 51-83` **Vulnerability Type**: Persistent scheduled execution **Risk Level**: High ### Vulnerable Code ```python ENTRIES = [ ( "*/30 * * * *", f"python3 {SKILL_DIR}/scripts/observe_finance_usage.py", "30-min observation pass", ), ( "55 23 * * *", f"TZ=America/Los_Angeles python3 {SKILL_DIR}/scripts/daily_synthesize.py" f" >> {LOG_DIR}/synthesize.log 2>&1", "end-of-day synthesis", ), ( "0 6 * * *", f"TZ=America/Los_Angeles python3 {SKILL_DIR}/scripts/redact_reports.py --validate-only" f" >> {LOG_DIR}/redaction_check.log 2>&1", "redaction integrity check", ), ] ``` ```python def set_crontab(content: str) -> None: proc = subprocess.run(["crontab", "-"], input=content, text=True, capture_output=True) if proc.returncode != 0: print(f"Error writing crontab: {proc.stderr}", file=sys.stderr) sys.exit(1) def cmd_install() -> None: LOG_DIR.mkdir(parents=True, exist_ok=True) (SKILL_DIR / "data" / "observations").mkdir(parents=True, exist_ok=True) (SKILL_DIR / "reports").mkdir(parents=True, exist_ok=True) current = get_crontab() lines = current.splitlines(keepends=True) added = 0 new_lines = list(lines) if new_lines and not new_lines[-1].endswith("\n"): new_lines[-1] += "\n" for schedule, command, label in ENTRIES: cron_line = f"{schedule} {command} {MARKER}\n" if command in current: print(f" ✓ Already registered: {label}") else: new_lines.append(cron_line) print(f" ➕ Added: {label}") added += 1 if added: set_crontab("".join(new_lines)) ``` ### Technical Analysis The setup script writes three entries to the user's system crontab. These entries survive the original Skill invocation and cause transcript observation to ...[truncated 1594 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace system cron with an application-managed scheduler that is active only while the user has explicitly enabled the feature. 2. Obtain explicit confirmation immediately before installation and display every scheduled command, frequency, data source, and retention policy. 3. Support an expiration time and automatically remove jobs after the approved observation period. 4. Restrict monitoring to an explicit allowlist of agents or sessions. 5. Add a persistent, user-visible status indicator while observation is enabled. 6. Use a lock or compare-and-swap strategy when modifying crontab so concurrent edits cannot be overwritten. 7. Back up the prior crontab before modification and restore it safely on installation failure. 8. Provide a single command that disables scheduling and deletes collected observations, reports, checkpoints, and logs. ]]>
