Back to skill

Security audit

Vercel Ai Sdk

Security checks for vulnerabilities and agentic risk

Overview

This is a documentation-only Vercel AI SDK skill, but several examples normalize sensitive tool execution and chat persistence without enough user control or validation.

Review this skill before installing or using it as implementation guidance. It is not an executable malware-like package, but developers should add explicit consent for location or other sensitive client tools, restrict automatic tool execution to low-risk actions, validate and authorize chat persistence, minimize file/message data sent to servers or model providers, and avoid copying the complete examples unchanged for production.

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/streaming.md:712
Finding

Unvalidated Client-Controlled Chat Messages Persisted to Storage

Content
View full analysis
{ if (part.type === 'start') { return { createdAt: Date.now() }; } }, onFinish: async ({ messages }) => { await saveChat(chatId, messages); } }); } ``` ### Technical Analysis The documented server route reads `messages` and `chatId` directly from attacker-controlled request JSON. It then passes the messages to `convertToModelMessages` and ultimately persists the conversation through `saveChat` without first calling `validateUIMessages` or applying equivalent strict schemas. This contradicts the Skill's own persistence gate in `SKILL.md:272-273`, which requires validation before client-supplied messages are written to storage. TypeScript types do not protect this runtime boundary because arbitrary HTTP clients can submit malformed objects, unsupported message parts, forged metadata, oversized content, or unexpected tool and data structures. The audit cannot determine whether `saveChat` independently performs validation or authorization because its ...[truncated 1822 chars]
Remediation
View remediation
{ const messagesToSave = await validateUIMessages({ messages, tools, metadataSchema, dataSchemas }); await saveChat(body.chatId, currentUser.id, messagesToSave); } }); } ``` ]]>
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 (11)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **[tools.md](references/tools.md)**: Tool definition and execution patterns

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The skill explicitly promotes file attachments and custom transport request shaping, but it does not warn that user files, message history, metadata, and arbitrary request bodies may be transmitted to backend routes or third-party model providers. In a code-assistance skill, this omission can lead developers to implement data flows that unintentionally send sensitive content off-device or persist it without consent, especially because the examples normalize sending full messages and files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file includes server-side examples that read user-provided messages and send them to openai('gpt-4') via streamText, which implies network transmission of user conversation data to an external model provider. The document presents this as a basic setup but does not include any warning or disclosure about sending user content off-box or to a third party.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The client-side tool example instructs handling a getLocation tool call by invoking getCurrentLocation(), which accesses sensitive user location information. The surrounding documentation does not warn that this behavior requires clear user disclosure and consent before collecting or transmitting location data.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/tools.md (reported line 310)May include surrounding context.

md
↓
2. input-available
   ↓
3a. [No approval needed] → output-available
   OR
3b. approval-requested → approval-responded → output-available/output-denied
   OR

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The example defines a client-side tool with requiresApproval: true but then auto-executes it in onToolCall and submits output immediately, which teaches an implementation pattern that can bypass or undermine the approval gate. In a real app, developers may copy this pattern and perform sensitive actions before the user has explicitly approved them, defeating the purpose of the approval flow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The example retrieves the user's location automatically in response to a tool call, without an explicit in-app warning or confirmation step in the sample flow. Although browser permissions may still apply, the documentation normalizes silent handling of privacy-sensitive data and may lead developers to omit clear user consent UX around location sharing.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/use-chat.md (reported line 101)May include surrounding context.

typescript
interface UseChatOptions<UI_MESSAGE extends UIMessage> {
  // Automatically send messages when condition is met
  sendAutomaticallyWhen?: (options: {
    messages: UI_MESSAGE[];
  }) => boolean | PromiseLike<boolean>;

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation explicitly recommends automatic client-side tool execution in onToolCall and labels it as 'Important' for automatic execution, but it does not pair that guidance with warnings about consent, privacy exposure, capability scoping, or side effects. In this skill context, developers may copy the example and wire model-issued tool calls directly to sensitive browser or local capabilities, creating a realistic path to prompt-driven actions without adequate user approval.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

The example shows a tool named autoExecute being run automatically in response to a model tool call, with no approval, validation, or discussion of side effects. In a chat SDK context this is dangerous because developers often reuse example code, and the pattern normalizes model-directed autonomous execution that could be extended to local, browser, or network-affecting actions.

Content

Scanner excerpt · references/use-chat.md (reported line 512)May include surrounding context.

md
function ChatWithTools() {
  const { messages, addToolOutput } = useChat<MyToolMessage>({
    onToolCall: async ({ toolCall }) => {
      if (toolCall.toolName === 'autoExecute') {
        const result = await executeAutomatically();
        addToolOutput({
          tool: 'autoExecute',

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/use-chat.md (reported line 515)May include surrounding context.

md
if (toolCall.toolName === 'autoExecute') {
        const result = await executeAutomatically();
        addToolOutput({
          tool: 'autoExecute',
          toolCallId: toolCall.toolCallId,
          output: result
        });

Static analysis

No suspicious patterns detected.