Skip to content
SQL injection Disclosed report Intermediate

Object injection in `stripe-billing-typographic` GitHub project via /auth/login

The login endpoint accepted a JSON object in the email field, which was passed to a SQL query and caused an authentication bypass. An attacker could log in as any user by supplying a valid password, without knowing the victim's email.

ph0r3nsic Follow

Originally disclosed on HackerOne

  • Triaged in 35 days
  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 22 months

Summary:

It is possible to use an object injection failure to achieve a sql injection, where attacker uses the means to bypass authentication, requiring only a valid password within the database.

The vulnerable code is: https://github.com/stripe/stripe-billing-typographic

For a failure to occur, it is necessary that the environment is configuring with the mysql database.

The same scenario is seen in the demonstration environment: https://typographic.io/

Steps To Reproduce:

  1. Register a simple user in the application, with a password at your desire. Ex:
user: [email protected]
password:123
  1. Send a request to /auth/login like this:
POST /auth/login

{"email":{"email":1},"password":"1234"}
  1. You will then see that the login was performed without the need to provide a valid user!
Captura_de_Tela_2021-05-03_a_s_18.05.45.png
Captura_de_Tela_2021-05-03_a_s_18.05.45.png From the original on HackerOne

Supporting Material/References:

Well, the failure occurs due to the possibility of an object reaching the query, which will be handled by a dependency called sqlstring, performing some scapes, where it will cause a confusion to the query.

Sqlstring will handle {,} replacing with `. So your login query will be:

SELECT * FROM `accounts` WHERE `email`=`email`=1

The sql string library is a dependency on the mysql library, which is used by knex.

Mitigation

Is a simple step, use JSON.stringfy e resolve your problem, because JSON.stringfy will transform the malicious object into a string, preventing treatment during a query.

Impact

This vulnerability to the applied scenario makes it easier for the attacker to acquire accounts, as the attacker only needs to discover a valid password to gain access to the victim's account.

The original report as published on HackerOne, by ph0r3nsic. 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

Root cause

Likely the application passed a user-supplied object directly into a SQL query without converting it to a string, allowing the database library to misinterpret it.

Impact

An attacker could take over accounts by discovering only a valid password, bypassing the need to know the victim's email.

What the attacker needed

MySQL database configured; Knowledge of a valid password

The fix

The application should convert the email input to a string (for example with JSON.stringify) before using it in a query.

How it was found

  1. Register a normal user account with any password.
  2. Send a login request where the email field is a JSON object instead of a string.
  3. Observe that the login succeeds without a valid user email.

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 login form expected a simple text email, but the server also accepted a structured object. That object was inserted into a database query, confusing the query so it matched any account with the supplied password. This let an attacker log in as someone else if they knew that person's password.

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 ph0r3nsic

View all

1 more disclosed report, best first.

More from Stripe

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.