Back to skill

Security audit

Trace Debugger Safety

Security checks for vulnerabilities and agentic risk

Overview

The skill is a trace-reporting tool, but its implementation contradicts its safety claims and can expose logs, repository content, and even attacker-selected local file lines during analysis.

Review carefully before installing. Use only in a tightly controlled environment with trusted logs, an explicit disposable repository path, and a sandboxed Codex configuration. Do not rely on the documented `--no-codex` or no-hardcoded-repo behavior until the implementation is fixed, and treat generated reports as sensitive because they may contain logs, source snippets, filesystem paths, and Codex output.

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 (4)

T01 · Skill Instruction Hijacking

Error
Location
scripts/trace_debugger_safety.py:273
Finding

Untrusted Elasticsearch Logs Are Passed to Codex Without Effective Isolation

Content
View full analysis
\n" "2) 证据:<...>\n" "3) 解决方案:<...>\n\n" "日志如下(JSON Lines):\n" + payload ) try: p = subprocess.run( ["codex", "exec", prompt], cwd=repo_path, capture_output=True, text=True, timeout=240, ) ``` ### Technical Analysis Elasticsearch records are serialized directly into a natural-language prompt and supplied to `codex exec`. The implementation limits the number of records to 200, but it does not impose a total byte limit, sanitize instruction-like text, remove sensitive fields, or structurally isolate log data from executable instructions. The normalized records also retain the complete Elasticsearch `_source` object in the `raw` field. Consequently, fields beyond those needed for trace analysis may be included in the Codex prompt. An attacker who can cause crafted messages to be indexed under a target trace ID can insert instructions that attempt to override the analysis task, request repository inspection, suppress findings, or induce disclosure of source-code information. Codex is also launched with the repository as its working directory, increasing the potential scope of agent actions. ### Attack Path 1. An attacker causes an application to emit a log associated with a trace ID that a user will investigate. 2. The crafted log contains instruction-like content designed to manipulate the Codex agent. 3. Elasticsearch returns the record in response to the trace query. 4. `normalize_es_logs()` preserves the record, including its complete `raw` source. 5. `run_codex_analysis()` serializ ...[truncated 1099 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/trace_debugger_safety.py:298
Finding

Advertised Safety Controls Are Missing and Codex Runs Automatically

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/trace_debugger_safety.py:226
Finding

Attacker-Controlled Caller Paths Can Read Files Outside the Repository

Content
View full analysis
{fp} :: {code}") except Exception: continue ``` ### Technical Analysis The `caller` value originates from Elasticsearch log data and is parsed as a filesystem path followed by a line number. The path is joined to `repo_path` without canonicalization or containment validation. If `rel` is absolute, `os.path.join(repo_path, rel)` discards the repository prefix. If `rel` contains `../` components, the resulting path can traverse outside the repository. The script then opens the file and places the selected line into the report. The only effective restriction is that the target must be a readable regular file. There is no extension allowlist, repository-boundary check, symlink check, or rejection of absolute paths. ### Attack Path 1. An attacker injects a log record associated with a trace under investigation. 2. The attacker set ...[truncated 1204 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/trace_debugger_safety.py:416
Finding

Sensitive Trace Reports Are Written Without Restrictive Permissions or Cleanup

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This is a high-risk description/behavior mismatch because the skill advertises safer handling of untrusted logs while the referenced behavior reportedly still feeds those logs into Codex, uses a hardcoded repo path, and performs extra repository scanning. That mismatch can cause operators to trust and run the skill in exactly the scenarios where prompt-injection, unintended code exposure, or unsafe execution is most likely.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The implementation contradicts the stated safety posture: it hardcodes a default repository path and automatically runs Codex analysis whenever logs are present. This defeats the claimed reduced prompt-injection risk and can cause sensitive local code to be analyzed together with untrusted logs without explicit operator intent.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script includes warning text acknowledging prompt-injection risk, yet still sends untrusted logs directly to codex exec by default. This mismatch is dangerous because it creates a false sense of safety while preserving the exact risky behavior the skill claims to mitigate.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill declares no explicit tool restrictions even though it is designed to drive file read/write, shell, and network-capable behavior. In an agent setting, missing scope boundaries increases the blast radius if the skill is misused, invoked on adversarial input, or combined with prompt-injection from logs and traces.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill claims safer defaults and reduced prompt-injection risk, yet also acknowledges that Codex execution is not recommended in untrusted-log environments. That contradiction is dangerous because it can mislead users into overestimating the safety of a workflow that still processes adversarial log content.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest-level description presents the skill as a safer trace debugging tool using Jaeger, Elasticsearch, and optional Codex analysis. However, the documented output instructions add delivery behavior (sending a file attachment message) and file deletion behavior, which are materially broader operations than the manifest's described report-generation scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file mandates an exact message format containing Chinese field labels such as '代码仓库路径' and '关键结论摘要'. This is a natural-language locale constraint that applies to all uses of the skill, but the document does not offer opt-in, alternatives, or a justification that the skill is region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Multiple user-facing strings and parsing expectations are fixed to Chinese, including the Codex prompt/response format and final report headings. This forces a specific language/locale without user opt-in or documented justification, which matches the stated locale policy concern.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
94% confidence
Finding

The subprocess invocation itself is not shell-injection prone because it uses an argument list, but it forwards untrusted log content directly into codex exec as a prompt. In this skill's context, that creates a real prompt-injection/exfiltration risk because attacker-controlled logs can manipulate the downstream agent/tool, especially when run against a local repository with code access.

Content

Scanner excerpt · scripts/trace_debugger_safety.py (reported line 297)May include surrounding context.

python
)

    try:
        p = subprocess.run(
            ["codex", "exec", prompt],
            cwd=repo_path,
            capture_output=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

At the point of execution, the script transmits collected logs to an external analysis subprocess without a contemporaneous user-facing warning or confirmation. In a tracing/debugging skill, logs commonly contain sensitive operational data, so silent forwarding increases the chance of unintentional disclosure and unsafe processing of adversarial content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
74% confidence
Finding

This code creates directories and writes a report file that includes trace identifiers, logs, analysis output, and repository context. While an output path argument exists, there is no print, prompt, or inline warning indicating that potentially sensitive debugging data will be persisted to disk.

Content

No source excerpt is available for this finding.