Back to skill

Security audit

Upstage Schema Generation

Security checks for vulnerabilities and agentic risk

Overview

The skill fits its stated document-schema purpose, but its default workflow can upload whole documents to Upstage without a clear consent step.

Install only if you are comfortable with document contents being read and, in default API mode, sent to Upstage using your UPSTAGE_API_KEY. For confidential, regulated, or customer documents, require explicit approval before upload, set file/page limits, and prefer a local/manual or carefully scoped VLM workflow when possible.

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

Unconfirmed Third-Party Disclosure of Complete Document Contents

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 15-53
Vulnerability Type: External transmission of potentially sensitive document data without an explicit consent requirement
Risk Level: Medium

The Skill makes API mode the default and provides code that reads an entire document, Base64-encodes it, and sends it to the Upstage API:

python
## Two Modes

| Mode | When to use | Latency |
|------|-------------|---------|
| **API mode** | Default. Fast schema generation via Upstage endpoint. | Low |
| **VLM mode** (`claude-opus-4-6`) | When the user wants careful, hand-tuned schemas with precise extraction rules and table-aware design. | High |

## API Mode (Default)

**Endpoint**: `POST https://api.upstage.ai/v1/information-extraction/schema-generation`

```python
import os
import json
import requests
import base64

api_key = os.environ["UPSTAGE_API_KEY"]

with open("document.pdf", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://api.upstage.ai/v1/information-extraction/schema-generation",
    headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
    json={
        "model": "information-extract",
        "messages": [
            {"role": "system", "content": "Generate schema for this invoice document."},
            {"role": "user", "content": [
                {"type": "image_url", "image_url": {"url": f"data:application/pdf;base64,{b64}"}}
            ]}
        ]
    }
)

schema = json.loads(response.json()["choices"][0]["message"]["content"])
print(json.dumps(schema, indent=2))
text

### Technical Analysis

The implementation reads every byte of the selected document and places the resulting Base64 data in an outbound HTTPS request. Base64 is transport encoding, not encryption or redaction; the receiving service can reconstruct the complete original document.

Transmission to `
...[truncated 2265 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit user confirmation before transmitting any source document to an external API. State the destination, the exact data being sent, and that Base64 does not protect document confidentiality.
  2. Offer local or VLM processing as the preferred option for confidential documents rather than making external API processing unconditional by default.
  3. Apply data minimization by sending only representative pages or document regions needed for schema design.
  4. Add optional redaction for identifiers, account numbers, signatures, addresses, and other sensitive fields before transmission.
  5. Validate allowed file types and enforce reasonable file-size and page-count limits.
  6. Document the external provider's retention, logging, training, residency, and deletion policies so users can make an informed decision.
  7. Avoid logging request bodies, Base64 payloads, authorization headers, or document contents.
  8. Keep the API key in environment-backed secret storage, scope it to the minimum required API operations, and ensure it is never included in generated output or diagnostic messages.
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)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger language is broad enough to activate on generic requests about defining document fields or schemas, including when users provide file paths or folders. In an agent environment, this can cause unintended invocation on sensitive documents and lead to downstream processing or upload without the user's informed consent.

Content

No source excerpt is available for this finding.

External Model or Provider Selection

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

Skill selects an external model or provider that may use a different account or billing plan than the operator expects. Undisclosed model switches can cause unexpected cost or quota consumption.

Content

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

md
---
name: upstage-schema-generation
description: Generate a JSON schema for structured document information extraction. Use this skill whenever the user asks to generate or create a schema for a document — including phrases like "스키마 생성해줘", "이 문서에서 뭘 추출할지 스키마 짜줘", "generate a schema for this document", or any request to define extraction fields for a document. Also trigger when the user provides file paths or a folder path containing documents and wants a schema generated.
model: claude-opus-4-6
---

# Upstage Schema Generation

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill presents API mode as the default and includes code that base64-encodes entire documents and sends them to a third-party endpoint, but it does not explicitly warn that document contents leave the local environment. This creates a meaningful data-handling and privacy risk, especially for sensitive or regulated documents, because users may not understand that invoking the skill transmits the source files externally.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

Declaring the external API endpoint in the skill documentation signals that the workflow depends on a third-party service and therefore on external data transmission. While merely listing the endpoint is less severe than executable upload code, it contributes to a risky design when paired with broad triggers and missing privacy disclosures.

Content

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

API Mode (Default)

Endpoint: POST https://api.upstage.ai/v1/information-extraction/schema-generation

python
import os

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

The sample implementation initiates an external HTTPS request carrying document-derived content and credentials, which is a real external transmission path. In the context of an agent skill that may activate on user-provided files, this becomes dangerous when the user is not clearly informed that local documents will be uploaded to a remote provider.

Content

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

md
with open("document.pdf", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://api.upstage.ai/v1/information-extraction/schema-generation",
    headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

The sample implementation initiates an external HTTPS request carrying document-derived content and credentials, which is a real external transmission path. In the context of an agent skill that may activate on user-provided files, this becomes dangerous when the user is not clearly informed that local documents will be uploaded to a remote provider.

Content

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

md
with open("document.pdf", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://api.upstage.ai/v1/information-extraction/schema-generation",
    headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
    json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This line identifies the concrete remote destination for document uploads, confirming that content is sent to an external provider. In context, the risk is not the hostname itself but the unqualified data flow to a third party without clear consent and disclosure safeguards in the skill instructions.

Content

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

md
b64 = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://api.upstage.ai/v1/information-extraction/schema-generation",
    headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
    json={
        "model": "information-extract",

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The workflow explicitly instructs the agent to decide autonomously how many files and pages to examine, but it does not require a clear user-facing warning or confirmation about the breadth of access. In a document-processing skill, this can cause over-collection of local or workspace data beyond what the user reasonably expects, increasing privacy and data-minimization risks.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.