Back to skill

Security audit

Cuihua Logger

Security checks for vulnerabilities and agentic risk

Overview

The skill does not show malicious installation or exfiltration behavior, but its logging templates and examples can cause private data to be written into application logs.

Review generated logging before use, especially in authentication, payment, user-profile, request-handling, or API code. Avoid raw arguments, request bodies, headers, tokens, cookies, passwords, full email addresses, and routine stack traces in production logs; prefer allowlisted metadata, redaction, retention limits, and access controls.

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

T09 ยท Insecure Skill Coding Practices

Warning
Location
logger.js:84
Finding

Generated Logging Exposes Unredacted Function Arguments and Stack Traces

Content
View full analysis

Vulnerability Details

File Location: logger.js, lines 84-108
Vulnerability Type: Sensitive data exposure through unsafe generated logging
Risk Level: Medium

Vulnerable Code

javascript
generateLogging(fn) {
  const { name, body } = fn;
  
  return `async function ${name}(...args) {
logger.info('${name} started', { args });
const startTime = Date.now();

try {
${body.trim().split('\n').map(line => '    ' + line).join('\n')}
  
  const duration = Date.now() - startTime;
  logger.info('${name} completed', { args, duration });
  
} catch (error) {
  const duration = Date.now() - startTime;
  logger.error('${name} failed', { 
    args, 
    duration,
    error: error.message,
    stack: error.stack 
  });
  throw error;
}
}`;
}

Technical Analysis

The generated instrumentation logs the complete args array when a function starts, completes, or fails. No allowlist, type restriction, field filtering, or secret redaction is applied.

Function arguments can contain passwords, API keys, authorization tokens, session cookies, payment information, personal data, request headers, request bodies, or entire application objects. Logging error.stack can additionally disclose internal filesystem paths and implementation details.

This behavior violates data-minimization principles and contradicts the guidance in SKILL.md stating that passwords and tokens must not be logged. Although the project itself does not implement a network transport, generated code can pass this information to an application's existing logger. Such loggers commonly persist data to files or forward it to external aggregation services.

Attack Path

  1. A user asks the Skill to add logging to an authentication, payment, account-management, or API-processing function.
  2. generateLogging() wraps the target function and inserts logging calls containing the complete args array.
  3. The instrumen ...[truncated 1274 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove complete argument logging. Do not emit { args } by default.
  2. Generate logs from an explicit allowlist of safe operational metadata, such as operation name, duration, result status, and non-sensitive identifiers.
  3. Implement recursive redaction for fields commonly containing secrets, including password, secret, token, authorization, cookie, apiKey, accessToken, refreshToken, and payment-related fields.
  4. Exclude request headers, request bodies, credentials, buffers, and arbitrary nested objects unless the user explicitly selects safe fields.
  5. Make stack-trace logging configurable and disable it in externally visible or production logs unless operationally required.
  6. Apply length and depth limits to logged values to reduce accidental disclosure and excessive log volume.
  7. Document that downstream logger transports may persist or transmit data and require users to review retention, access controls, and external aggregation settings.
  8. Add automated tests that pass representative passwords, tokens, cookies, and nested secrets through generated instrumentation and verify that none appear in output.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The description presents the skill as an AI-powered logging assistant that automatically adds structured logging to code. The supplied code instead behaves primarily as a static analysis/reporting CLI: it traverses directories, reads .js/.ts/.jsx/.tsx files, finds async functions, checks for existing logger/console usage, and outputs a logging coverage report. While there is a generateLogging() function that can produce wrapper code, the code chunk never applies those changes back to files or integrates them automatically. The implemented behavior is therefore materially different from the declared purpose, and it also performs undeclared filesystem scanning/reading as part of its main operation.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README uses broad natural-language invocation examples like "Add logging to getUserById function" and "Check logging coverage," which can overlap with ordinary user requests in unrelated contexts. This creates an invocation/scope ambiguity risk where the skill may activate unintentionally and influence agent behavior when a user is simply discussing logging, leading to unintended code modification or analysis actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The examples encourage logging personal data such as email addresses, user IDs, IP addresses, and potentially full request bodies without strong minimization guidance at the point of use. In real deployments, this can lead to privacy violations, data retention issues, and sensitive-data exposure through centralized logs, especially because users often copy examples directly into production code.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest describes an assistant that will 'Automatically add intelligent logging to your code,' but this implementation only scans source files, detects async functions, and outputs a report. Although logging snippets are generated as strings, they are never applied back to files or otherwise integrated into the target codebase.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generated logging template records raw function arguments and full error stack traces, which can capture secrets, tokens, PII, credentials, and internal implementation details. In a logging assistant, this is more dangerous because users are likely to paste or adopt the generated code broadly in production, amplifying accidental sensitive-data exposure across many code paths.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill promotes generating production-ready logging and shows file-based logger configuration, but does not clearly warn that logs may be persisted to disk or forwarded to external systems. That omission can cause users to underestimate the confidentiality and retention risks of whatever data they include in structured logs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation for generateLogging suggests operational behavior related to adding logging, but the function merely returns a string and is never used by the CLI or scanning workflow. This creates an intent mismatch between the documented purpose of the function and the actual effect of the program.

Content

No source excerpt is available for this finding.