Back to skill

Security audit

Long Task Handoff

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent handoff purpose, but its manager can follow untrusted handoff paths and write outside the intended workspace in some cases.

Review before installing. Use it only in trusted workspaces, inspect handoffs/ACTIVE.md and the handoffs directory for symlinks or external paths, and do not pass secrets into handoff fields. The skill should add strict workspace containment and pre-write validation before being treated as low-risk automation.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T01 · Skill Instruction Hijacking

Error
Location
scripts/handoff_manager.py:139
Finding

Active handoff pointer permits recovery from files outside the workspace

Content
View full analysis
Path | None: if not active.exists(): return None for line in read_text(active).splitlines(): if line.lower().startswith("latest:"): value = line.split(":", 1)[1].strip() candidate = Path(value) if not candidate.is_absolute(): candidate = active.parent / candidate if candidate.exists(): return candidate return None def find_handoff(workspace: Path) -> Path | None: active_target = parse_latest_from_active(active_pointer(workspace)) if active_target: return active_target candidates = sorted(handoff_dir(workspace).glob("session-handoff-*.md")) return candidates[-1] if candidates else None ``` Recovery subsequently instructs the Agent to trust the selected file: ```python def cmd_recover(args: argparse.Namespace) -> int: workspace = Path(args.workspace).resolve() found = find_handoff(workspace) if not found: print(json.dumps({"found": False, "path": None, "errors": ["No handoff found"]}, ensure_ascii=False, indent=2)) return 1 errors = validate_file(found) print( json.dumps( { "found": True, "path": str(found.resolve()), "valid": not errors, "errors": errors, "instruction": f"Read {found.resolve()} and continue from Next Actions after freshness checks.", }, ensure_ascii=False, indent=2, ) ) ``` ### Technical Analysis The value in the `Latest:` field of `handoffs/ACTIVE.md` is treated as a trusted path. Absolute paths are accepted directly, while relative paths are joined t ...[truncated 2267 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/handoff_manager.py:281
Finding

Symlink-following handoff writes can modify files outside the workspace

Content
View full analysis
None: active = active_pointer(workspace) active.parent.mkdir(parents=True, exist_ok=True) active.write_text( "\n".join( [ "# Active Handoff", f"Updated: {now_local()}", f"Latest: {target.resolve()}", f"Task: {task}", f"Restart Instruction: Continue this task by reading {target.resolve()} first.", "", ] ), encoding="utf-8", ) ``` ```python def write_handoff(args: argparse.Namespace, *, update: bool) -> int: workspace = Path(args.workspace).resolve() payload = merge_cli_payload(args) task = field(args.task or payload.get("task_name"), "Current task") trigger = field(args.event or ("context_compaction" if update else "manual_create")) agent = field(args.agent or payload.get("agent"), DEFAULT_AGENT) handoffs = handoff_dir(workspace) handoffs.mkdir(parents=True, exist_ok=True) previous = find_handoff(workspace) if update and previous: target = previous supersedes = payload.get("supersedes") or "previous revision of this file" else: stamp = datetime.now().strftime("%Y%m%d-%H%M%S") target = handoffs / f"session-handoff-{stamp}-{slugify(task)}.md" supersedes = payload.get("supersedes") or (str(previous.resolve()) if previous else "none") previous_text = read_text(target) if target.exists() else "" provisional = build_handoff_text( task=task, workspace=workspace, agent=agent, trigger=trigger, supersedes=supersedes, authoritative="yes, referenced by ACTIVE.md", payload= ...[truncated 2903 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/handoff_manager.py:342
Finding

Secret scanning occurs only after sensitive handoff content is written to disk

Content
View full analysis
list[str]: if not path.exists(): return [f"File does not exist: {path}"] if path.suffix.lower() != ".md": return [f"Expected a Markdown file, got: {path}"] text = read_text(path) sections = extract_sections(text) errors: list[str] = [] errors.extend(check_updated_timestamp(text)) errors.extend(check_authoritative_metadata(text)) errors.extend(check_required_sections(sections)) errors.extend(check_restart_instruction(sections)) errors.extend(check_placeholders(text)) errors.extend(check_sensitive_content(text)) errors.extend(check_active_pointer(path, text)) return errors ``` ### Technical Analysis The Skill explicitly states that secrets must not be included in handoff files. However, the implementation constructs the complete handoff and writes it to the final destination before invoking `validate_file`. If a payload field contains an API key, token, password, private key, or `.env`-style value r ...[truncated 1557 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is ներկայացված as an ultra-light, nearly invisible handoff manager, but the referenced behavior includes validation, linting, secret scanning, and filesystem consistency checks that are not clearly disclosed in the declared purpose. This mismatch is dangerous because operators may approve or auto-trigger the skill expecting low-risk handoff updates, while it actually performs broader analysis of workspace content and state, which can expose sensitive data, alter trust assumptions, and cause unintended actions during context-boundary automation.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/secret-patterns.json (reported line 2)May include surrounding context.

