SQL Injection in www.hyperpure.com
A PUT endpoint that creates sales leads appeared to pass the sales lead identifier into a SQL query without proper handling, so boolean conditions could be injected. The reporter claims this let them add arbitrary sales lead records to the database.
- Triaged in 13 hours
- Fixed in 32 days
- Paid in 14 hours
- Disclosed after 3 months
Vulnerable Request :
PUT /consumer/onboarding/saleslead/6b6a8a5a-4a74-46db-b2fe-32a46f927ecc HTTP/1.1 Host: api.hyperpure.com User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0 Accept: application/json, text/plain, / Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/json;charset=utf-8 X-Client: consumer X-TrackingId: 8242c5a2-6325-4101-96b8-c7ed6008e92a HeaderRoute: v2 APIVersion: 4.2 AppType: web Content-Length: 246 Origin: https://www.hyperpure.com Connection: close Referer: https://www.hyperpure.com/register
{"address":{"addressLine":"test","cityId":34,"state":{"name":"Gujarat"},"zipCode":"388001"},"deliveryTime":0,"email":"[email protected]","outletName":"test","phoneNumber":"█████","salesLeadId":"31cf8eb0-f81e-4c99-acad-35eae89ed659"}
The above request is used to create sales lead with the data the sales lead id is produced and verified by the domain.
Base Response Received:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: 68 Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: https://www.hyperpure.com x-envoy-upstream-service-time: 166 Server: envoy Date: Thu, 26 Nov 2020 18:48:34 GMT Connection: close Vary: Accept-Encoding
{"response":{"salesLeadId":"6b6a8a5a-4a74-46db-b2fe-32a46f927ecc"}}
Now we will be executing following steps to verify if "AND " & "OR" statements work.
- Proving AND condition working while using it with a valid sales id " AND 1 = "1 --+-
- Proving AND condition false with working sales lead using AND 1=0.
- Proving adding cool as a sales lead by using OR 1=1 , which always states true.
Impact
Adding random sales ID in the database using PUT statement and populating it.
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 sales lead identifier from the request is concatenated into a SQL query instead of being passed as a parameter.
What the attacker needed
Network access to the API; a valid sales lead identifier
How it was found
- Send a PUT request to the sales lead onboarding endpoint with a valid sales lead identifier and observe the normal response.
- Add a true AND condition to the identifier and check whether the request still succeeds.
- Add a false AND condition and check whether the behaviour changes.
- Add an OR condition that is always true and check whether a new sales lead is created.
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.
A sales lead is a record of someone interested in a product. The website builds a database command using a value from the request, and the reporter tried adding extra database logic to that value to see if it changed the result. If it does, an attacker may be able to insert or alter records they should not.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.