GHSA-gpxg-fx2g-qxj2: Kanidm Stored HTML Injection Vulnerability

MODERATE
CVSS 6.1
CWE-79
Published
Advisory Summary

GHSA-gpxg-fx2g-qxj2 is a MODERATE (CVSS 6.1) stored html injection vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Kanidm libraries in the crates.io ecosystem. The issue involves stored html injection in "passkey-enrolment" partial via displayname → htmx-driven authenticated request forgery. Remediation is available by upgrading affected packages to version 1.9.3.

GHSA-gpxg-fx2g-qxj2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gpxg-fx2g-qxj2
Severity MODERATE
CVSS v3.1 Base Score 6.1
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Kanidm
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 6.1

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

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

How to Fix GHSA-gpxg-fx2g-qxj2

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-gpxg-fx2g-qxj2, 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. 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 web UI renders the WebAuthn passkey-registration challenge as raw JSON inside an inline `<script id="data">` element using the Askama `|safe` filter. The challenge embeds the account's `displayname`, which `serde_json` serialises without escaping `<`/`>`. A `displayname` containing `</script>` therefore terminates the script element early and injects arbitrary HTML into the credential-update page. Because the page is htmx-driven and the server's CSP allows `'unsafe-eval'`, injected `hx-*` attributes can issue authenticated same-origin API requests with the viewer's bearer cookie. ### Impact An authenticated attacker who is a member of `idm_people_admins` can write the `displayname` of any `Person` entry — including high-privilege persons — because `idm_acp_people_pii_manage` carries no high-privilege exclusion filter. When the targeted high-privilege user later opens **Add Passkey** on their own credential-update page (`/ui/reset`), the injected markup is swapped into the DOM and htmx fires attacker-chosen same-origin requests authenticated as the victim. This allows a helpdesk-tier operator to escalate to `idm_admins` (e.g. by POSTing themselves into the group) or otherwise act with the victim's session. The self-write path (`idm_people_self_name_write`) is self-XSS only and is not counted toward impact. Even without the htmx vector, the breakout permits `<meta http-equiv='refresh'>` open-redirect and arbitrary defacement of the credential page. ### Details - https://github.com/kanidm/kanidm/blob/master/server/core/templates/credential_update_add_passkey_partial.html#L3 — the `|safe` sink - https://github.com/kanidm/kanidm/blob/master/server/core/src/https/views/reset.rs#L506-L509 — `serde_json::to_string` of the challenge - https://github.com/kanidm/kanidm/blob/master/server/lib/src/idm/credupdatesession.rs#L2453-L2460 — `displayname` flows into `start_passkey_registration` ### Affected versions All releases shipping the htmx credential-update views

GHSA-gpxg-fx2g-qxj2 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-gpxg-fx2g-qxj2?
GHSA-gpxg-fx2g-qxj2 is a security vulnerability in Kanidm involving Stored HTML injection in "passkey-enrolment" partial via displayname → htmx-driven authenticated request forgery under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Kanidm versions are affected?
Affected versions include releases prior to 1.9.3 across affected packages: kanidm.
What version fixes GHSA-gpxg-fx2g-qxj2?
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-gpxg-fx2g-qxj2?
GHSA-gpxg-fx2g-qxj2 has a CVSS v3.1 base score of 6.1 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-gpxg-fx2g-qxj2?
GHSA-gpxg-fx2g-qxj2 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check crates.io dependencies for GHSA-gpxg-fx2g-qxj2?
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-gpxg-fx2g-qxj2",
  "modified" : "2026-05-06T23:34:20Z",
  "published" : "2026-05-06T23:34:20Z",
  "aliases" : [ ],
  "summary" : "Kanidm: Stored HTML injection in \"passkey-enrolment\" partial via displayname → htmx-driven authenticated request forgery",
  "details" : "### Summary\n\nThe kanidmd web UI renders the WebAuthn passkey-registration challenge as raw JSON inside an inline `<script id=\"data\">` element using the Askama `|safe` filter. The challenge embeds the account's `displayname`, which `serde_json` serialises without escaping `<`/`>`. A `displayname` containing `</script>` therefore terminates the script element early and injects arbitrary HTML into the credential-update page. Because the page is htmx-driven and the server's CSP allows `'unsafe-eval'`, injected `hx-*` attributes can issue authenticated same-origin API requests with the viewer's bearer cookie.\n\n### Impact\n\nAn authenticated attacker who is a member of `idm_people_admins` can write the `displayname` of any `Person` entry — including high-privilege persons — because `idm_acp_people_pii_manage` carries no high-privilege exclusion filter. When the targeted high-privilege user later opens **Add Passkey** on their own credential-update page (`/ui/reset`), the injected markup is swapped into the DOM and htmx fires attacker-chosen same-origin requests authenticated as the victim. This allows a helpdesk-tier operator to escalate to `idm_admins` (e.g. by POSTing themselves into the group) or otherwise act with the victim's session. The self-write path (`idm_people_self_name_write`) is self-XSS only and is not counted toward impact. Even without the htmx vector, the breakout permits `<meta http-equiv='refresh'>` open-redirect and arbitrary defacement of the credential page.\n\n### Details\n\n- https://github.com/kanidm/kanidm/blob/master/server/core/templates/credential_update_add_passkey_partial.html#L3 — the `|safe` sink\n- https://github.com/kanidm/kanidm/blob/master/server/core/src/https/views/reset.rs#L506-L509 — `serde_json::to_string` of the challenge\n- https://github.com/kanidm/kanidm/blob/master/server/lib/src/idm/credupdatesession.rs#L2453-L2460 — `displayname` flows into `start_passkey_registration`\n\n### Affected versions\n\nAll releases shipping the htmx credential-update views",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:H/I:H/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-gpxg-fx2g-qxj2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/kanidm/kanidm"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-06T23:34:20Z",
    "nvd_published_at" : null
  }
}