Summary
Cap's /api/video/ai endpoint returns private AI metadata for arbitrary video IDs without verifying that the caller owns or can access the referenced video.
Under normal authenticated use this endpoint should only expose AI content for videos the user is permitted to manage, but an attacker can abuse it to read sensitive metadata and consume another user's AI credits.
Affected context
This vulnerability occurs in Cap's backend where the GET /api/video/ai endpoint exposes AI-generated metadata for videos.
The issue manifests when the system relies solely on authentication (a valid session or token) and does not enforce per-video authorization checks such as ownership or membership verification.
It is most relevant in deployments where multiple users share a common API surface and where AI credit usage is tied to individual video owners.
Exploit preconditions
- Attack surface: HTTP API endpoint GET /api/video/ai exposed to authenticated users
- Required access: Any valid user account or API token; no special privileges required
- Trigger point: Supplying arbitrary or enumerated video IDs as request parameters to the AI metadata endpoint
- Why exploitation is possible: The backend trusts the caller's authentication status and does not verify that the caller is authorized to access the requested video or spend the owner's AI credits
Why this happens
The underlying bug is a missing authorization check on a resource-specific API, mapping directly to CWE-862: Missing Authorization.
The endpoint correctly requires authentication but fails to enforce resource-level access control, such as confirming that the requesting principal owns the video or belongs to an allowed group.
This insecure pattern treats a user's authenticated identity as sufficient for all operations, rather than applying fine-grained authorization policies per video and per credit-consuming action.
Potential impact
- Attackers may read private AI-generated titles, summaries, and chapter metadata for videos they do not own.
- Attackers can trigger unauthorized AI generation that consumes another user's credits.
- Sensitive business or personal information embedded in AI summaries could be exposed.
- Service providers may experience billing disputes or trust erosion due to unauthorized credit usage.
- Lateral privacy violations can occur across tenant boundaries in multi-user or multi-tenant environments.
General mitigation guidance
Effective mitigation focuses on enforcing robust authorization at the resource level and aligning API behavior with least-privilege principles.
Common defensive patterns include:
- Implementing ownership and membership checks for every video-related endpoint, ensuring that only authorized principals can access or modify a given video's AI data.
- Centralizing authorization logic in a reusable access control layer, instead of relying on ad-hoc checks inside individual handlers.
- Designing APIs so that identifiers are scoped (e.g., user- or tenant-scoped IDs) and cannot be freely enumerated across accounts.
- Separating credit-spending operations from read-only metadata retrieval, and requiring explicit, authorized consent paths before AI processing consumes credits.
- Logging authorization decisions and denied requests to support auditing and anomaly detection.
How teams detect issues like this
Detection typically involves a combination of design review, code analysis, and runtime monitoring:
- Static analysis or manual review to ensure every protected resource access path includes explicit authorization checks tied to the requesting principal and resource.
- Architectural review for APIs that accept raw resource IDs from clients, flagging endpoints that rely only on authentication without ownership or role validation.
- Policy enforcement via API gateways or middleware that require declared authorization policies (e.g., role-based or attribute-based) for each route.
- Runtime monitoring and logging to identify suspicious access patterns, such as a single user requesting AI metadata for many distinct video IDs they do not own.
- Periodic security testing, including authorization-focused test cases, to validate that private metadata and credit usage cannot be triggered by unauthorized accounts.