json
{
  "description": "Secret and credential patterns for long-task handoff validation. This is a superset of agent-memory-cleanup references/default-rules.json secret_patterns plus handoff-specific .env and private-key checks.",
  "patterns": [
    "sk-[A-Za-z0-9_-]{16,}",
    "ghp_[A-Za-z0-9_]{16,}",

Direct flow: pathlib.Path.read_text (file read) → pathlib.Path.write_text (file write)

High
Category
Data Flow
Confidence
80% confidence
Finding

Data flows directly from a source (env vars, files, network) to a sink (network output, exec, file write) without intermediate validation.

Content

Scanner excerpt · tests/test_handoff_manager.py (reported line 109)May include surrounding context.

python
"created fixture",
            )
            handoff = Path(json.loads(created.stdout)["path"])
            handoff.write_text(
                handoff.read_text(encoding="utf-8")
                + "\nAPI_KEY=abcdef1234567890\nTemplate leftover: [path]\n",
                encoding="utf-8",

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill instructs the agent to invoke Python and perform workspace reads/writes, but it does not declare an explicit tool scope such as allowed tools or permissions boundaries. This creates an authorization ambiguity where an agent or runtime may grant broader-than-necessary shell and filesystem access, increasing the chance of unintended file modification or command execution in a security-sensitive context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The evals repeatedly trigger on broad phrases like context compaction, unreliable context, or a generic request to continue, which can cause the skill to activate in situations where the user did not clearly request a handoff. In an agent environment, overbroad activation can lead to unnecessary file writes, restart advice, and context-transfer behavior that changes workflow state or exposes task details when simple continuation was intended.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/handoff_manager.py (reported line 107)May include surrounding context.

python
def run_git(workspace: Path, *parts: str) -> str | None:
    try:
        proc = subprocess.run(
            ["git", "-C", str(workspace), *parts],
            text=True,
            capture_output=True,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · tests/test_handoff_manager.py (reported line 17)May include surrounding context.

python
class HandoffManagerTests(unittest.TestCase):
    def run_manager(self, *args, cwd=None, input_text=None, expect=0):
        proc = subprocess.run(
            [sys.executable, str(MANAGER), *args],
            cwd=cwd,
            input=input_text,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · tests/test_handoff_manager.py (reported line 122)May include surrounding context.

python
with tempfile.TemporaryDirectory() as tmp:
            other_cwd = Path(tmp) / "other"
            other_cwd.mkdir()
            proc = subprocess.run(
                [
                    sys.executable,
                    str(MANAGER.resolve()),

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The expected behavior says the agent should use the long-task handoff workflow in the user's working language when safe. This imposes a language choice based on inferred context rather than an explicit user selection, which can violate language/locale policy if the organization requires user opt-in for language changes.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/handoff_manager.py (reported line 97)May include surrounding context.

python
("decisions_and_constraints", "decision"),
        ("fact_sources", "source"),
    ]:
        values = as_list(getattr(args, attr, None))
        if values:
            payload[key] = values
    if getattr(args, "goal", None):

Static analysis

No suspicious patterns detected.