VDB
KO
MEDIUM 6.8

GHSA-h7p7-w5gc-xj3w

Pydantic AI: Unvalidated UploadedFile references in UI adapters allow server-side file access using the application's credentials

Quick fix

GHSA-h7p7-w5gc-xj3w — pydantic-ai-slim: upgrade to the fixed version with the command below.

pip install --upgrade 'pydantic-ai-slim>=1.106.0'

Details

### Summary

A client that can submit message history to a Pydantic AI UI adapter can reference arbitrary files in the application's model-provider or cloud-storage account. The server forwards the reference to the model provider, which fetches it using the server's own credentials, allowing the client to read files it should not have access to.

### Details

UI adapters reconstruct file parts from client-submitted message history and forward them to the model provider. File **URL** parts are validated against a scheme allowlist before being forwarded, but `UploadedFile` references — which point to a file by provider file ID or cloud-storage URI (e.g. `s3://…`, `gs://…`) — were forwarded without validation.

Because the provider resolves an `UploadedFile` using the server-side identity (IAM role, service account, or provider API key) rather than the client's, a client that crafts message history containing an attacker-chosen `UploadedFile` can cause the server to read objects belonging to its own account or to other tenants, given a referenceable identifier.

### Impact

Applications that pass untrusted client-submitted message history to an agent through a UI adapter (such as the Vercel AI adapter). Exploitation requires the attacker to reference a valid file identifier; depending on how the application names objects, such identifiers are not always unguessable.

### Patches

Upgrade to `1.106.0` (1.x) or `2.0.0b6` (the 2.x beta line), which validate `UploadedFile` references on client-submitted messages the same way file URLs are validated.

### Workarounds

If users cannot upgrade, do not pass untrusted client-submitted message history to the agent, or strip `UploadedFile` parts from incoming messages before running the agent.

Are you affected?

Enter the version of the package you're using.

Affected packages

PyPI / pydantic-ai-slim
Introduced in: 1.65.0 Fixed in: 1.106.0
Fix pip install --upgrade 'pydantic-ai-slim>=1.106.0'
PyPI / pydantic-ai-slim
Introduced in: 2.0.0b1 Fixed in: 2.0.0b6
Fix pip install --upgrade 'pydantic-ai-slim>=2.0.0b6'
PyPI / pydantic-ai
Introduced in: 1.65.0 Fixed in: 1.106.0
Fix pip install --upgrade 'pydantic-ai>=1.106.0'
PyPI / pydantic-ai
Introduced in: 2.0.0b1 Fixed in: 2.0.0b6
Fix pip install --upgrade 'pydantic-ai>=2.0.0b6'

References