GHSA-jf75-q64q-g65r: Waline login accepts a non-string email as a match-all MongoDB query
Waline server (@waline/vercel) versions up to 1.40.3 accept a non-string email on POST /api/token and turn it into a match-all MongoDB query. The password is then checked against the first-registered user, normally the administrator. An attacker still needs that password, so this is a partial authentication bypass. Upgrade to 1.41.0.
Published Oct 28, 2026 · Analysis Nov 1, 2026
What an attacker can do
The login handler in packages/server/src/controller/token.js reads email from the request body and passes it to the storage query with no type check. In the MongoDB adapter, parseWhere() handles strings, undefined and arrays. A JSON object such as {"$ne": null} matches none of those branches, so the field is dropped and the filter becomes {}. MongoDB returns every user, and the handler checks the submitted password against user[0], the earliest-registered account.
An unauthenticated attacker who can reach the Waline server can therefore skip the email factor for the administrator account. The attacker can test leaked or weak passwords against the admin without knowing the admin email. A non-string email also never hits the no-such-user branch, which allows user enumeration. The array form, for example ["!=", ""], is a real operator injection with the same match-all effect.
The flaw does not reveal passwords and does not let the attacker choose which account is targeted. The only pre-check on the route is the captcha. Deployments that use MongoDB storage are exposed.
Who is affected
Affected: @waline/vercel 1.40.3 and earlier, when Waline runs on the MongoDB storage adapter. The advisory ties the match-all behavior to the MongoDB adapter code. Check the installed version:
npm ls @waline/vercelIf you deploy on Vercel or a similar host, check the version pinned in your project package.json.
@waline/vercel
- Ecosystem
- npm
- Affected
- <= 1.40.3
- Fixed in
- 1.41.0
- Check
npm ls @waline/vercel
How to fix it
Upgrade @waline/vercel to 1.41.0.
npm install @waline/[email protected]The fix (pull request 3646) adds input validation rules for email and password to TokenLogic.postAction in packages/server/src/logic/token.js. The advisory suggests rejecting non-string values with a 400 error. It also suggests hardening parseWhere() in mongodb.js to reject unsupported value types instead of dropping them. Until you upgrade, make sure the administrator password is strong and not reused.
How to tell if you were hit
Look in web server or proxy logs for POST /api/token requests where the JSON body has email as an object or array, for example a body containing $ne or an operator array. Repeated token requests from one source with varied passwords point to credential stuffing against the admin account. Check the admin account for logins from unfamiliar IPs, and review comments, settings and user roles for changes you did not make.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
The 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.
This 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.
Details
Untyped input — packages/server/src/controller/token.js:17-18:
const { email, password, code } = this.post();
const user = await this.modelInstance.select({ email });email comes from the request body with no type check.
The storage adapter silently drops a non-string key — packages/server/src/service/storage/mongodb.js, parseWhere():
if (think.isString(where[k])) { filter[parseKey(k)] = { $eq: ... }; continue; } // intended guard
if (where[k] === undefined) { ... }
if (Array.isArray(where[k]) && where[k][0]) { ... operator handling (IN/LIKE/!=/> ...) }A 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.)
First user is selected — token.js:22-26:
if (think.isEmpty(user) || isVerifyUser || isBannedUser) { return this.fail(); } // match-all -> not empty -> passes
const checkPassword = this.checkPassword(password, user[0].password);user[0] is the first record in MongoDB natural (insertion) order, i.e. the earliest-registered user, which in Waline is the administrator.
No upstream type validation — packages/server/src/logic/token.js:37-38:
async postAction() { await this.useCaptchaCheck(); }The only pre-check is the captcha; there is no isString(email/password) validation.
Proof of Concept
Send a login request whose email is a non-string value:
POST /api/token HTTP/1.1
Content-Type: application/json
{"email": {"$ne": null}, "password": "<password-to-test>"}- Because
emailis not a string, parseWhere adds nothing for it, so the query filter is {} and MongoDB returns all users. - user[0] — the first-registered user, i.e. the administrator — is selected, and the submitted password is checked against the administrator's hash.
- 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.
- Even when the password does not match, the request confirms that users exist (enumeration) and that the email factor is bypassable.
Impact
An 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:
- enables user enumeration;
- amplifies credential stuffing against the administrator (no need to know the admin email — a leaked or weak password can be tested directly);
- and, when the attacker possesses a valid password for that account (e.g. a reused/breached one), results in administrator login.
This 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.)
Remediation
Validate the types of email and password as strings before they reach the storage query — for example in packages/server/src/logic/token.js postAction():
const { email, password } = this.post();
if (!think.isString(email) || !think.isString(password)) {
return this.ctx.throw(400, 'Invalid input type');
}Defense 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.
Credited to dizconnectz.
Questions
- Can an attacker log in as admin without the password?
No. The advisory says this is not a zero-knowledge bypass. The attacker must still supply the correct password for the first-registered user, who is normally the administrator.
- Which version fixes GHSA-jf75-q64q-g65r?
@waline/vercel 1.41.0. Versions up to and including 1.40.3 are affected.
- Does this need authentication or user interaction?
Neither. The CVSS vector shows network access with no privileges and no user interaction. The advisory rates it Medium because the attacker still needs a valid password.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
