Summary
migration-planner's agent-API middleware accepts JSON Web Tokens for authentication but does not verify that the source_id claim in the token matches the source ID in certain requests.
In this state, an authenticated agent can target other tenants' sources, potentially overwriting their inventory, injecting malicious credential URLs, or corrupting migration assessments, effectively breaking tenant isolation.
Affected context
The vulnerability appears in multi-tenant deployments of migration-planner where:
- Agents authenticate using JWTs issued for a specific source or tenant context.
- The agent-API exposes UpdateSourceInventory and UpdateAgentStatus handlers.
- Backend logic trusts the source_id claim in the JWT for scoping but does not cross-check it with the source ID referenced in the API request path or payload.
Under these conditions, any valid agent token may be used to operate on resources belonging to other tenants.
Exploit preconditions
- Attack surface: agent-API endpoints (e.g., UpdateSourceInventory, UpdateAgentStatus) exposed to authenticated agents.
- Required access: A valid agent JWT for any tenant/source (no special privileges beyond normal agent access).
- Trigger point: Sending crafted requests where the requested source ID refers to a victim tenant's source while presenting a JWT with a different or unchecked source_id claim.
- Why exploitation is possible: The server performs authentication but insufficient authorization, failing to enforce that the token's source_id is consistent with the target source in the request, leading to Insecure Direct Object Reference (CWE-639).
Why this happens
The core issue is incomplete authorization logic when mapping authenticated agents to the tenant-scoped resources they are allowed to manipulate.
While JWTs are used to establish identity, the handlers UpdateSourceInventory and UpdateAgentStatus do not enforce that the source_id embedded in the token corresponds to the source being acted upon.
This pattern maps to CWE-639, where the application trusts user-supplied or loosely-validated identifiers instead of consistently deriving authorization decisions from securely bound attributes.
As a result, attackers can reference arbitrary source IDs and the system does not reliably reject cross-tenant operations.
Potential impact
- Cross-tenant overwriting of source inventory data.
- Planting of malicious credential URLs in victim tenants' configurations.
- Corruption or manipulation of migration assessment results.
- Loss of tenant isolation, leading to potential full compromise of affected tenants' migration planning data.
- Erosion of integrity and trust in migration outcomes across the platform.
General mitigation guidance
Effective mitigation centers on strict, server-side authorization checks that bind tokens to the exact resources they are permitted to access.
Common secure patterns include:
- Validating that the JWT's source_id (or equivalent tenant-scoped claim) matches the source ID in the request path or body before performing any updates.
- Deriving the effective source/tenant context exclusively from trusted token claims or server-side session state, not from unvalidated client input.
- Enforcing a clear authorization layer that checks every access to tenant-scoped resources, independent of authentication success.
- Limiting the breadth of each agent token (least privilege) so it only applies to a narrowly defined source or tenant scope.
- Designing the API to minimize direct use of raw identifiers and adopting consistent patterns for multi-tenant isolation.
How teams detect issues like this
Detection typically focuses on identifying missing or inconsistent authorization checks around tenant-scoped resources:
- Static analysis rules that flag handlers where resource IDs from request parameters are used without cross-checking against authenticated identity or tenant claims.
- Code review checklists that require explicit verification of tenant or source binding for every multi-tenant API handler, especially update operations.
- Automated tests that attempt cross-tenant access using valid tokens from a different tenant to ensure the API correctly rejects such requests.
- Runtime monitoring and logging that capture patterns of a single agent identity accessing multiple distinct source IDs or tenants, which may indicate attempted exploitation.

