Issue 142: API vulnerabilities in Coursera and Huawei, GraphQL rate limiting and discovery 🔎

The Latest API Security News, Vulnerabilities and Best Practices
Issue: #142
API vulnerabilities in Coursera and Huawei, GraphQL rate-limiting and discovery
This week, we take a look at the recently reported API vulnerabilities at Coursera and in one of the Huawei home gateways. We also learn about rate-limiting for GraphQL APIs and GraphQL discovery using its autocorrect feature.
Vulnerability: Coursera
 

Coursera has fixed a number of API vulnerabilities reported by David Sopas, Paulo Silva, Ricardo Gonçalves, and Erez Yalon from Checkmarx:

  • Lack of authentication and authorization for reading or modifying user preferences
  • Account enumeration using the password reset endpoint
  • Lack of resource limiting
  • GraphQL misconfiguration

Their article explains how they found the first of the issues. While using various functions of the web app and observing the API calls that the site was making, they noticed GET calls to the endpoint /api/userPreferences.v1/{USER_ID}~{PREFERENCE_TYPE} that could retrieve 10 different types of user preferences.

When replacing the USER_ID of the authenticated user with that of another user, they noticed that they could still access the preferences data, demonstrating a lack of authorization check in the API. Even worse, they noticed that even without any authentication headers or cookies, they could still access the data, thus showing that the API was not protected by any authentication checks either:

Coursera_retrieve_preferences


Finally, they tried making PUT calls instead of GET and successfully modified user preferences through that same unprotected endpoint:

Coursera_modify_preferences

Obviously a significant breach of user privacy.

Lessons learned here:

  • Treat your backend APIs as your security boundary, and make sure they are up to it.
  • Ensure that both authentication and authorization checks are in place.
Vulnerability: Huawei DG8045
 

Device manufacturers often resort to default passwords to make the initial setup easier for consumers. If these passwords are not random, they can make such devices vulnerable to attacks.

A researcher found that Huawei DG8045 home gateway uses the last 8 characters of the device serial number as the default password.

To make things worse, the device exposes that number through a public API call GET /api/system/deviceinfo:

vulnerable_Huawei_dg8045_API

This means that if users don’t change the default password, they clearly risk attackers taking over their home gateway.

Lessons learned here:

  • Non-random default credentials are extremely dangerous and should be avoided.
  • APIs need to be protected with authentication and authorization.
  • The information that your APIs return must be clearly defined, reviewed, and enforced to avoid leaking sensitive information.
  • As a user, always change the password of any device, especially if it has a hard-coded default password, or the password is easily retrievable (like printed on the device or an easy unauthenticated API call).
Best practices: GraphQL and rate-limiting
 

API4:2019 — Lack of resources and rate-limiting can be a serious API vulnerability. Attackers can stage denial-of-service (DoS) attacks making the system unresponsive, or launch brute-force or scraping scripts to break into the system or retrieve its data. Traditionally, such attacks are prevented with rate limiting, the number of times within a period of time that an API client can call the API.

As Guilherme Vieira from Shopify explains in his article, this approach is not sufficient for GraphQL APIs. GraphQL is effectively a query language over REST APIs that allows sending complex queries and retrieving or modifying multiple objects in one call. This means that some calls can cause a lot more resource consumption than others, making request-based rate-limiting inefficient. One size clearly does not fit all.

To overcome the problem, engineers at Shopify use a point system. API clients get a certain number of complexity points that they can use within a period of time, such as 50 points per second up to a limit of 1,000 points. Then each query gets its complexity score calculated:

  • Objects: One point
  • Scalars and enums: Zero points
  • Connections: Two points plus the number of returned objects
  • Interfaces and unions: One point
  • Mutations: Ten points

The API responses returned to the caller include information on how many points were used and how many remain.

All this makes sure that no API client can go wild and consume more API resources than it is allowed. For more details and specific examples, see the original article.

Penetration testing: Attacking GraphQL Autocorrect
 

Penetration testers seek to find GraphQL schema information so they can build queries to retrieve the application data. As we have discussed in this newsletter multiple times, this is why it is important to make sure that introspection on GraphQL is not allowed in your production deployments.

In this recording from the null Ahmedabad June Meet, Somdev Sangwan discusses how the Autocorrect feature in GraphQL can be used as an attack vector even after introspection has been switched off, still allowing attackers to discover the schema. His part starts around the 33-minute mark:

Video_thumbnail_GraphQL_attack_via_autocorrect

 

 
Dmitry - transparent circle

 

 

Dmitry Sotnikov

APIsecurity.io

 
Thanks for reading.

