HIGH 7.6

CVE-2026-56239: Capgo Billing Privilege Escalation via Unprotected SECURITY DEFINER Function

Capgo versions before 12.128.2 contain a billing privilege escalation flaw in a Supabase database function that handles usage overage charges. The function runs with elevated database owner privileges but fails to verify that the user initiating the request actually has authorization to modify billing for the target organization. An authenticated user could exploit this via remote API calls to tamper with billing records, deduct credits from other organizations' accounts, or inject fraudulent overage charges without proper authorization checks.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.6 HIGH · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:L
Weaknesses (CWE)
CWE-269
Affected products
0 configuration(s)
Published / Modified
2026-06-21 / 2026-06-24

NVD description (verbatim)

Capgo before 12.128.2 contains a potential privilege escalation vulnerability in the public.apply_usage_overage SECURITY DEFINER function, which performs sensitive billing operations without enforcing internal authorization checks (no validation of auth.uid(), org membership, or check_min_rights). Because the function runs with the owner's privileges, it bypasses Row Level Security. If EXECUTE permission is available to the authenticated or anon roles (explicitly or via default privileges), an authenticated user could invoke it via Supabase RPC to manipulate billing data for arbitrary organizations, including unauthorized credit depletion and fraudulent overage event insertion.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability exists in the public.apply_usage_overage function, which is marked as a SECURITY DEFINER routine. SECURITY DEFINER functions in PostgreSQL execute with the privileges of the function owner, effectively bypassing Row Level Security policies that would normally protect data. The function performs sensitive billing operations—including credit depletion and overage event insertion—without validating auth.uid(), organization membership, or invoking check_min_rights authorization logic. If EXECUTE permission is granted to authenticated or anonymous roles (either explicitly or via default privilege inheritance), any authenticated user can invoke the function via Supabase's Remote Procedure Call interface to manipulate billing data across arbitrary organizations.

Business impact

This vulnerability enables unauthorized financial manipulation within Capgo's billing system. Attackers with legitimate authentication credentials could deplete credits from competing or arbitrary customer organizations, insert false overage charges to inflate billing, or redirect revenue attribution. For Capgo customers, the risk manifests as unauthorized deductions, incorrect invoices, and potential service disruptions if credits are fraudulently consumed. For Capgo itself, the exposure includes revenue leakage, customer trust erosion, disputed charges, and potential regulatory liability if billing integrity cannot be guaranteed.

Affected systems

Capgo versions before 12.128.2 are affected. The vulnerability is specific to the Supabase PostgreSQL backend implementation and requires network access to Capgo's RPC endpoints. Any authenticated user with access to Capgo's API or UI can trigger the vulnerable function.

Exploitability

Exploitability is moderate to high. The attack requires valid authentication credentials (satisfying the PR:L requirement in the CVSS vector), but no social engineering or special user interaction is needed once authenticated. The RPC interface is designed for programmatic access, making remote exploitation straightforward. No client-side exploit code is required—the vulnerability is invoked through standard API calls. The primary barrier is obtaining legitimate credentials; if those are present, the attack is reliable and repeatable.

Remediation

Upgrade Capgo to version 12.128.2 or later. This version includes authorization checks within the public.apply_usage_overage function to validate auth.uid(), verify organization membership, and enforce check_min_rights policies before executing billing operations. The patch ensures the function respects Row Level Security even when running with elevated privileges.

Patch guidance

Deploy version 12.128.2 or newer as soon as feasible. Given the HIGH severity and direct financial impact, this should be treated as a priority patch. Before patching, verify no active automated billing processes depend on direct invocation of public.apply_usage_overage; the patched version enforces authorization, which may cause legitimate automation to fail if those processes lack proper credentials or org context. Test the patched version in a staging environment against your billing workflows to confirm compatibility.

Detection guidance

Monitor Supabase audit logs and PostgreSQL query logs for calls to public.apply_usage_overage originating from unexpected user accounts or roles, particularly those from authenticated users without billing admin privileges. Alert on invocations that modify overage_events or credit balances for organizations not owned by the calling user. Review recent billing history for anomalous credit deductions or overage charges that do not correspond to actual usage; cross-reference with RPC call logs to identify suspicious patterns. Implement strict RBAC and revoke default EXECUTE permissions on sensitive SECURITY DEFINER functions if not explicitly required.

Why prioritize this

This vulnerability scores HIGH (7.6 CVSS) because it enables direct, high-impact manipulation of billing data by authenticated insiders with minimal friction. The combination of low attack complexity, remote network accessibility, and high integrity impact (fraudulent billing) justifies urgent prioritization. While confidentiality impact is lower (auth.uid leakage is possible but not the primary concern), the business criticality of billing integrity and the straightforward exploitation path warrant immediate patching.

Risk score, explained

The CVSS 3.1 score of 7.6 reflects: Attack Vector (Network—the function is accessible via RPC), Attack Complexity (Low—standard API calls), Privileges Required (Low—any authenticated user), User Interaction (None), Scope (Unchanged—impact is limited to Capgo's billing data, not other services), Confidentiality (Low—some user data exposure is possible during billing record access), Integrity (High—billing records can be freely modified), Availability (Low—credits can be depleted, causing service degradation but not complete unavailability). The HIGH severity is driven primarily by the integrity impact on financial data and the ease of exploitation by any authenticated user.

Frequently asked questions

Can an unauthenticated attacker exploit this vulnerability?

No. The vulnerability requires valid authentication credentials (PR:L in the CVSS vector). An unauthenticated user cannot invoke the vulnerable RPC function. However, any legitimate authenticated user—including those with minimal privileges—can exploit it.

Does upgrading to 12.128.2 require database migration or downtime?

The patch description does not specify database schema changes or mandatory downtime. However, you should test the upgrade in a staging environment first to ensure billing workflows remain functional under the new authorization checks. Contact Capgo support or review their detailed release notes to confirm your specific deployment's requirements.

How can we detect if this vulnerability was exploited in our Capgo instance?

Review Supabase audit logs and PostgreSQL query logs for calls to public.apply_usage_overage from user accounts that should not have billing access. Cross-reference with billing records for unauthorized credit transfers or overage insertions. Check for invocations by non-admin authenticated users modifying organizations they do not own. If suspicious activity is found, contact Capgo support and conduct a billing audit immediately.

What if our organization uses custom billing automation that calls public.apply_usage_overage directly?

After upgrading to 12.128.2, such direct calls will be subject to authorization checks and may fail if the calling account lacks proper credentials or organization context. You must refactor that automation to either use Capgo's documented billing API endpoints or update credentials to include proper org context and billing admin privileges. Test thoroughly before deploying the patch to production.

This analysis is based on the vulnerability disclosure dated 2026-06-21 and modified 2026-06-24. Patch version 12.128.2 and its availability are stated in the source data; verify against the official Capgo advisory and release notes before deploying. CVSS score 7.6 HIGH is provided as reference; environmental factors specific to your deployment may alter actual risk. This is not a substitute for your organization's own threat assessment and security testing. Exploit code or weaponized proof-of-concept details are not included in this analysis. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).