Back to skill

Security audit

create-hook

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward guide for creating Codex hooks, with the main risk being that hooks intentionally persist and can affect future agent behavior.

Install this only if you want the agent to create or modify Codex hooks. Review any generated hook script and hooks.json entry carefully, prefer project-scoped hooks when possible, and keep matchers/events narrow because hooks can continue affecting future sessions until removed.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (2)

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

This skill explicitly instructs the agent to create persistent Codex hooks and update hook configuration files, which changes future agent behavior beyond the current task. Even though the feature is legitimate, persistence mechanisms are security-sensitive because they can be used to silently add approval gates, data exfiltration logic, or workflow manipulation that continues across later sessions.

Content

Scanner excerpt · SKILL.md (reported line 4)May include surrounding context.

md
---
name: create-hook
description: >-
  Create Codex hooks. Use when you want to create a hook, write hooks.json, add
  hook scripts, or automate behavior around agent events.
---
# Creating Codex Hooks

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 203)May include surrounding context.

md
- `subagentStop`: can return `followup_message`
- `beforeShellExecution` / `beforeMCPExecution`: can return `permission`, `user_message`, and `agent_message`

When the user wants to rewrite a tool call, prefer `preToolUse`. When they want to gate only shell commands, prefer `beforeShellExecution`.

## Implementation Workflow

Static analysis

No suspicious patterns detected.