Back to skill

Security audit

doubao-image-auto

Security checks for vulnerabilities and agentic risk

Overview

This skill needs review because it expands from browser automation into automatically reusing a saved Doubao login session for API calls without clear scoping or user control.

Review this carefully before installing. The browser-only workflow is understandable for image generation, but the no-browser API mode reuses a saved Doubao session cookie and references scripts not included in the artifact; only use it if you understand which account session is being used, where files will be written, and how to revoke or refresh that session.

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
SKILL.md:69
Finding

JavaScript Injection Through Unsafe Prompt Interpolation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 69–80
Vulnerability Type: JavaScript injection in a CDP runtime expression
Risk Level: High

Vulnerable Code

javascript
// Input prompt
const prompt = '生成一只可爱的老虎头像,动漫风格';
await Runtime.evaluate({
  expression: `
    (function(){
      const ta = document.querySelector('textarea');
      if(!ta) return JSON.stringify({ok:false});
      ta.value = '${prompt}';
      ta.dispatchEvent(new Event('input', {bubbles:true}));
      return JSON.stringify({ok:true});
    })()
  `,
  returnByValue: true
});

Technical Analysis

The workflow constructs JavaScript source code for Runtime.evaluate by directly interpolating prompt into a single-quoted JavaScript string. No escaping, serialization, or separation between code and data is applied.

Although the documented example initializes prompt with a constant value, this value represents the image-generation prompt and would ordinarily be replaced with user-controlled input when the automation is used as intended. A prompt containing a single quote can terminate the ta.value string. Additional JavaScript can then be inserted into the expression evaluated through the Chrome DevTools Protocol.

Conceptually, an input shaped like the following demonstrates the injection boundary:

text
'; /* attacker-controlled JavaScript */ //

This transforms prompt data into executable code in the context of the authenticated Doubao page. The vulnerability is therefore not limited to malformed input or denial of service; it creates a browser-context code-execution primitive.

Attack Path

  1. An attacker supplies a crafted image-generation prompt to an application or agent implementing the documented workflow.
  2. The application assigns that untrusted input to prompt.
  3. The workflow inserts the prompt directly into the expression template literal as part of `ta.value = '${ ...[truncated 1223 chars]
Remediation
View remediation

Remediation Suggestions

  • Do not concatenate or interpolate untrusted prompt content into JavaScript source.
  • Pass the prompt as a CDP argument using Runtime.callFunctionOn, keeping executable code and untrusted data separate.
  • If an expression must be constructed, encode the value with JSON.stringify(prompt) rather than surrounding it manually with quotes.
  • Validate that the prompt is a string and impose a reasonable length limit before sending it to the browser.
  • Restrict CDP exposure to a trusted local interface and prevent untrusted processes from connecting to the remote-debugging port.
  • Add security tests containing quotes, backslashes, template-literal characters, newlines, and representative injection strings.

A safer serialization-based implementation is:

javascript
const serializedPrompt = JSON.stringify(prompt);

await Runtime.evaluate({
  expression: `
    (function(){
      const ta = document.querySelector('textarea');
      if (!ta) return JSON.stringify({ok:false});
      ta.value = ${serializedPrompt};
      ta.dispatchEvent(new Event('input', {bubbles:true}));
      return JSON.stringify({ok:true});
    })()
  `,
  returnByValue: true
});

Prefer a parameterized CDP call over source construction wherever the selected CDP API permits it.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (5)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill documentation materially expands from browser automation into a separate cookie-backed API workflow that reuses an authenticated local session file. This creates an undocumented credential-handling path that can silently perform authenticated actions outside the stated browser/CDP model, increasing the risk of session misuse, unintended account activity, and covert data access.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The documented cookie reuse mechanism reads a persisted Doubao session from a local file and uses it for automated API calls, which is sensitive credential reuse unrelated to the minimal needs of prompt entry and image extraction via browser automation. If abused, this can enable unauthorized account actions, session hijacking within the local environment, and stealthy authenticated requests without interactive login.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation claims the skill no longer needs a browser, contradicting the earlier design, dependencies, and operational model centered on CDP browser automation. This inconsistency obscures the true trust boundary and can mislead users into running a more privileged authenticated API flow than expected.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description fails to warn users that it reuses a persisted local session cookie for automated authenticated API calls. Even if intended for convenience, omitting this disclosure hides a significant security-relevant behavior involving credential material and authenticated access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description states that images are downloaded and saved locally, but it does not include any caution about filesystem impact, destination control, or overwriting/retention considerations. For markdown files, behaviors that affect user data or system state should include an explicit warning, not just a capability description.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.