Summary
A Broken Function Level Authorization vulnerability in the “route.json” file of the NPM’s package @evershop/evershop prior to 1.0.0-rc.8 allows unauthenticated attackers to delete customer accounts through a publicly accessible GraphQL endpoint. Attackers can chain this with another vulnerability found in the GraphQL schema, first by querying the schema to identify the “Customer” object and get the relevant “uuid” of a user. Then the attackers are able to send a DELETE request to the unprotected endpoint, resulting in the successful deletion of the user account. This was fixed by closing public access to the endpoint so it requires users to be authenticated with ‘admin’ credentials in order to request it.
Product
This vulnerability affects NPM’s package @evershop/evershop in versions prior to 1.0.0-rc.8.
Impact
An unauthenticated user can send a DELETE request to the endpoint and successfully delete every account on an EverShop instance
Steps to reproduce
- Install the
@evershop/evershoppackage dependency for any version prior to 1.0.0-rc.8 - Run the EverShop Web Application on localhost
- Make a
POSTrequest to GraphQL API with the following query to learn about all the objects present in the database, and the respective fields:{"query": "{__schema{types{name,fields{name,args{name,description,type{name,kind,ofType{name, kind}}}}}}}"} - After locating the “Customer” object, Make a
POSTrequest to GraphQL API with the following query to retrieve “deleteAPI” field:{"query": "query { customers(filters:[]) { currentFilters { operation } total items { customerId uuid email fullName deleteApi} }}"} - Use the “deleteAPI” field that contains the specific endpoint to delete a given user by sending
DELETErequest
Expected result:
The user will be deleted from the Evershop system.
Remediation
A fix was released in commit 69f7f89, which involved restricting public access to the endpoint. Users are required to be authenticated with ‘admin’ credentials in order to request it.
Credit
This issue was discovered and reported by Checkmarx SCA Security Analyst Mário Teixeira.