OpenLake / OpenLake/Student_Database_COSA

Security: verify NoSQL query-operator injection risk on /auth/login (no input sanitization found)

Open
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13
Forks
58
Avg merge
20h 27m
Merged PRs (30d)
3

Description

Summary

Could not find express-mongo-sanitize or any equivalent request-sanitization middleware anywhere in the backend. Login credentials are parsed from JSON via body-parser and handed to passport-local-mongoose's authenticate(), which builds its lookup query from the raw parsed field.

Status

Not yet confirmed exploitable — this needs an actual live test (e.g. sending a payload where email/password are objects containing Mongo query operators instead of strings, against a throwaway/seeded test account) before treating it as a live finding. Flagging so it doesn't get lost, since the absence of any sanitization layer is itself worth fixing regardless of whether this specific login path turns out to be exploitable.

Suggested fix

Add express-mongo-sanitize (or equivalent manual type-checking on req.body fields expected to be strings) as global middleware in backend/index.js, and verify the login path specifically once that's in place.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in backend/index.js and trace the /auth/login path through body-parser and passport-local-mongoose's authenticate(). Test object-valued email and password inputs containing Mongo query operators against a throwaway or seeded account. Done means the exploitability is documented and the login inputs are sanitized or type-checked, with the login path verified afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, mongodb, nodejs
Domain
authentication, backend, databases, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.