Back to skill

Security audit

Ai Session Analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says by analyzing local AI session logs, but its HTML report handles sensitive local data in ways that need review before installation.

Install only if you are comfortable with the skill reading local Claude, Codex, and Kimi session histories. Prefer terminal summaries or run the HTML report with --no-open, do not share the generated report, and treat the CDN dependency plus unescaped report fields as issues to fix before using it on sensitive work logs.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_report.py:751
Finding

Stored HTML and Script Injection Through Session-Derived Report Data

Content
View full analysis
{s[:100]}' for s in cx.get('searches', [])[:8] )} ``` ```python dt_items = "".join( f'{tn}{cnt}' for tn, cnt in list(kc["domain_tools"].items())[:12] ) ``` ### Technical Analysis The report generator treats values extracted from local AI session records as trusted HTML. Codex web-search queries and Kimi tool names are inserted directly into the generated document without HTML escaping. These records may contain attacker-influenced content. For example, a malicious search query could contain: ```html ``` When this value is interpolated into the report, the browser interprets it as markup instead of plain text. Truncating the value does not provide security because compact event-handler payloads can fit within the imposed limits. The `js_safe()` helper elsewhere in the file only serializes values for JavaScript contexts and replaces closing-script sequences. It does not protect values inserted directly into HTML contexts. The generated document also has no Content Security Policy to prevent inline event handlers or unauthorized outbound requests. ### Attack Path 1. An attacker causes a crafted value containing HTML markup to be recorded as a Codex web-search query or Kimi tool name. 2. The value is stored in a local Codex or Kimi session record. 3. The user invokes `generate_report.py`. 4. The script reads the malicious value from the session record. 5. The value is interpolated directly into ...[truncated 1112 chars]
Remediation
View remediation
{escape(str(s), quote=True)}' for s in cx.get("searches", [])[:8] ) dt_items = "".join( f"{escape(str(tn), quote=True)}{int(cnt)}" for tn, cnt in list(kc["domain_tools"].items())[:12] ) ``` 3. Prefer keeping dynamic values in safely serialized JSON and rendering them with DOM APIs that use `textContent`, rather than constructing HTML strings. 4. Audit every formatted HTML string for other session-derived values. Escaping must match the destination context: HTML text, HTML attribute, JavaScript string, and URL contexts require different handling. 5. Add a restrictive Content Security Policy. After removing inline scripts and event handlers, use a policy similar to: ```html ``` 6. Add regression tests with payloads containing `` to verify that all values appear only as text. ]]>

T03 · Remote Payload Retrieval and Execution

Warning
Location
scripts/generate_report.py:794
Finding

Remote Third-Party JavaScript Executes in a Sensitive Local Report

Content
View full analysis
``` ```python html = build_html(cc, cx, kc) output.write_text(html, encoding="utf-8") print(f"Done: {output} ({output.stat().st_size // 1024}KB)") if not args.no_open: import webbrowser webbrowser.open(str(output.resolve())) print(f"Opened: {output}") ``` ### Technical Analysis The generated report loads and executes Chart.js directly from jsDelivr. The resource is not protected by a Subresource Integrity hash, and the page has no restrictive Content Security Policy. Although the project contains no explicit code that uploads session data, the remote script executes in the same document as sensitive session-derived data. It can interact with the document and report state. If the CDN response, upstream package, delivery path, or referenced artifact is compromised, the effective executable payload can change after the Skill has been reviewed. This network request is triggered when the report is opened, and the script opens the report automatically by default. Loading remote executable code is not required for local session analysis and exceeds the minimum privileges needed for a private report. It also conflicts with the documentation's description of the output as a “self-contained HTML file.” ### Attack Path 1. The user runs `generate_report.py`. 2. The generator reads private local session records and embeds derived data in an HTML report. 3. The report is automatically opened unless the user explicitly supplies `--no-open`. 4. The browser connects to `cdn.jsdelivr.net` and downloads the referenced JavaScript. 5. A compromised CDN response or upstream artifact supplies malicious JavaScript instead of the expected Chart.js implementati ...[truncated 877 chars]
Remediation
View remediation
``` For a truly self-contained report, embed a reviewed, fixed copy of the library in the generated file. 3. Record and verify the bundled artifact's cryptographic checksum as part of release or build validation. 4. If remote loading must be retained, use an immutable versioned resource with Subresource Integrity: ```html ``` The integrity value must be independently generated and verified for the exact artifact; it must not be copied from an untrusted source. 5. Add a restrictive Content Security Policy that limits scripts to the approved source and disables arbitrary outbound connections. Prefer `connect-src 'none'` for a local report. 6. Make browser opening opt-in rather than automatic. Replace the current default with an explicit `--open` option so generation alone does not trigger network access. 7. Update the documentation accurately: either make the report genuinely self-contained or clearly disclose that opening it downloads and executes third-party code. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (10)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
The HTML report (`generate_report.py`) embeds your session data directly — file paths, shell commands, project names, and tool usage patterns. This is safe for

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill explicitly instructs the agent to run local Python scripts and read sensitive session data from user home-directory locations, but it does not declare any tool scope such as allowed-tools or permissions. That creates an authorization gap: an orchestrator may grant broader file and shell access than is minimally required, increasing the risk of unintended data exposure or overbroad command execution when the skill is invoked.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script recursively reads local AI session data from ~/.claude, ~/.codex, and ~/.kimi and prints derived summaries about projects, tool usage, dates, and activity without an explicit consent prompt or strong warning about sensitive data exposure. In this skill context, accessing assistant transcripts is the core function, but those transcripts can contain secrets, file paths, project names, and behavioral metadata, so silent bulk analysis increases privacy and data-handling risk if users do not realize the scope of collection.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script extracts and renders users' Codex web search queries into the HTML report. Search queries can contain secrets, internal project names, incident details, customer data, or other sensitive intent-revealing material, so surfacing them in a report expands exposure beyond what is necessary for high-level session analytics.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The HTML document is emitted with lang="zh-CN", which forces a specific locale in the generated output regardless of the user's preferences or environment. This is a natural-language locale policy issue because no opt-in, configuration option, or region-specific justification is provided.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The generated report loads Chart.js from a remote CDN even though the tool is positioned as analyzing local session data. Opening the report causes a network request and shares metadata such as IP address, user agent, timing, and referrer context with a third party, which breaks the local-only trust boundary and can also enable supply-chain risk if the CDN content is altered.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script writes a consolidated HTML file containing extracted session data to disk without an explicit privacy warning at runtime. Because the report aggregates potentially sensitive local session metadata and contents into a portable artifact, it increases the risk of unintended disclosure through filesystem access, backups, syncing, or later sharing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script enumerates local session logs from Claude, Codex, and Kimi under the user's home directory and prints sampled shell commands, search queries, file paths, project names, token usage, and error strings directly to stdout. These artifacts can contain sensitive source paths, internal project names, secrets typed into shells, proprietary search terms, or other confidential workflow metadata, and the skill description explicitly encourages analysis of such local session data, which increases the likelihood of exposing private information during normal use.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The top-level docstring states the tool does only extraction with no interpretation, yet the code aggregates, ranks, compares, and summarizes usage across tools, projects, and recent activity. Those operations are analytical interpretations of the raw session data rather than mere extraction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

Automatically opening the generated report in a browser can expose sensitive session data on screen immediately and triggers execution of the HTML context without a final user confirmation. In this file, that risk is compounded by the remote Chart.js dependency, meaning the auto-open also causes network access the user may not expect.

Content

No source excerpt is available for this finding.