Summary
FastGPT contains an insecure direct object reference issue where S3 object keys from client requests are used without verifying tenant ownership.
Under certain multi-tenant configurations, this can allow an attacker to access other teams' files via chat-file presign and dataset preview endpoints.
Affected context
This vulnerability occurs in FastGPT deployments using a shared S3 bucket for multiple tenants or teams.
The affected file handlers authorize access based on an unrelated resource and then operate on S3 objects using keys taken directly from the request.
Because S3 keys are globally scoped within the bucket and include tenant identifiers only as path segments, object access is not inherently restricted to the caller's team.
Exploit preconditions
- Attack surface: HTTP APIs exposing chat-file presign and dataset preview functionality
- Required access: Ability to send authenticated or semi-authenticated requests to FastGPT's file handling endpoints
- Trigger point: Supplying an S3 object key associated with another team in the request parameters
- Why exploitation is possible: The handlers validate access to a different resource but do not enforce that the provided S3 key belongs to the caller's tenant, enabling cross-tenant direct object references
Why this happens
The core issue is an access control design flaw where authorization is not tightly bound to the specific object being accessed.
Instead of deriving or validating the S3 key from the authenticated tenant context, the application trusts a client-supplied key and assumes the earlier authorization check is sufficient.
This maps to CWE-639: Insecure Direct Object Reference (IDOR), where a user-controlled identifier is used to access resources without ensuring that the user is authorized for that exact resource.
Potential impact
- An attacker may read files belonging to another team or tenant stored in the shared S3 bucket.
- Sensitive dataset previews could be accessed by unauthorized users.
- Chat-related file contents can be exposed, including proprietary or confidential information.
- Multi-tenant isolation can be broken, leading to regulatory and compliance issues.
General mitigation guidance
Effective mitigation focuses on binding authorization checks to the specific resource being accessed and eliminating trust in client-supplied identifiers.
Recommended patterns include:
- Deriving storage keys from the authenticated tenant or team context rather than taking them directly from requests.
- Validating that any provided object key is owned by, or scoped to, the caller's tenant before signing or reading it.
- Using per-tenant buckets, prefixes, or access policies so that cross-tenant keys cannot be referenced.
- Treating all incoming identifiers as untrusted and enforcing strict authorization rules at the object level.
How teams detect issues like this
Detection commonly involves:
- Static analysis or security review to locate code paths where user-controlled identifiers are passed to storage APIs or presign operations without tenant ownership checks.
- Reviewing controller and handler logic for mismatches between the resource being authorized and the resource actually accessed (e.g., separate IDs for auth and S3 operations).
- Applying policy-based checks that require object-level authorization for any file access in multi-tenant contexts.
- Leveraging automated code scanning tools configured with rules for IDOR patterns and insecure resource key usage.

