/

CVE-2026-82491

CVE-2026-82491: The Export Field Path That Walked to the Signing Keys


CVE-2026-82491

CVSS:3.1

Hemanshu Baviskar

CONTENTS

0% READ
Xen: The first copy failed. The second skipped the check.

openIMIS lets any GraphQL list query be dumped to CSV or Excel, and lets the caller name the columns as dotted paths like insuree.family.location.name. Those paths are rewritten straight into Django ORM relation syntax with no allow-list. Because every history-tracked row carries a foreign key to its creator, one of those columns can walk user_created -> i_user -> private_key and return another account's JWT signing key. In the lab a low-privilege account asked for that column, received an administrator's signing key, forged an admin token, and was let in.

TL;DR

  • The defect. ExportableQueryMixin turns each caller-supplied field name into an ORM path with field.replace(".", "__") (core/gql/export_mixin.py:86-89) and feeds it to qs.values_list(*values) (core/models/base_mutation.py:52) with no allow-list. Any relation reachable from the exported model is selectable.

  • What it grants. An account with a single ordinary read right exports user_created.i_user.private_key, recovers the JWT signing key of whoever created a row it can already see, forges a token as that user, and authenticates as them. No password, no admin right.

  • The tell. A sibling download endpoint, fetch_export, already checks export.user != request.user before releasing a file (core/views.py:41-48). The project knows the ownership pattern. It just never applied it to which columns the export may contain.

  • Reach. Stock code, no plugin, no non-default toggle. Every openIMIS version is affected, and the export mixin is used across the core query modules.

  • Status. Reproduced on ghcr.io/openimis/openimis-be:develop. Fixed in the openIMIS 2026-10 release.

At a Glance

CVE

CVE-2026-82491

Product

openIMIS backend (openimis-be-core_py), GraphQL export mixin

Class

CWE-915, Improperly Controlled Modification of Dynamically-Determined Object Attributes, leading to CWE-522, Insufficiently Protected Credentials

Root cause

Caller-supplied export field paths rewritten to ORM relation syntax and selected with no allow-list, reaching InteractiveUser.private_key

Impact

Cross-account disclosure of JWT signing keys, leading to token forgery and account takeover

Affected

openIMIS before the 2026-10 release

Fixed

2026-10 release

Severity

8.8 CVSS 3.1 / 8.7 CVSS 4.0 (High)

Disclosure

Coordinated; fixed upstream

Credit

CodeAnt AI Security

A Convenience That Reaches Too Far

openIMIS is a Django application for running national health insurance schemes, and its UI leans heavily on GraphQL. A common pattern across its modules is a list query (insurees, individuals, payments) paired with an auto-generated export: the same data poured into a CSV or Excel file the user can download. To stay generic, the export does not hard-code a column set per screen. The caller tells it which columns to include, by name.

That is the primitive worth holding onto. The export is a caller-driven projection over a Django queryset, and what the caller controls is which fields get read out. In an ORM a field name is not just a column: it can be a relation, and relations chain. The finding is about what happens when the field a caller names is allowed to be a relation path to somewhere it was never meant to point.

The Rewrite With No Allow-List

The export lives in ExportableQueryMixin. When a caller asks for columns, each one is run through a small helper that converts dotted notation into Django's double-underscore relation syntax:

# core/gql/export_mixin.py  (_adjust_notation, ~:86-89)
def _adjust_notation(cls, field):
    return to_snake_case(field.replace(".", "__"))   # "a.b.c" -> "a__b__c"
# core/gql/export_mixin.py  (_adjust_notation, ~:86-89)
def _adjust_notation(cls, field):
    return to_snake_case(field.replace(".", "__"))   # "a.b.c" -> "a__b__c"
# core/gql/export_mixin.py  (_adjust_notation, ~:86-89)
def _adjust_notation(cls, field):
    return to_snake_case(field.replace(".", "__"))   # "a.b.c" -> "a__b__c"

A few lines down, that output is used directly, with nothing between it and the query:

# core/gql/export_mixin.py  (~:104)
export_fields = [cls._adjust_notation(f) for f in kwargs.pop("fields")]
# core/gql/export_mixin.py  (~:104)
export_fields = [cls._adjust_notation(f) for f in kwargs.pop("fields")]
# core/gql/export_mixin.py  (~:104)
export_fields = [cls._adjust_notation(f) for f in kwargs.pop("fields")]

And the fields land in the queryset read itself:

# core/models/base_mutation.py  (~:52)
content = DataFrame.from_records(qs.values_list(*values))
# core/models/base_mutation.py  (~:52)
content = DataFrame.from_records(qs.values_list(*values))
# core/models/base_mutation.py  (~:52)
content = DataFrame.from_records(qs.values_list(*values))

