Back to skill

Security audit

Chatgpt Consultation

Security checks for vulnerabilities and agentic risk

Overview

This skill is meant to consult ChatGPT, but it can automatically send user questions through an existing browser session and contains an unsafe shell command path that could execute unintended local commands.

Review carefully before installing. Only use this with non-sensitive prompts, because matching questions may be sent to ChatGPT through your existing browser session. Do not run it in a privileged workspace until the shell invocation is fixed, missing dependencies are supplied, and explicit consent/redaction controls are added.

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

Error
Location
agent.js:83
Finding
OS Command Injection Through an Unsafely Constructed Shell Command## Vulnerability Details **File Location**: `agent.js`, lines 83–90 **Vulnerability Type**: OS command injection **Risk Level**: High ### Vulnerable Code ```js // Prepare prompt const prompt = this.formatPrompt(question, category); // Execute consultation const result = execSync( `node scripts/auto_chatgpt.js "${prompt}"`, { encoding: 'utf8', timeout: 30000 } ); ``` ### Technical Analysis The `question` value originates from command-line arguments: ```js const question = process.argv.slice(2).join(' '); ``` It is passed to `formatPrompt()`, which embeds it into a prompt without escaping or validation. The resulting `prompt` is then interpolated directly into a command string passed to `child_process.execSync()`. `execSync()` executes command strings through a shell. Wrapping the value in double quotes does not make it safe because an attacker can supply a double quote to terminate the quoted argument and then append shell metacharacters and commands. Consultation-trigger checks do not sanitize the input or prevent shell syntax. ### Attack Path 1. An attacker supplies a command-line question containing a recognized consultation trigger and a shell payload. A conceptual input is: ```text 咨询chatgpt"; <attacker-command>; # ``` 2. `process.argv.slice(2).join(' ')` stores the complete attacker-controlled value in `question`. 3. `shouldConsultGPT()` recognizes the consultation phrase and allows execution to continue. 4. `formatPrompt()` incorporates the malicious question into `prompt` unchanged. 5. The interpolation in `execSync()` places the payload inside a shell command. 6. The injected double quote closes the intended argument, shell metacharacters introduce another command, and the trailing comment marker can suppress the remaining generated text. 7. The shell executes the attacker-supplied command with the privileges of the Node.js Agent process. Exploitation requires the code to reach `consultChatGPT()` and its expected externa ...[truncated 949 chars]
Remediation
## Remediation Suggestions Do not construct a shell command by concatenating or interpolating user-controlled data. Invoke the executable with a separate argument array and disable shell processing. For example: ```js const { execFileSync } = require('child_process'); const path = require('path'); const scriptPath = path.join(__dirname, 'scripts', 'auto_chatgpt.js'); const result = execFileSync( process.execPath, [scriptPath, prompt], { encoding: 'utf8', timeout: 30000, shell: false } ); ``` Additional hardening measures should include: 1. Resolve the script from a trusted absolute path rather than relying on the current working directory. 2. Apply reasonable input and prompt length limits to reduce resource-exhaustion risks. 3. Validate that the prompt contains expected text data, while treating validation only as defense in depth rather than a replacement for argument-array execution. 4. Run the Agent under a dedicated, least-privileged operating-system account. 5. Restrict access to sensitive files, credentials, and browser profiles not required by the task. 6. Add automated tests containing quotes, command substitutions, pipes, semicolons, redirections, and newline characters to verify that all input is passed as one literal argument. 7. Avoid attempts to fix this issue solely with manual shell escaping, because escaping behavior differs across shells and operating systems.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Missing User Warnings

High
Confidence
98% confidence
Finding
The skill description says it will consult ChatGPT but does not clearly warn that user content may be transmitted to an external service through the browser and an existing logged-in session. This undermines informed consent and can expose sensitive prompts, credentials, business data, or personal information to a third party without the user's clear understanding.

Ssd 3

Medium
Confidence
96% confidence
Finding
The skill explicitly routes user questions to an external ChatGPT session in the user's browser, creating a direct natural-language exfiltration path. Without strict minimization, consent boundaries, and content filtering, sensitive conversation data can be disclosed to the external service or exposed within the browser session context.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The automatic trigger conditions are broad and subjective, such as when a problem is 'out of scope' or 'cannot be solved', which can cause the skill to invoke an external service without clear user intent. In this skill, that broad activation is especially risky because activation results in sending user queries through a browser-backed ChatGPT session, potentially disclosing sensitive content unexpectedly.

Ssd 3

Medium
Confidence
90% confidence
Finding
The suggestion to support multi-turn conversation context would increase the amount of prior dialogue forwarded to the external assistant, magnifying the risk of leaking earlier sensitive inputs that the user did not intend to share. In a skill already designed for browser-mediated external consultation, accumulated context makes over-sharing much more likely and harder for users to audit.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
User-facing comments, trigger phrases, notices, usage text, and generated prompts are all fixed in Chinese, and the activation logic depends on Chinese-language phrases and patterns. This creates a locale constraint without any opt-in or documented justification, which matches the language/locale policy violation category.

Context-Inappropriate Capability

Medium
Confidence
89% confidence
Finding
The skill invokes local shell commands via execSync to start a browser and run a secondary script, which gives it broader system-side effects than a simple consultation helper needs. While the specific commands are mostly hardcoded, this still increases attack surface and can enable unintended local command execution paths or unsafe privilege use if the environment, PATH, or called scripts are compromised.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill forwards the user's question to an external ChatGPT automation flow without a clear, explicit notice that their input will leave the local agent context. This can expose sensitive data contained in prompts, especially because the trigger logic may automatically decide to consult ChatGPT for certain categories of questions.

Vague Triggers

Low
Confidence
88% confidence
Finding
The manual trigger list uses open-ended wording like '等关键词' and includes indirect cues such as '@browser', leaving scope unclear and making accidental invocation more likely. Because the skill is designed to bridge to an external ChatGPT session, ambiguous trigger phrases can lead to unintended data sharing or tool use beyond what the user expected.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
agent.js:80