GHSA-53hj-r94p-8c8f: Kanidm Kanidm Has Non-constant-time Comparison Of Vulnerability

LOW
CVSS 3.7
CWE-208
Published
Advisory Summary

GHSA-53hj-r94p-8c8f is a LOW (CVSS 3.7) kanidm has non-constant-time comparison of vulnerability (CWE-208: Observable Timing Discrepancy) affecting Kanidm libraries in the crates.io ecosystem. The issue involves kanidm has non-constant-time comparison of oauth2 client_secret. Remediation is available by upgrading affected packages to version 1.9.3.

GHSA-53hj-r94p-8c8f at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-53hj-r94p-8c8f
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-208: Observable Timing Discrepancy
Affected Product Kanidm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-53hj-r94p-8c8f

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

kanidm fixed: 1.9.3
Upgrade kanidm to 1.9.3
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 kanidm

How to Check if You Are Affected

To determine whether your application is affected by GHSA-53hj-r94p-8c8f, inspect your project dependencies for Kanidm:

inspect dependencies for kanidm

Analyze the terminal output to locate any version of Kanidm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.3), 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-208: Observable Timing Discrepancy, where two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not. In Kanidm, 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 The kanidmd OAuth2 token-exchange (`/oauth2/token`) and token-introspection (`/oauth2/token/introspect`) endpoints compare the supplied `client_secret` against the stored secret using Rust's `PartialEq` on `String`, which short-circuits on the first mismatching byte. This produces an observable timing discrepancy that varies with the length of the matching prefix. ### Details - https://github.com/kanidm/kanidm/blob/master/server/lib/src/idm/oauth2.rs#L1135 — variable-time comparison in `check_oauth2_token_exchange` - https://cwe.mitre.org/data/definitions/208.html — CWE-208: Observable Timing Discrepancy ### PoC Static analysis only — no timing-recovery script was run because remote recovery of a 48-byte high-entropy secret over HTTPS is not practically demonstrable. The variable-time behaviour is established by inspection: ```rust // server/lib/src/idm/oauth2.rs:1135 (check_oauth2_token_exchange) if authz_secret == &secret { … } else { return Err(Oauth2Error::AuthenticationRequired); } ``` `String: PartialEq` delegates to `<[u8] as PartialEq>::eq`, which checks length equality then iterates byte-by-byte and returns on the first difference. ### Impact An unauthenticated network attacker who can reach the OAuth2 endpoints can submit arbitrary `client_id`/`client_secret` pairs and observe response latency. In principle the early-exit comparison leaks the position of the first mismatching byte, providing a timing oracle toward incremental recovery of a confidential client's secret. In practice the stored secret is a server-generated 48-character high-entropy string, the comparison runs inside an async tokio handler behind TLS, and network jitter is orders of magnitude larger than a single byte-compare — so remote recovery is not considered realistic with current techniques. This is a hardening issue rather than a practically exploitable vulnerability. ### Affected versions All published `kanidmd_lib` releases; the comparison is still variable-time on `master` at 1.10.0-dev

GHSA-53hj-r94p-8c8f Affected Kanidm Versions

1 component(s)
Fixed Versions:
1.9.3
Product / Package Ecosystem Affected Versions Fixed Version
kanidm
crates.io
< 1.9.3
1.9.3

References

Frequently Asked Questions

What is GHSA-53hj-r94p-8c8f?
GHSA-53hj-r94p-8c8f is a security vulnerability in Kanidm involving Kanidm has non-constant-time comparison of OAuth2 client_secret under CWE-208: Observable Timing Discrepancy.
Which Kanidm versions are affected?
Affected versions include releases prior to 1.9.3 across affected packages: kanidm.
What version fixes GHSA-53hj-r94p-8c8f?
Upgrading to 1.9.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is kanidm affected?
Yes, kanidm is affected in releases prior to 1.9.3. Upgrade your dependency to 1.9.3 or later.
What is the CVSS score of GHSA-53hj-r94p-8c8f?
GHSA-53hj-r94p-8c8f has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with GHSA-53hj-r94p-8c8f?
GHSA-53hj-r94p-8c8f is classified under CWE-208: Observable Timing Discrepancy (Two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not.).
How can I check crates.io dependencies for GHSA-53hj-r94p-8c8f?
Run the dependency tree command: 'inspect dependencies for kanidm'. 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-53hj-r94p-8c8f",
  "modified" : "2026-05-06T23:37:56Z",
  "published" : "2026-05-06T23:37:56Z",
  "aliases" : [ ],
  "summary" : "Kanidm has non-constant-time comparison of OAuth2 client_secret",
  "details" : "### Summary\n\nThe kanidmd OAuth2 token-exchange (`/oauth2/token`) and token-introspection (`/oauth2/token/introspect`) endpoints compare the supplied `client_secret` against the stored secret using Rust's `PartialEq` on `String`, which short-circuits on the first mismatching byte. This produces an observable timing discrepancy that varies with the length of the matching prefix.\n\n### Details\n\n- https://github.com/kanidm/kanidm/blob/master/server/lib/src/idm/oauth2.rs#L1135 — variable-time comparison in `check_oauth2_token_exchange`\n- https://cwe.mitre.org/data/definitions/208.html — CWE-208: Observable Timing Discrepancy\n\n### PoC\n\nStatic analysis only — no timing-recovery script was run because remote recovery of a 48-byte high-entropy secret over HTTPS is not practically demonstrable. The variable-time behaviour is established by inspection:\n\n```rust\n// server/lib/src/idm/oauth2.rs:1135  (check_oauth2_token_exchange)\nif authz_secret == &secret { … } else { return Err(Oauth2Error::AuthenticationRequired); }\n```\n\n`String: PartialEq` delegates to `<[u8] as PartialEq>::eq`, which checks length equality then iterates byte-by-byte and returns on the first difference.\n\n### Impact\n\nAn unauthenticated network attacker who can reach the OAuth2 endpoints can submit arbitrary `client_id`/`client_secret` pairs and observe response latency. In principle the early-exit comparison leaks the position of the first mismatching byte, providing a timing oracle toward incremental recovery of a confidential client's secret. In practice the stored secret is a server-generated 48-character high-entropy string, the comparison runs inside an async tokio handler behind TLS, and network jitter is orders of magnitude larger than a single byte-compare — so remote recovery is not considered realistic with current techniques. This is a hardening issue rather than a practically exploitable vulnerability.\n\n### Affected versions\n\nAll published `kanidmd_lib` releases; the comparison is still variable-time on `master` at 1.10.0-dev",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "kanidm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.9.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.9.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/kanidm/kanidm/security/advisories/GHSA-53hj-r94p-8c8f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kanidm/kanidm"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-208" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-06T23:37:56Z",
    "nvd_published_at" : null
  }
}