There is no allow-list between those three points. Nothing compares the requested path against a set of columns the model is willing to export. values_list("a__b__c") instructs Django to follow relation a, then b, then read column c, joining across tables as needed. The caller has been handed the ORM's relation traversal as an input language, and the only limit on it is the shape of the schema, not a policy.

The Path to a Signing Key

A projection over business data is one thing. The problem is where it connects. openIMIS tracks history on its models, and every history-tracked row carries a foreign key to its creator. From there the chain is short:

user_created  ->  core.User.i_user  ->  InteractiveUser.private_key
user_created  ->  core.User.i_user  ->  InteractiveUser.private_key
user_created  ->  core.User.i_user  ->  InteractiveUser.private_key

Each hop is a real relation (core/models/history_model.py:65-71, core/models/user.py:220-226). Any exportable, history-tracked model therefore exposes, as a reachable column, the private_key of whichever account created each row. That column is the signing key openIMIS uses to mint and verify that user's JWTs:

# core/jwt.py  (~:57-69)
if db_user and db_user.i_user and db_user.i_user.private_key:
    key = db_user.i_user.private_key
# core/jwt.py  (~:57-69)
if db_user and db_user.i_user and db_user.i_user.private_key:
    key = db_user.i_user.private_key
# core/jwt.py  (~:57-69)
if db_user and db_user.i_user and db_user.i_user.private_key:
    key = db_user.i_user.private_key

The same per-user private_key that signs a token is the key used to verify it. So recovering one account's private_key is not a hint about its credentials. It is the full symmetric authority to speak as that account, handed to the caller for every creator of every row the caller is already permitted to list.

The Impact, Proven

We ran it end to end against ghcr.io/openimis/openimis-be:develop. The attacking account held one ordinary read right and no admin permission. It issued an export whose fields included a normal business column and the traversal column:

fields: ["firstName",
         "user_created.i_user.login_name",
         "user_created.i_user.private_key"]
fields: ["firstName",
         "user_created.i_user.login_name",
         "user_created.i_user.private_key"]
fields: ["firstName",
         "user_created.i_user.login_name",
         "user_created.i_user.private_key"]

The generated file came back with the signing key in plain text. The rows visible to this account were created by Admin, so the key returned was Admin's:

,first_name,user_created__i_user__login_name,user_created__i_user__private_key
0,<a row visible to the account>

,first_name,user_created__i_user__login_name,user_created__i_user__private_key
0,<a row visible to the account>

,first_name,user_created__i_user__login_name,user_created__i_user__private_key
0,<a row visible to the account>

Retrieving the file is allowed because the requester is export.user, so the one ownership check that exists (core/views.py:41-48) passes. With the key in hand, forging an Admin token is a single jwt.encode(..., algorithm="HS256") call, and presenting it to an admin-only endpoint returned 200:

curl -s -o /dev/null -w '%{http_code}\n' \
  -H "Authorization: Bearer <forged Admin token>" \
  http://<target>/api/api_fhir_r4/Patient/
# -> 200
curl -s -o /dev/null -w '%{http_code}\n' \
  -H "Authorization: Bearer <forged Admin token>" \
  http://<target>/api/api_fhir_r4/Patient/
# -> 200
curl -s -o /dev/null -w '%{http_code}\n' \
  -H "Authorization: Bearer <forged Admin token>" \
  http://<target>/api/api_fhir_r4/Patient/
# -> 200

The honest ceiling: this requires one authenticated low-privilege account, and the key you get is the creator's, not an arbitrary target's. In practice the creator of operational rows is very often an administrator or service account, which makes the escalation reliable rather than theoretical. Two properties sharpen it: a signing key is not rotated by a password reset, so a stolen key outlives incident response, and a forged session produces no failed-login event.

The Guard That Was Built, and the One That Was Not

The most telling part of this bug is that openIMIS already knows how to protect an export. Its sibling download path does:

Stage

Control

What it checks

Downloading a finished export

fetch_export, core/views.py:41-48

export.user != request.user, refuses files that are not yours

Choosing what the export contains

ExportableQueryMixin, core/gql/export_mixin.py:104

nothing; any ORM path is accepted

The retrieval guard shows the pattern was understood: an export belongs to someone, and ownership is enforced before the bytes leave the server. But that guard runs at the end, on the file. The decision that actually matters, which columns the file may hold, happens earlier and is completely open. Guarding who may download the file does nothing when the file was permitted to contain another account's signing key.

