{"schema_version":"1.9.2","id":"GHSA-jf75-q64q-g65r","published":"2026-10-28T21:17:58Z","modified":"2026-10-29T02:56:06.675089351Z","aliases":["CVE-2026-55369"],"summary":"Waline login accepts a non-string email as a match-all MongoDB query","details":"## Summary\n\nThe login endpoint POST /api/token reads the `email` field from the request body without checking its type and passes it straight into the MongoDB storage query. When `email` is not a string (for example a JSON object such as {\"$ne\": null}), the MongoDB storage adapter's parseWhere silently DROPS the field rather than rejecting the request, producing an empty filter that matches ALL users. The endpoint then verifies the submitted password against the FIRST user returned (user[0]), which in Waline is the first-registered user — the site administrator.\n\nThis is a PARTIAL authentication bypass, not a full one. The attacker still needs a valid password for that first user; this is not a zero-knowledge bypass and it does not disclose passwords. Its concrete effects are: (1) the email/identifier factor is removed for the administrator account, (2) user enumeration (a non-string email never fails the \"no such user\" branch), and (3) credential-stuffing amplification — an attacker can test a leaked or weak password against the administrator account without knowing the administrator's email.\n\n## Details\n\nUntyped input — packages/server/src/controller/token.js:17-18:\n```\n    const { email, password, code } = this.post();\n    const user = await this.modelInstance.select({ email });\n````\n`email` comes from the request body with no type check.\n\nThe storage adapter silently drops a non-string key — packages/server/src/service/storage/mongodb.js, parseWhere():\n```\n    if (think.isString(where[k])) { filter[parseKey(k)] = { $eq: ... }; continue; }   // intended guard\n    if (where[k] === undefined) { ... }\n    if (Array.isArray(where[k]) && where[k][0]) { ... operator handling (IN/LIKE/!=/> ...) }\n```\nA plain object such as {\"$ne\": null} is neither a string, undefined, nor an array, so NONE of the branches run and nothing is added to `filter` for `email`. The result is filter = {} -> instance.where({}) -> MongoDB find({}) returns every user. (The array form, e.g. [\"!=\", \"\"], is a genuine operator injection that reaches $ne with the same match-all effect.)\n\nFirst user is selected — token.js:22-26:\n```\n    if (think.isEmpty(user) || isVerifyUser || isBannedUser) { return this.fail(); }   // match-all -> not empty -> passes\n    const checkPassword = this.checkPassword(password, user[0].password);\n```\nuser[0] is the first record in MongoDB natural (insertion) order, i.e. the earliest-registered user, which in Waline is the administrator.\n\nNo upstream type validation — packages/server/src/logic/token.js:37-38:\n```\n    async postAction() { await this.useCaptchaCheck(); }\n```\nThe only pre-check is the captcha; there is no isString(email/password) validation.\n\n## Proof of Concept\n\nSend a login request whose email is a non-string value:\n```\n    POST /api/token  HTTP/1.1\n    Content-Type: application/json\n\n    {\"email\": {\"$ne\": null}, \"password\": \"<password-to-test>\"}\n```\n- Because `email` is not a string, parseWhere adds nothing for it, so the query filter is {} and MongoDB returns all users.\n- user[0] — the first-registered user, i.e. the administrator — is selected, and the submitted password is checked against the administrator's hash.\n- If the password matches (for example via credential stuffing or a known/weak password), the attacker is authenticated as the administrator without ever knowing the administrator's email.\n- Even when the password does not match, the request confirms that users exist (enumeration) and that the email factor is bypassable.\n\n## Impact\n\nAn unauthenticated attacker can bypass the email/identifier factor of authentication for the first-registered user (the administrator) and have an arbitrary password checked directly against that account. This:\n- enables user enumeration;\n- amplifies credential stuffing against the administrator (no need to know the admin email — a leaked or weak password can be tested directly);\n- and, when the attacker possesses a valid password for that account (e.g. a reused/breached one), results in administrator login.\n\nThis is bounded: it is NOT a zero-knowledge authentication bypass, it does NOT reveal passwords, and it targets the first-returned user rather than an arbitrary chosen account. It is rated Medium accordingly. (If exploitation succeeds in logging in, the attacker then holds the administrator session; that downstream impact is conditional on already having a valid password, which is reflected in the High attack complexity rather than in the confidentiality/integrity metrics.)\n\n## Remediation\n\nValidate the types of `email` and `password` as strings before they reach the storage query — for example in packages/server/src/logic/token.js postAction():\n```\n    const { email, password } = this.post();\n    if (!think.isString(email) || !think.isString(password)) {\n      return this.ctx.throw(400, 'Invalid input type');\n    }\n```\nDefense in depth: in mongodb.js parseWhere(), reject (rather than silently drop) a value that is neither a string nor a supported array form, or coerce it to {$eq: String(value)}, so a non-string key can never elide the filter.","affected":[{"package":{"name":"@waline/vercel","ecosystem":"npm","purl":"pkg:npm/%40waline/vercel"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"1.41.0"}]}],"database_specific":{"last_known_affected_version_range":"<= 1.40.3","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-jf75-q64q-g65r/GHSA-jf75-q64q-g65r.json"}}],"references":[{"type":"WEB","url":"https://github.com/walinejs/waline/security/advisories/GHSA-jf75-q64q-g65r"},{"type":"WEB","url":"https://github.com/walinejs/waline/pull/3646"},{"type":"WEB","url":"https://github.com/walinejs/waline/commit/e611aed4e571c2a86103f5cee48791ca6b460360"},{"type":"PACKAGE","url":"https://github.com/walinejs/waline"}],"database_specific":{"cwe_ids":["CWE-287","CWE-943"],"github_reviewed":true,"github_reviewed_at":"2026-10-28T21:17:58Z","nvd_published_at":null,"severity":"MODERATE"},"severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"}]}