Summary
ChatOllama contains an insecure direct object reference vulnerability that may let remote attackers access private knowledge bases belonging to other users. By supplying sequential knowledge-base identifiers through exposed API endpoints, an attacker could retrieve metadata and document content when authorization checks do not verify ownership.
ChatOllama contains an insecure direct object reference vulnerability that may let remote attackers access private knowledge bases belonging to other users. By supplying sequential knowledge-base identifiers through exposed API endpoints, an attacker could retrieve metadata and document content when authorization checks do not verify ownership.
Affected context
The issue occurs in ChatOllama API workflows that retrieve knowledge bases by numeric or otherwise predictable identifiers. It becomes risky when the application accepts a caller-supplied identifier through GET /api/knowledgebases/{id} or the knowledgebaseId parameter of POST /api/models/chat without consistently checking whether the requesting user is authorized to access the referenced resource.
The issue occurs in ChatOllama API workflows that retrieve knowledge bases by numeric or otherwise predictable identifiers. It becomes risky when the application accepts a caller-supplied identifier through GET /api/knowledgebases/{id} or the knowledgebaseId parameter of POST /api/models/chat without consistently checking whether the requesting user is authorized to access the referenced resource.
Exploit preconditions
- Attack surface: Network-accessible ChatOllama knowledge-base API endpoints
- Required access: Ability to send requests to the affected API; authentication requirements depend on deployment configuration
- Trigger point: Supplying a knowledge-base identifier in the path or request parameter
- Why exploitation is possible: Identifiers may be predictable or sequential, while object-level authorization does not adequately bind the requested resource to the requesting user
- Attack surface: Network-accessible ChatOllama knowledge-base API endpoints
- Required access: Ability to send requests to the affected API; authentication requirements depend on deployment configuration
- Trigger point: Supplying a knowledge-base identifier in the path or request parameter
- Why exploitation is possible: Identifiers may be predictable or sequential, while object-level authorization does not adequately bind the requested resource to the requesting user
Why this happens
The underlying flaw is an object-level authorization failure. The application uses a client-provided knowledge-base identifier to retrieve a resource but does not reliably verify that the caller owns or is permitted to access that resource.
This behavior maps to CWE-639: Authorization Bypass Through User-Controlled Key, commonly known as an insecure direct object reference. Predictable identifiers increase the risk because attackers can test references associated with other users.
The underlying flaw is an object-level authorization failure. The application uses a client-provided knowledge-base identifier to retrieve a resource but does not reliably verify that the caller owns or is permitted to access that resource.
This behavior maps to CWE-639: Authorization Bypass Through User-Controlled Key, commonly known as an insecure direct object reference. Predictable identifiers increase the risk because attackers can test references associated with other users.
Potential impact
- Attackers may read private knowledge-base metadata
- Retrieved document content could be disclosed
- Confidential business or personal information may be exposed
- Unauthorized users could map resource identifiers and tenant activity
- Downstream applications may process or reveal compromised knowledge-base data
- Attackers may read private knowledge-base metadata
- Retrieved document content could be disclosed
- Confidential business or personal information may be exposed
- Unauthorized users could map resource identifiers and tenant activity
- Downstream applications may process or reveal compromised knowledge-base data
General mitigation guidance
Mitigation typically focuses on enforcing object-level authorization at every resource access point.
Common defensive patterns include:
- Verify ownership or explicit access rights for every requested knowledge base
- Derive the caller identity from a trusted session or token rather than request data
- Use authorization checks consistently across direct retrieval and chat-related code paths
- Prefer opaque, non-sequential identifiers as defense in depth, without treating them as authorization
- Return indistinguishable responses for unauthorized and nonexistent resources where appropriate
- Apply least-privilege access controls and tenant isolation around stored documents
- Limit response data to the minimum required by the caller
Mitigation typically focuses on enforcing object-level authorization at every resource access point.
Common defensive patterns include:
- Verify ownership or explicit access rights for every requested knowledge base
- Derive the caller identity from a trusted session or token rather than request data
- Use authorization checks consistently across direct retrieval and chat-related code paths
- Prefer opaque, non-sequential identifiers as defense in depth, without treating them as authorization
- Return indistinguishable responses for unauthorized and nonexistent resources where appropriate
- Apply least-privilege access controls and tenant isolation around stored documents
- Limit response data to the minimum required by the caller
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis and code review of handlers that use request identifiers in database or storage lookups
- Review signals such as missing ownership predicates, authorization checks performed after retrieval, or shared lookup helpers without caller context
- API tests that request resources belonging to different users and verify consistent denial
- Monitoring for sequential or high-volume identifier enumeration across knowledge-base endpoints
- Policy enforcement requiring object-level authorization tests for every resource-oriented API
- Automated security review tools that identify user-controlled keys used without authorization constraints
Organizations can look for this weakness through:
- Static analysis and code review of handlers that use request identifiers in database or storage lookups
- Review signals such as missing ownership predicates, authorization checks performed after retrieval, or shared lookup helpers without caller context
- API tests that request resources belonging to different users and verify consistent denial
- Monitoring for sequential or high-volume identifier enumeration across knowledge-base endpoints
- Policy enforcement requiring object-level authorization tests for every resource-oriented API
- Automated security review tools that identify user-controlled keys used without authorization constraints

