Back to skill

Security audit

api-designer

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward API design helper; its network and credential examples are expected for generated API clients but should be reviewed before reuse.

Install only if you want an assistant that drafts API specifications and client SDK patterns. Review generated client code before production use, especially authentication handling, retry limits, token refresh, and where API keys or bearer tokens are sent.

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
references/examples.md:770
Finding

Unbounded Retry Loop on HTTP 401 Responses

Content
View full analysis

Vulnerability Details

File Location: references/examples.md, lines 770-779
Vulnerability Type: Unbounded authentication retry
Risk Level: Medium

Vulnerable Code

typescript
this.client.interceptors.response.use(
  (response) => response,
  async (error) => {
    if (error.response?.status === 401) {
      // Handle token refresh
      await this.refreshToken();
      return this.client.request(error.config);
    }
    return Promise.reject(error);
  }
);

The referenced token-refresh method is an unimplemented stub:

typescript
private async refreshToken(): Promise<void> {
  // Implement token refresh logic
}

Technical Analysis

The generated Axios client retries every request that receives an HTTP 401 response. The request configuration does not contain a retry marker or attempt counter, and there is no maximum retry limit. The refreshToken() method is also an empty stub, so it does not update the credentials before the original request is replayed.

Because the replayed request passes through the same response interceptor, another 401 response triggers the same logic again. This creates an unbounded asynchronous request loop whenever authentication cannot be restored.

Attack Path

  1. An application uses a client generated from this example.
  2. The client sends an authenticated request to an API.
  3. The API, an unavailable authentication service, or an attacker-controlled endpoint returns HTTP 401.
  4. The response interceptor calls the no-op refreshToken() method.
  5. The interceptor replays the original request without changing its invalid credentials.
  6. The server returns HTTP 401 again.
  7. Steps 4 through 6 repeat indefinitely because no retry limit or retry marker is present.

Impact Assessment

Exploitation does not directly grant additional privileges or access to protected data. However, a persistent or attacker-induced 401 ...[truncated 552 chars]

Remediation
View remediation

Remediation Suggestions

  • Add a private retry marker to the Axios request configuration and permit at most one replay after a 401 response.
  • Reject the request immediately if it has already been retried.
  • Implement refreshToken() so that it either installs a valid replacement token or throws a handled authentication error.
  • Never invoke refresh-and-retry logic for the token-refresh endpoint itself.
  • Clear credentials and propagate an authentication failure when refresh fails.
  • Deduplicate concurrent refresh attempts so multiple 401 responses do not create a refresh-request storm.
  • Add tests covering persistent 401 responses, failed refreshes, refresh-endpoint 401 responses, and concurrent authentication failures.

A guarded implementation can use logic equivalent to:

typescript
const originalRequest = error.config;

if (error.response?.status === 401 && !originalRequest._retry) {
  originalRequest._retry = true;

  try {
    await this.refreshToken();
    return this.client.request(originalRequest);
  } catch (refreshError) {
    return Promise.reject(refreshError);
  }
}

return Promise.reject(error);
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> 📎 **Code example 1** (typescript) — see [references/examples.md](references/examples.md)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> 📎 **Code example 1** (typescript) — see [references/examples.md](references/examples.md)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file embeds TypeScript example code that creates an Axios client, attaches API keys and bearer tokens to request headers, and sends outbound HTTP requests. Although comments describe implementation details, there is no user-facing warning in the surrounding markdown that the generated client will transmit credentials and request metadata over the network.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
references/examples.md:21