Skip to content
SQL injection Write-up Intermediate

Meteor Blind NoSQL Injection

A publicly callable Meteor method accepted a user-supplied object as a query, allowing an attacker to test conditions against the database and extract user data such as tokens character by character. The attacker could infer sensitive values through Boolean responses.

medium.com

Published on medium.com

{{media:0}}

Kert Ojasoo, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Meteor method passed user-controlled input directly into a database query without validation, enabling NoSQL injection.

Impact

An attacker could extract sensitive user data such as tokens or password hashes through Boolean-based blind NoSQL injection.

What the attacker needed

A publicly callable Meteor method that accepts user input; The method uses the input in a database query without…

The fix

All Meteor methods should validate and restrict user input before using it in business logic or database queries.

How it was found

  1. Call the users.count method with an empty object to get the total number of users.
  2. Call the method with a query object containing a username to see if it returns 1.
  3. Use a regular expression in the query to test if a user's token starts with a certain character.
  4. Iteratively narrow down the character using binary search and prepend found characters to extract the full token.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Meteor is a framework for building web apps. A method is a function that the client can call on the server. Here, the method took an object from the user and used it directly in a database query, so an attacker could ask questions like 'does this user's token start with a?' and get a yes/no answer. By repeating, they could guess the whole token.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.