/

CVE-2026-56082

Severity:

HIGH RISK

(7.5)

Access Control Flaw (CWE-284) in Capgo Billing RPC API

CVE-2026-56082

Deferred

Vulnerability type

Category:

Improper Access Control

CWE:

CWE-284

Impact:

Cross-tenant data tampering and billing manipulation

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Capgo exposes a SECURITY DEFINER PostgREST RPC function that is callable with only the public Supabase publishable anon key, allowing misuse across tenants.

An unauthenticated attacker can insert or overwrite build log records for arbitrary organizations, potentially tampering with billing data and inflating billable usage.

Affected context

This vulnerability arises in Capgo deployments that use Supabase/PostgREST with a SECURITY DEFINER function public.record_build_time granted to the anon role.

The function is callable using only the public Supabase publishable sb_publishable_* anon key, and operates directly on the public.build_logs table.

In environments where this function is exposed without additional authentication or tenant scoping checks, arbitrary organizations' build log and billing data can be modified.

Exploit preconditions

  • Attack surface: Public PostgREST RPC endpoint for public.record_build_time.
  • Required access: Possession of the Supabase publishable anon key (sb_publishable_*), which is typically embedded in client-side code and not secret.
  • Trigger point: Calling the record_build_time RPC with chosen build_id and org_id parameters.
  • Why exploitation is possible: The SECURITY DEFINER function runs with elevated privileges, is granted to the anon role, and does not sufficiently enforce tenant isolation or verify that the caller is authorized to write to the targeted org_id. The ON CONFLICT (build_id, org_id) DO UPDATE clause allows both insertion and overwriting of existing records.

Why this happens

The root cause is improper access control on a privileged database function that mutates shared billing data.

By marking public.record_build_time as SECURITY DEFINER, the function executes with the owner's permissions but is still exposed to the low-privilege anon role, which is reachable with only a publishable key.

The function lacks robust authorization checks to ensure the caller is acting on its own tenant or organization, resulting in cross-tenant data modification.

This pattern maps to CWE-284: Improper Access Control, where a resource-modifying operation is available to identities that should not have such capabilities.

Potential impact

  • An attacker may insert bogus build logs for arbitrary organizations.
  • An attacker may overwrite existing build log and billing records by reusing chosen build_id and org_id combinations.
  • Organizations could experience inflated billable build time, causing financial-impact denial of service.
  • Billing audits, usage analytics, and operational metrics can be corrupted or rendered unreliable.
  • In multi-tenant environments, trust between tenants and the service provider can be undermined due to cross-tenant tampering.

General mitigation guidance

Effective mitigation focuses on tightening authorization around privileged database functions and enforcing strict tenant isolation.

Common defensive patterns include:

  • Removing or limiting grants to the anon role for any SECURITY DEFINER or privileged billing-related functions.
  • Requiring authenticated, tenant-bound roles (e.g., per-user or per-organization roles) for operations that write billing or usage data.
  • Enforcing tenant scoping within functions by deriving org_id from the authenticated context or JWT claims rather than trusting client-supplied identifiers.
  • Applying row-level security (RLS) and policy checks on billing tables so that only authorized principals can create or modify records for their own tenant.
  • Using least-privilege design for database roles and avoiding exposing SECURITY DEFINER routines via public API endpoints unless absolutely necessary and tightly constrained.

How teams detect issues like this

Detection typically involves reviewing database- and API-layer permissions alongside logs for anomalous usage patterns.

Possible strategies include:

  • Static review of database schema for SECURITY DEFINER functions granted to low-privilege or public roles, especially where they write to billing or multi-tenant tables.
  • Code and migration review processes that flag new or changed RPC functions that accept tenant identifiers from clients without deriving them from authenticated context.
  • Automated checks or linters for PostgREST/Supabase configuration that surface functions mapped to the anon role with write capabilities.
  • Runtime monitoring for suspicious billing activity, such as sudden spikes in build time, repeated updates to the same build_id from diverse IP addresses, or cross-organization patterns.
  • Periodic access control audits that compare intended authorization rules with actual grants at the database and API layers.

Sources

SourceLink
github.comgithub.com/Cap-go/capgo/security/advisories/GHSA-42xj-3h9w-26h5
vulncheck.comvulncheck.com/advisories/supabase-unauthenticated-cross-tenant-billing-log-tampering-via-public-record-build-time-rpc

Frequently asked

questions

It can be exploited by anyone who can reach the affected PostgREST endpoint and obtain the Supabase publishable anon key, which is generally easy to access because it is intended for public use in client applications.

No traditional authentication is required beyond the public sb_publishable_* anon key. Because this key is not secret, the vulnerability is effectively exploitable by unauthenticated users.

The safest pattern is to remove write access for the anon role to privileged billing functions and ensure billing operations run under authenticated, tenant-scoped identities with strict row-level security and authorization checks inside the function.

Adopt a least-privilege design for database roles, avoid exposing SECURITY DEFINER functions to public roles, derive tenant identity from authenticated context rather than client input, and incorporate access-control reviews and automated checks into schema migrations and API design workflows.

Find out what's already
exploitable in your codebase.