Skip to content
Info disclosure Disclosed report Beginner

SQL exception in JSON format

When a username longer than 64 characters is submitted twice, the application returns a raw SQL exception instead of a friendly error message, revealing database details.

clizsec Follow

Originally disclosed on HackerOne

  • Triaged in 25 hours
  • Fixed in 4 months
  • Disclosed after 2.8 years

Hi, I know this is not critical, just a design issue, but it will be better if it will not show up to the user as an error, maybe in log files readable to the www-user or to the root user in order to debug.

PoC:

  1. Create a user and confirm the password
  2. Capture the packet
  3. Replay the packet with a username bigger than 64 words in length two times in order to duplicate the user.
  4. Receiving error.

This is working only when the input for the username is bigger than 64 words. (65 needed.)

Example:

Request - POST http://172.16.1.68/nextcloud/index.php/settings/users/users HTTP/1.1 DATA: username=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&password=test123A

Response -

{"message":"An exception occurred while executing 'INSERT INTO `oc_users` ( `uid`, `password` ) VALUES( ?, ? )' with params [\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"1|$2y$10$gwzH19jqn8HveRpCb2haNurF7rycqsZeYYS7b1zPENnUInUyP35J2\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for key 'PRIMARY'"}

Example:

Request - POST http://172.16.1.68/nextcloud/index.php/settings/users/users HTTP/1.1 DATA: username=aaaaaaa&password=test123A

Response -

{"message":"A user with that name already exists."}

The original report as published on HackerOne, by clizsec. 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 does not validate the username length before attempting a database insert, and it returns the raw database exception to the client instead of a generic error message.

Impact

An attacker could see database error details, which may help in further attacks, but the report notes this is not critical and only occurs with overly long usernames.

What the attacker needed

Ability to send HTTP requests; username longer than 64 characters

The fix

The application should validate username length and return a generic error message instead of exposing the raw SQL exception.

How it was found

  1. Create a user and confirm the password.
  2. Capture the packet.
  3. Replay the packet with a username longer than 64 characters, twice, to duplicate the user.
  4. Observe the SQL error in the response.

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 application tries to save a new user to a database. If the username is too long, the database rejects it and the application shows the full database error to the user. This error reveals internal details like table names and SQL commands, which should normally be hidden.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by clizsec

View all

3 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.