Back to skill

Security audit

Codex Imagen

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent image-generation purpose, but it can send locally discovered OAuth tokens and user image data to caller-controlled endpoints without strong safeguards.

Install only if you trust the publisher and will run it in a controlled environment. Avoid custom --base-url, --refresh-url, and CODEX_REFRESH_TOKEN_URL_OVERRIDE values unless you fully trust the endpoint, and do not pass sensitive local images or prompts without understanding they are uploaded to the configured backend.

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
scripts/codex-imagen.mjs:1423
Finding

Unrestricted Endpoint Overrides Can Exfiltrate OAuth Credentials

Content
View full analysis
abortController.abort(), OAUTH_REFRESH_CALL_TIMEOUT_MS); try { return await fetch(options.refreshUrl, { method: "POST", headers: buildRefreshHeaders(), body: JSON.stringify({ client_id: CODEX_OAUTH_CLIENT_ID, grant_type: "refresh_token", refresh_token: refreshToken, }), signal: abortController.signal, }); ``` T ...[truncated 3875 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (18)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · CHANGELOG.md (reported line 17)May include surrounding context.

md
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.mjs (reported line 941)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.mjs (reported line 1022)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.mjs (reported line 1023)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.mjs (reported line 1313)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.mjs (reported line 1589)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.mjs (reported line 1590)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.test.mjs (reported line 212)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.test.mjs (reported line 224)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.test.mjs (reported line 316)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.test.mjs (reported line 375)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.test.mjs (reported line 440)May include surrounding context.

js
### Fixed

- Recover from `refresh_token_reused` before asking the user to sign in again: continue with a still-valid access token for proactive refresh failures, or retry once when another process rotated the stored refresh token but left the selected profile stale.

## [0.2.3] - 2026-04-23

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/codex-imagen.test.mjs (reported line 57)May include surrounding context.

js
async function runCli(args, env = {}) {
  const child = spawn(process.execPath, [scriptPath, ...args], {
    cwd: path.resolve("."),
    env: { ...process.env, ...env },
  });
  let stdout = "";
  let stderr = "";

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill explicitly describes capabilities that read local auth files, perform outbound network requests, and invoke Node/shell execution, yet it declares no tool scope or permission boundary in the skill manifest. In an agent environment, that omission weakens reviewability and policy enforcement, making it easier for a caller to invoke credential-bearing and networked behavior without an explicit consent/allowlist signal.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill states that it uses OAuth credentials stored on the machine and calls remote backend endpoints, but it does not present this as a prominent security warning to operators. That can lead users or higher-level agents to transmit bearer tokens to external services without informed consent, increasing the chance of unintended credential use or policy violations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The reference-image section explains that local images are converted to base64 data URLs and sent as input_image items, but it does not foreground the privacy and data-transfer implications. Users may unknowingly upload sensitive local image contents or embedded metadata to an external service, especially in automated agent workflows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This script reads local prompts and reference images, then transmits them to remote endpoints (baseUrl and potentially refreshUrl) without any clear user-facing consent or warning at execution time. In a skill/agent context, prompts and local images may contain sensitive data, so silent exfiltration to a network service is a real privacy and data-handling risk.

Content

No source excerpt is available for this finding.