Back to skill

Security audit

Persistent Code Terminal

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-built for persistent coding automation, but it needs review because it can run Codex with write authority, retry tasks automatically, and persist sensitive command/session data.

Install only in repositories where you are comfortable with automated code edits. Keep auto routing disabled unless you intentionally want natural-language messages to run Codex. Review diffs before commit or push, avoid putting secrets in prompts or shell commands, and add `.pct-state.json` and `.pct-routing.log` to gitignore or clean them regularly.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Warning
Location
bin/persistent-code-terminal-lib.sh:8
Finding

Predictable tmux Session Names Can Cause Cross-Project Command Execution

Content
View full analysis
/dev/null; then echo "Using existing session: $SESSION" pct_state_update_start "$SESSION" exit 0 fi tmux new-session -d -s "$SESSION" -c "$(pwd)" ``` ### Technical Analysis Session identity is derived only from the normalized basename of the current project directory. The canonical project path is not incorporated into the name. Consequently, distinct paths such as: ```text /home/user/customer-a/api /home/user/customer-b/api ``` both resolve to: ```text api-code-session ``` Normalization also creates additional collisions. For example, `project_a` and `project-a` can normalize to the same session name. When a matching session already exists, `persistent-code-terminal-start.sh` reuses it without verifying that the session's pane working directory corresponds to the current canonical project directory. Subsequent generic commands sent through `persistent-code-terminal-send.sh` execute in the reused pane's shell context. The state file can meanwhile identify the current directory as the project, creating a misleading record of where the command actually ran. The Codex wrapper includes an explicit `--cd` argument by default, which reduces this issue for default Codex invocations. It does not protect arbitrary commands sent through `persistent-code-terminal-send.sh`, and the protection can also be removed through the document ...[truncated 1539 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
bin/persistent-code-terminal-read.sh:32
Finding

Unauthenticated and Stale Completion Sentinels Can Spoof Command Results

Content
View full analysis
``` The marker has no per-command nonce, command identifier, or trusted side channel. The reader scans the previous 2,000 lines and selects the last matching text, regardless of which command generated it. This creates two related weaknesses: 1. **Output spoofing:** A command, test, build script, repository hook, or Codex-produced process can print a forged marker such as `__PCT_EXIT_CODE__0`. The automation may then report success before the actual wrapper exits. 2. **Stale-marker reuse:** A marker from an earlier command remains in pane history. A read performed before the current command finishes can select the old value and treat the current command as completed. The baseline sentinel count used by `per ...[truncated 1855 chars]
Remediation
View remediation
: ``` - Store the expected command identifier in the state file before execution. - Accept only a marker matching the current command identifier. - Track the pane history position at submission and inspect only output generated after that position. - Prefer a separate status file or pipe with owner-only permissions over parsing untrusted terminal output. - Clear the current exit status before sending a task and do not allow `read.sh` to restore an exit code from unrelated pane history. - Add regression tests for forged markers, stale markers, simultaneous commands, and commands whose normal output contains the sentinel prefix. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
bin/persistent-code-terminal-lib.sh:122
Finding

Complete Commands and Instructions Are Persisted in Plaintext

Content
View full analysis
"$state_file" <
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
bin/persistent-code-terminal-auto.sh:137
Finding

Automatic Retries Discard the User's Original Scope and Safety Constraints

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (22)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · .github/workflows/ci.yml (reported line 16)May include surrounding context.

yaml
uses: actions/checkout@v4

      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y tmux shellcheck shfmt bats

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The skill is presented as a persistent tmux terminal, but its documented behavior goes further by automatically routing natural-language requests into Codex execution, retrying tasks, summarizing results, and performing multi-step autonomous workflows. That mismatch matters because users or higher-level routers may grant it broader authority than expected, increasing the chance of unintended code changes, test execution, commits, or pushes under a seemingly simple terminal utility.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

md
## Safety

- Never `git push --force` unless user explicitly requests.
- Keep secrets out of terminal output.
- Prefer feature branches; avoid direct pushes to main/master unless explicitly requested.
- For network/privileged actions (for example `git push`), follow active Codex approval/sandbox policy.

External Model or Provider Selection

High
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

Scanner excerpt · bin/persistent-code-terminal-codex-exec.sh (reported line 17)May include surrounding context.

sh
Behavior:
  - By default, this script runs:
      codex exec --full-auto --sandbox workspace-write --cd <current-dir> "<instruction>"
  - Set PCT_CODEX_NO_DEFAULT_FLAGS=1 to disable default flags.

Examples:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · .github/workflows/ci.yml (reported line 17)May include surrounding context.

yaml
- name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y tmux shellcheck shfmt bats

      - name: Check formatting (shfmt)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · .github/workflows/ci.yml (reported line 18)May include surrounding context.