That's it for today. If you have any feedback or stories to share, simply reply to this email.

Please forward the newsletter to your friends and colleagues who might benefit from it.

 
42Crunch, Inc.   95 Third Street  2nd Floor  San Francisco  CA   94103   United States
You received this email because you are subscribed to API Security News from 42Crunch, Inc..

Update your email preferences to choose the types of emails you receive or Unsubscribe from all future emails  
 
 

Older messages

Issue 141: API vulnerabilities in VeryFitPro and Gettr, AWS Lambda authorizers, AsyncAPI 2.1 🏅

Saturday, July 10, 2021

Hi, today we have a few recent API vulnerability case studies, a research on possible implementation flaws in AWS Lambda Authorizers, and the APIsecurity.io The Latest API Security News,

Issue 140: API vulnerabilities at LazyPay, Western Digital, and LinkedIn; IDOR mindmap 🗺️

Thursday, July 1, 2021

Hi, today we look at LinkedIn data getting scraped and WD NAS devices wiped, the recent LazyPay API flaw and an IDOR/BOLA pentesting mindmap APIsecurity.io The Latest API Security News, Vulnerabilities

Issue 139: API vulnerabilities at Apple, Amazon, and 1Sambayan, upcoming Gartner webinar

Thursday, June 24, 2021

Hi, this week we look at the details of 3 recently reported API vulnerabilities and an upcoming free webinar from Gartner APIsecurity.io The Latest API Security News, Vulnerabilities and Best Practices

Issue 138: Vulnerabilities in Microsoft Teams and Instagram

Thursday, June 17, 2021

Hi, this week in our newsletter we look at a couple of recent vulnerability reports, awesome-apisecurity repo, and upcoming DevSecCon24. APIsecurity.io The Latest API Security News, Vulnerabilities and

Issue 137: Vulnerabilities in VMware vCenter and Apache Pulsar, GraphQL and CSRF attacks

Thursday, June 10, 2021

Hi, today we look at a couple of recent API vulnerabilities, API Security in Postman, CSRF and GraphQL, my upcoming live Q&A, and a buyer's APIsecurity.io The Latest API Security News,

You Might Also Like

Apple would never make this mistake

Wednesday, May 8, 2024

Rabbit R1 AI hardware fails spectacularly ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

JSK Weekly - 8th May, 2024

Wednesday, May 8, 2024

Are you interested in combining your love for chess with your passion for coding? A comprehensive video course was just posted on the freeCodeCamp.org YouTube channel that will teach you how to code

💻 Signs You Need a New Laptop — How to Free Up Storage on the PS5

Wednesday, May 8, 2024

Also: 7 Ways to Speed Up Excel Spreadsheets, and More! How-To Geek Logo May 8, 2024 Did You Know The topmost vertebra in the human spine (C1) is called the "atlas" vertebra---a reference to

JSK Daily for May 8, 2024

Wednesday, May 8, 2024

JSK Daily for May 8, 2024 View this email in your browser A community curated daily e-mail of JavaScript news Debugging Like a Pro: 10 Tips for Effective JavaScript Troubleshooting This article will

Daily Coding Problem: Problem #1435 [Medium]

Wednesday, May 8, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Implement the singleton pattern with a twist. First, instead of storing one

Mapped | Visualizing the Tax Burden of Every U.S. State 💸

Wednesday, May 8, 2024

Tax burden measures the percent of an individual's income that is paid towards taxes. See where it's the highest by state in this graphic. View Online | Subscribe Presented by: FEATURED STORY

Noonification: Do Not Open This Article

Wednesday, May 8, 2024

Top Tech Content sent at Noon! Get Algolia: AI Search that understands How are you, @newsletterest1? 🪐 What's happening in tech today, May 8, 2024? The HackerNoon Newsletter brings the HackerNoon

Modern Payments. Now.

Wednesday, May 8, 2024

Netevia is breaking down the traditional barriers businesses face through an integrated ecosystem of payments, banking, and ISV solutions. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Top Tech Deals 😍 Beats Studio Pro, Lenovo Yoga 9i, Power Banks, and More

Wednesday, May 8, 2024

Save on a new Galaxy S24 Ultra, headphones, or an Amazon Kindle. How-To Geek Logo May 8, 2024 Top Tech Deals: Beats Studio Pro, Lenovo Yoga 9i, Power Banks, and More Save on a new Galaxy S24 Ultra,

The Disrupt Job Fair, StrictlyVC, and More

Wednesday, May 8, 2024

Join the Disrupt Job Fair TechCrunch Disrupt 2023 You know Disrupt is a great place to promote your brand and gather new leads. And sometimes by chance, employers and potential employees make new