Summary
Chartbrew 4.9.0 contains an authorization flaw where authenticated users can update or delete SharePolicy records belonging to other projects by referencing their IDs directly.
Because the API checks only the project from the URL and not whether the specified policy_id actually belongs to that project, cross-project tampering with dashboard sharing rules becomes possible when users have access to at least one project.
Affected context
This issue appears in Chartbrew deployments where:
- Multiple projects exist and users have scoped access to specific projects
- SharePolicy records control dashboard sharing configuration per project
- API routes accept a project identifier in the URL path and a policy_id parameter in the body or query
The affected routes enforce access based on the project identifier alone and assume that any policy_id referenced by the caller belongs to that project, without verifying ownership.
Exploit preconditions
- Attack surface: Web API endpoints responsible for updating or deleting SharePolicy records.
- Required access: Authenticated access to at least one project in the Chartbrew instance (no need for administrative privileges).
- Trigger point: Supplying the ID of a SharePolicy that belongs to a different project while invoking an update or delete operation under a project the attacker can access.
- Why exploitation is possible: The authorization layer validates the caller against the project specified in the URL but does not ensure that the referenced SharePolicy (policy_id) is associated with that same project, enabling cross-project ID-based access control bypass.
Why this happens
The root cause aligns with CWE-639: Authorization Bypass Through User-Controlled Key.
The application trusts client-supplied identifiers (policy_id) as long as the caller is authorized for the project in the URL, assuming that the relationship between project and policy has been validated elsewhere.
Because the code does not enforce a strict ownership check (e.g., "SELECT policy WHERE id = :policy_id AND project_id = :project_id"), an attacker can enumerate or guess policy IDs belonging to other projects and operate on them through otherwise legitimate endpoints.
This pattern represents a classic insecure direct object reference: access control is checked on one dimension (project) but not on the actual resource being manipulated (SharePolicy record).
Potential impact
- Attackers with access to one project can modify sharing settings for dashboards in other projects.
- Dashboard visibility could be broadened, making private dashboards publicly accessible.
- Password protection and other access controls on shared dashboards could be disabled or weakened.
- Expiration dates or limits on shared links could be extended or removed, prolonging unintended access.
- Parameters allowed in shared dashboards could be altered, potentially exposing more sensitive data than intended.
General mitigation guidance
Effective mitigation focuses on enforcing object-level access control and minimizing trust in client-supplied identifiers:
- Tie every SharePolicy query or update to both the policy_id and its parent project_id, ensuring the resource truly belongs to the context being authorized.
- Implement consistent authorization checks at the data-access layer (e.g., repository or service level) so that all callers must prove ownership of both the project and the nested resource.
- Avoid assuming that a valid project authorization implies authorization for all referenced child objects; instead, re-validate relationships for every operation.
- Adopt a "default deny" posture for resource access, where operations on SharePolicy records fail unless a positive match between user, project, and policy is established.
- Normalize patterns around multi-tenant and multi-project isolation so that each record carries a tenant/project key that is always enforced in queries.
How teams detect issues like this
Detection can rely on a combination of code review discipline and automated analysis:
- Use static analysis rules or linters to flag data-access patterns that filter only on primary keys (e.g., id) without also constraining tenant/project ownership fields.
- During code review, pay particular attention to endpoints that accept arbitrary IDs from clients and verify that each lookup includes both the object ID and its parent project or tenant identifier.
- Enforce architectural policies that require all multi-tenant resources to be accessed through APIs that include an explicit tenant/project constraint, and consider centralizing resource loading helpers enforcing this rule.
- Leverage application logs to detect unusual cross-project API activity, such as a user from one project repeatedly affecting SharePolicy records in others, and configure alerting where appropriate.