A second, quieter confirmation: we found no test, no comment, and no documentation anywhere in the module that names private_key (or password) as an exportable field. Credential columns are reachable only because relation traversal is unbounded, not because anyone decided they should be exportable.

Reach and Real-World Exposure

This is stock openIMIS, no plugin and no non-default feature. The export mixin is shared across core query modules, so the traversal is available wherever an exportable list query is, and the user_created relation exists on every history-tracked model, which is most of them. All versions are affected, and with no patched release, every deployment that exposes these exports to any authenticated user is exposed today.

We do not claim a specific internet-wide count, or that every exportable query in every module reaches a history-tracked model with a populated creator. We proved the primitive on develop with a minimally privileged account and a real forged-admin request. The exact inventory per deployment depends on which modules and permissions are in use.

Severity

Metric

Value

CVSS 3.1

8.8, CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

CVSS 4.0

8.7, CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Network reachable, low complexity, and the only privilege required is one authenticated account with a single ordinary read right (PR:L). The leaked signing key yields full control of the victim account, so confidentiality, integrity, and availability are all High. It is not a 10.0: the attacker must already hold an account (PR:L), and we score scope Unchanged. Forging an admin token arguably crosses a privilege boundary, but we treat that escalation as the downstream consequence of the disclosure rather than a scope change in the vulnerable component, and take Unchanged / 8.8 as the conservative, defensible value. The CVSS 4.0 vector agrees at 8.7 with the subsequent-system metrics all None.

Detection and Fix

Upgrade. openIMIS addressed this in the 2026-10 release. Upgrading is the durable remedy.

The code fix is an allow-list. Export field selection must be constrained to a declared set of exportable columns per model, and any path that traverses into a related User or InteractiveUser record, or lands on an authentication column such as private_key or password, must be rejected before it reaches values_list. Separately, the JWT layer should stop selecting a token's verification key using an unverified claim from that same token, the property that turns a leaked per-user key into full impersonation.

If you cannot upgrade immediately, these reduce exposure but each has a cost, and the untested ones are reasoned from the code path, so validate before relying on them:

  • Restrict or disable the export GraphQL operations for roles that do not strictly need file export. This removes the attack surface for those roles but breaks their ability to download CSV/Excel.

  • Add a server-side deny filter that rejects any export fields entry whose path contains user_created, i_user, private_key, or password before it reaches _adjust_notation. This blocks the known traversal only, not a general allow-list, so treat it as a stopgap.

  • Rotate InteractiveUser signing keys after any suspected exposure. Because a key survives a password reset, explicit rotation is the only thing that invalidates a key an attacker may already hold.

Disclosure Timeline

Date

Event

2026-08-26

CodeAnt AI Security Research reported seven openIMIS findings (two Critical, five High) to VulnCheck for coordinated vulnerability disclosure.

2026-08-31

VulnCheck confirmed receipt and opened coordination with the openIMIS maintainers.

September 2026

openIMIS acknowledged the reports; the next release was in its UAT phase.

October 2026

openIMIS published the 2026-10 release.

2026-11-17

openIMIS maintainers confirmed that the 2026-10 release addresses all reported findings, and CVE records were drafted.

Credit and Scope

Finding

CodeAnt AI Security

What we claim

Export field paths are rewritten to ORM relations with no allow-list and reach InteractiveUser.private_key; demonstrated recovery of an admin signing key by a low-privilege account and a forged admin token accepted with 200, reproduced on develop

What we do not claim

A real-world prevalence count; that every exportable query in every module reaches a populated creator record

Related

CVE-2026-82492, the deduplication-column twin that reaches the same private_key through independent code; CVE-2026-82489, the unauthenticated report-previewer RCE in the same product

Coordination

Reported to openIMIS; fixed in the 2026-10 release

More from CodeAnt

  • CVE-2026-82492: The Deduplication Column That Returned the Same Private Key, an independent path to the identical signing key

  • CVE-2026-82489: The Report Previewer That Ran Code Before It Checked Anyone, an unauthenticated openIMIS RCE

  • CVE-2026-71519: The Gate That Checked the Request, Not the Record, a PrestaShop cross-tenant takeover

Find out what is already exploitable in your codebase. Book a demo or start a free trial at codeant.ai.

Frequently Asked
Questions
What is CVE-2026-82491?
Does this affect every openIMIS installation?
Does an attacker need an account?
Why does the signing key come back when no column is named private_key?
What can an attacker actually do with it?
How is this different from CVE-2026-82492?
How do I fix CVE-2026-82491?
Find out what's already
exploitable in your codebase.