yaml
- name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y tmux shellcheck shfmt bats

      - name: Check formatting (shfmt)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
87% confidence
Finding

The README describes an opt-in feature that automatically routes natural-language coding intents into command execution via persistent tmux sessions and Codex automation. This increases the risk of unintended or over-broad action execution from ambiguous prompts, especially because the documented workflows include modifying code, committing, and pushing changes, which can amplify prompt-injection or misrouting mistakes.

Content

Scanner excerpt · README.md (reported line 115)May include surrounding context.

md
## Intelligent auto routing

You can enable auto-routing so coding intents are automatically executed through persistent sessions.

Config toggle (default false):
- `openclaw.config.dev.autoCodeRouting`

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill embeds a Chinese-only bypass phrase (不要执行,只分析) as part of safety filtering, which creates a language-specific policy constraint in natural-language behavior. The surrounding routing and trigger examples also rely on Chinese phrasing without stating that the skill is intentionally Chinese-only or offering user opt-in for language/locale handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This shell script launches codex exec --full-auto --sandbox workspace-write, which can autonomously change files in the current workspace. Although the behavior is shown in the help text, there is no clear warning or confirmation that the command may modify user files automatically before execution.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · README.md (reported line 56)May include surrounding context.

md
else
  echo "[FAIL] tmux missing"
  print_fix "macOS: brew install tmux"
  print_fix "Ubuntu/Debian: sudo apt install tmux"
  PASS=0
fi

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · bin/persistent-code-terminal-doctor.sh (reported line 16)May include surrounding context.

sh
else
  echo "[FAIL] tmux missing"
  print_fix "macOS: brew install tmux"
  print_fix "Ubuntu/Debian: sudo apt install tmux"
  PASS=0
fi

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script prints the last 2000 lines of the tmux pane directly to stdout, which can include secrets, tokens, command output, or other sensitive project data. In a persistent coding terminal skill, this behavior is expected functionality, but without any warning, redaction, or access control boundary in the script, consumers may unintentionally expose sensitive terminal history.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

In JSON mode, the script emits not only captured terminal output but also project directory, session name, last command, phase, and timestamps. This aggregates sensitive operational context into a machine-readable format that is easy for downstream tools to ingest, log, transmit, or exfiltrate, increasing exposure risk in exactly the kind of automation-heavy environment this skill targets.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script records the natural-language trigger reason and parsed project information into .pct-routing.log in the current directory, and elsewhere derives those fields directly from user input. If a user includes secrets, credentials, internal names, or other sensitive content in the instruction text, this design preserves that content in a persistent log without any minimization or redaction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script's activation and intent parsing depend heavily on Chinese-language phrases such as 用 codex, 使用 codex, 给/为/对...项目, and multiple Chinese action patterns. Because there is no explicit user opt-in, language selection, or documentation that this is a Chinese-specific skill, it risks violating language/locale policy by implicitly favoring one locale.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

In parse-only mode, the script emits parsed instructions back in JSON or plaintext, which can expose secrets or sensitive prompts embedded in the user's message to terminals, logs, calling systems, or downstream automation. In an agent skill context, echoing back raw user instructions increases the chance of unintended disclosure across toolchains and telemetry.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This script automatically routes natural-language input into coding actions by invoking helper scripts that can start sessions and execute instructions, with no interactive confirmation before execution. In the context of a coding terminal skill, that creates a real prompt-to-action boundary issue: a casually phrased or adversarially supplied message can trigger code changes, tests, commits, or multi-project execution immediately.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The example explicitly instructs the agent to commit and push code to the current branch, which modifies the repository and transmits changes to a remote without a prominent warning or approval checkpoint. In a mobile/SSH workflow with automation and persistence, this increases the chance of unintended publication of incorrect, sensitive, or unreviewed changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The example explicitly instructs users to run git add -A, git commit, and git push from a persistent terminal workflow without any warning that these commands modify repository state and can publish changes to a remote. In a security-sensitive automation skill, this increases the chance of accidental commits, inclusion of unintended files, or pushing unreviewed or sensitive changes, especially because the terminal session is designed to make command execution easy and persistent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The skill documentation presents key business-scenario and command guidance in Chinese while other sections are in English, which can impose a language expectation on users without explicit opt-in. Under the policy, locale or language constraints should either be optional for users or clearly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The script sends the assembled Codex command, including the user's instruction, into a persistent terminal session via helper scripts. While this is part of the implementation, there is no explicit user-facing disclosure in the script output that the instruction will be transmitted to and retained in a persistent session context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script records routing decisions and parsed project metadata into .pct-routing.log in the current directory without clear notice or consent. Even if intended for debugging or observability, silent logging of user-derived content can leak operational details into repositories, shared workspaces, or backups.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.