{"id":"GHSA-jf75-q64q-g65r","kind":"vulnerability","aliases":["GHSA-jf75-q64q-g65r"],"related":[],"title":"Waline login accepts a non-string email as a match-all MongoDB query","description":"## 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.","summary":"Waline's login endpoint passes the request's email field to a MongoDB query without checking its type, so a JSON object like {\"$ne\": null} is dropped and matches all users. The password is then checked against the first-registered user, usually the site administrator, which lets an attacker test passwords against that account without knowing its email.","severity":"medium","cvss":6.5,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"@waline/vercel","fixed":["1.41.0"],"affected":"<= 1.40.3","ecosystem":"npm"}],"ecosystems":["npm"],"tags":["cwe-287","cwe-943","mongodb","node","package","vercel","waline"],"not_affected_if":["already-on-1.41.0"],"how_to_check":"- Run `npm ls @waline/vercel` in the project and look for a version at or below `1.40.3`.\n- Check the lockfile (`package-lock.json`, `pnpm-lock.yaml` or `yarn.lock`) for `@waline/vercel` versions at or below `1.40.3`.\n- Confirm whether the deployment uses MongoDB storage, since the faulty filter handling is in the MongoDB adapter.","fix":"- Upgrade `@waline/vercel` to `1.41.0` or later.\n- Redeploy, then check that the installed version is `1.41.0` or later.","status":"open","published_at":"2026-10-28T21:17:58+00:00","first_seen_at":"2026-10-28T21:22:55+00:00","triaged_at":"2026-10-28T21:24:13+00:00","updated_at":"2026-10-28T21:24:13+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-10-28T21:24:13Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade `@waline/vercel` to `1.41.0` or later.\n- Redeploy, then check that the installed version is `1.41.0` or later.","reach":"internet","title":"Waline: non-string login email matches every user, exposing admin password check","impact":"medium","summary":"Waline's login endpoint passes the request's email field to a MongoDB query without checking its type, so a JSON object like {\"$ne\": null} is dropped and matches all users. The password is then checked against the first-registered user, usually the site administrator, which lets an attacker test passwords against that account without knowing its email.","category":"package","nicknames":[],"who_cares":["waline","vercel","node","mongodb"],"confidence":0.8,"needs_auth":"no","worst_case":"Admin password tested without email; users enumerated; admin login if password valid.","analyst_note":"","how_to_check":"- Run `npm ls @waline/vercel` in the project and look for a version at or below `1.40.3`.\n- Check the lockfile (`package-lock.json`, `pnpm-lock.yaml` or `yarn.lock`) for `@waline/vercel` versions at or below `1.40.3`.\n- Confirm whether the deployment uses MongoDB storage, since the faulty filter handling is in the MongoDB adapter.","needs_analyst":false,"not_affected_if":["already-on-1.41.0"],"who_is_affected":"Deployments that run @waline/vercel at version 1.40.3 or earlier are exposed through the POST /api/token login endpoint. The flaw is in the MongoDB storage path, so deployments on other storage are less clearly affected and the sources do not say. Teams already on 1.41.0 or later can skip it.","user_interaction":"no","needs_special_setup":"unknown","severity_if_unknown":"unknown"},"cost_usd":0.001313,"input_tokens":4960,"output_tokens":1635,"severity_before":"medium"},"analyst_status":null,"analyst_note":null,"search":"'-18':280C '-26':401C '-287':28B '-38':451C '-943':30B '/api/token':100C,486C '0':173C,334C,420C,423C,518C '1':225C '17':279C '2':235C '3':251C '37':450C 'accept':3A 'account':90B,234C,268C,616C,653C 'adapt':140C,303C 'add':362C,503C 'admin':632C 'administr':81B,185C,233C,267C,272C,444C,526C,537C,559C,564C,606C,626C 'amplif':255C 'amplifi':621C 'application/json':491C 'arbitrari':610C 'array':352C,378C 'array.isarray':329C 'async':452C 'attack':85B,197C,257C,554C,591C,646C 'authent':190C,556C,598C 'await':288C,454C 'bodi':108C,296C 'branch':249C,357C 'bypass':191C,214C,587C,593C 'captcha':463C 'check':51B,71B,110C,300C,460C,534C,612C 'checkpassword':416C 'code':284C 'come':292C 'concept':472C 'concret':222C 'confirm':576C 'const':281C,286C,415C 'content':489C 'content-typ':488C 'continu':321C 'credenti':253C,547C,622C 'credential-stuf':252C 'cwe':27B,29B 'detail':275C 'direct':613C,642C 'disclos':219C 'drop':62B,144C,305C 'e.g':380C,654C 'earliest':436C 'earliest-regist':435C 'effect':223C,395C 'email':8A,44B,94B,103C,123C,242C,274C,282C,290C,291C,366C,478C,492C,497C,566C,584C,633C 'email/identifier':227C,595C 'email/password':468C 'empti':154C,413C 'enabl':618C 'endpoint':39B,98C,161C 'enumer':237C,580C,620C 'eq':320C 'even':567C 'ever':561C 'everi':375C 'exampl':129C,545C 'exist':579C 'factor':228C,585C,596C 'fail':244C 'field':45B,104C,146C 'filter':155C,317C,364C,370C,510C 'find':373C 'first':75B,169C,180C,205C,396C,426C,521C,602C 'first-regist':74B,179C,520C,601C 'form':379C 'full':194C 'g65r':20A,25A 'genuin':383C 'ghsa':17A,22A 'ghsa-jf75-q64q-g65r':16A,21A 'guard':323C 'handl':336C 'hash':539C 'http/1.1':487C 'i.e':433C,524C 'impact':588C 'in/like':337C 'inject':385C 'input':277C 'insert':431C 'instance.where':371C 'intend':322C 'isbannedus':406C 'isstr':467C 'isverifyus':405C 'jf75':18A,23A 'json':56B,131C 'k':316C,319C,326C,331C,333C 'key':310C 'know':92B,270C,562C,630C 'knowledg':213C 'known/weak':551C 'leak':261C,635C 'let':83B 'like':58B 'login':2A,38B,97C,475C 'match':12A,64B,157C,393C,410C,543C,573C 'match-al':11A,392C,409C 'mongodb':14A,31B,48B,119C,138C,372C,429C,513C 'natur':430C 'ne':59B,135C,343C,388C,493C 'need':199C,628C 'neither':346C 'never':243C 'node':32B 'non':6A,240C,308C,482C 'non-str':5A,239C,307C,481C 'none':354C 'noth':360C,504C 'null':60B,136C,344C,494C 'object':57B,132C,340C 'one':195C,657C 'oper':335C,384C 'order':432C 'packag':33B 'packages/server/src/controller/token.js':278C 'packages/server/src/logic/token.js':449C 'packages/server/src/service/storage/mongodb.js':311C 'parsekey':318C 'parsewher':142C,312C,502C 'partial':189C 'pass':40B,114C,414C 'password':68B,87B,166C,202C,220C,264C,283C,418C,421C,495C,532C,542C,552C,570C,611C,638C,650C 'plain':339C 'possess':647C 'post':99C,485C 'postact':453C 'pre':459C 'pre-check':458C 'produc':152C 'proof':470C 'q64q':19A,24A 'queri':15A,49B,121C,509C 'rather':147C 'reach':387C 'read':101C 'record':427C 'regist':76B,181C,437C,522C,603C 'reject':149C 'remov':230C 'request':42B,107C,151C,295C,476C,575C 'result':368C 'return':171C,374C,407C,514C 'reused/breached':656C 'run':358C 'select':399C,528C 'send':473C 'silent':143C,304C 'site':80B,184C 'still':198C 'storag':120C,139C,302C 'straight':116C 'string':7A,127C,241C,309C,348C,483C,501C 'stuf':254C,548C,623C 'submit':165C,531C 'summari':95C 'test':86B,259C,641C 'think.isempty':403C 'think.isstring':314C 'this.checkpassword':417C 'this.fail':408C 'this.modelinstance.select':289C 'this.post':285C 'this.usecaptchacheck':455C 'token.js:22':400C 'type':53B,112C,299C,447C,490C 'unauthent':590C 'undefin':327C,349C 'untyp':276C 'upstream':446C 'user':66B,77B,159C,170C,172C,182C,206C,236C,248C,287C,376C,397C,404C,419C,422C,438C,516C,517C,523C,578C,604C,619C 'usual':78B 'valid':201C,448C,469C,649C 'valu':484C 'vercel':34B 'verifi':163C 'via':546C 'walin':1A,35B,36B,176C,441C 'waline/vercel':26A 'weak':263C,637C 'whose':477C 'without':50B,91B,109C,269C,560C 'zero':212C 'zero-knowledg':211C","nicknames":[],"mitigations":[],"who_affected":"Deployments that run @waline/vercel at version 1.40.3 or earlier are exposed through the POST /api/token login endpoint. The flaw is in the MongoDB storage path, so deployments on other storage are less clearly affected and the sources do not say. Teams already on 1.41.0 or later can skip it.","tier":"C","verified":{},"analyst_revisit_at":null,"first_public_at":"2026-10-28T21:17:58+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-jf75-q64q-g65r","url":"https://github.com/advisories/GHSA-jf75-q64q-g65r","severity":"medium","published_at":"2026-10-28T21:17:58+00:00","modified_at":"2026-10-28T21:17:59+00:00","first_seen_at":"2026-10-28T21:22:55+00:00","fetched_at":"2026-10-28T21:22:55+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}