Issue 91: Homograph OAuth bypass 🌏, common JWT mistakes, ReDos attacks

The Latest API Security News, Vulnerabilities and Best Practices
Issue: #91
Homograph OAuth bypass, common JWT mistakes, ReDos attacks
This week, we check out the recent OAuth bypass at SEMrush, common JWT implementation mistakes and the Semgrep tool, regular expression denial of service (DoS) attacks, and a new online course on OAuth2 and OpenID Connect.
Vulnerability: SEMrush
 

OAuth2 implementation can be tricky. SEMrush has fixed an OAuth redirect_uri bypass reported by Yassine Aboukir.

The problem was in how SEMrush handled international domain names (IDN). IDNs can include non-Latin characters that might look similar or even identical to Latin ones. For example, the Cyrillic е looks exactly like the English e, but it is actually a completely different character.

In the case of SEMrush, the vulnerability was that their code did not differentiate non-Latin characters from Latin ones. Instead, homographs, such as sémrush, sêmrush, sèmrûsh, or šemrush, were considered to be identical to semrush.

Thus, attackers could register a domain like oauth.šemrush.com (or oauth.xn--emrush-9jb.com) and make an OAuth call where the redirect_uri parameter was set to their domain. The system accepted this just fine and the redirect took the user to the attackers’ domain (oauth.šemrush.com), not the vendor one (oauth.semrush.com).

Be careful when you implement OAuth2: use well-established and trusted solutions, and make sure that your validation for strings is strict.

Tooling: Common JWT mistakes and the Semgrep tool
 

JSON Web Token (JWT) security has been a recurring theme in this newsletter. For example, see the JWT security videos in issue 72, or check out the JWT toolkit in issue 88. Not to abandon a good theme, this week we have a recent summary of the recurring issues with JWT.

Vasilii Ermilov from R2C has analyzed 2,000 node package manager (npm) modules for  different JWT security implementation flaws. The following is the list he compiled on the JWT mistakes that cropped up most often:

  • Hardcoded secrets
  • Allowing the none algorithm for signing
  • Incorrectly verified tokens (or no verification at all)
  • Sensitive data exposure

Ermilov provides code examples for each of these mistakes, as well as rules to catch these issues with his company’s tool, Semgrep.

Cheat sheet: Preventing regex DoS
 

Regular expressions (regex) are a common way to define string parameter patterns for API inputs. However, the regex language is extremely flexible, and can easily be abused to create expressions that require enormous amounts of memory and compute power to evaluate. Such attacks are known as Regular Expressions Denial of Service (ReDoS).

Image for post
Regular expressions are used all over the web stack, from client-side code to firewalls to back-end applications to database queries. If one of these regexes is (1) slow, and (2) processes dangerous input, then it is vulnerable to ReDoS. For example, Cloudflare’s firewall had a ReDoS issue in 2019, and Stack Overflow’s back-end had a ReDoS issue in 2016.

James Davis has put together a cheat-sheet for ReDos attacks and how to mitigate them. A good resource to check out!

Training: OAuth2 and OpenID Connect
 

OAuth2 and OpenID Connect (OIDC) continue to be misunderstood and misimplemented, which leads to API vulnerabilities.

Philippe De Ryck has made his course  “Introduction to OAuth 2.0 and OpenID Connect” available online for free (registration required).

The curriculum of the course includes:

  • OAuth2.0 and OIDC concepts
  • Using OAuth 2.0 with backend web clients
  • Introduction to OIDC
  • Mobile and native clients
  • Frontend web clients
  • Additional flows
 
dmitry_apisec-1  

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 Ltd   71-75 Shelton Street  Covent Garden  London  Greater London   WC2H 9JQ   United Kingdom
You received this email because you are subscribed to API Security News from 42Crunch Ltd.

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

Older messages

Issue 90: Twitter API data security incident, skimmers and Google Analytics API 💳

Thursday, July 2, 2020

Hi, this week we have a live video on API hacking, a new API security book, and two API APIsecurity.io The Latest API Security News, Vulnerabilities and Best Practices Issue: #90 Twitter API data

Issue 89: Starbucks API flaw exposes almost 100 million customer accounts ☕

Thursday, June 25, 2020

Hi, today we look at the recent API flaws at Starbucks & Drupal, BBVI APICheck tools, APIsecurity.io The Latest API Security News, Vulnerabilities and Best Practices Issue: #89 Starbucks API flaw

Issue 88: JWT pentesting, API discovery, the present and future of OpenAPI 🔭

Thursday, June 18, 2020

Hi, this week we have a new JWT security toolkit, video on API discovery, new ebook and APIsecurity.io The Latest API Security News, Vulnerabilities and Best Practices Issue: #88 JWT pentesting, API

Issue 87: Vulnerabilities in Digilocker, Facebook, VMware Cloud Director 🌩️

Thursday, June 11, 2020

Hi, this week we have a video on API recon and details of 3 recent API vulnerabilities APIsecurity.io The Latest API Security News, Vulnerabilities and Best Practices Issue: #87 Vulnerabilities in

Issue 86: Vulnerabilities in Sign in with Apple 📱, Qatar’s COVID19 app, GitLab

Thursday, June 4, 2020

Hi, this week we look at the 3 recent API vulnerabilities and a new Burp plugin APIsecurity.io The Latest API Security News, Vulnerabilities and Best Practices Issue: #86 Vulnerabilities in Sign in

You Might Also Like

JSter #234 - Libraries and more

Monday, January 6, 2025

Happy new year JavaScripters! New year, new challenges. I have a small favor to ask you. I have a MSc student researching how AI is used for web development. To help out, fill his query (5-15 mins).

WP Weekly 225 - Wins - New Launches, 2025 Predictions, Year 2024 Recap

Monday, January 6, 2025

Read on Website WP Weekly 225 / Wins All the 2024 stuff is behind us; hoping everyone is a winner going forward in this amazing WordPress community. Let's start 2025 with WordPress goodness upfront

SRE Weekly Issue #458

Monday, January 6, 2025

View on sreweekly.com A message from our sponsor, incident.io: Ever wonder how Netflix handles incidents at their scale? With incident.io, they've built a process that's smooth, scalable, and

OpenAI proposes a new corporate structure - Sync #500

Sunday, January 5, 2025

Plus: Nvidia's next move; the state of AI hardware startups; "AI factories" for war; BYD enters humanoid robot race; ChatGPT Search vs. Google Search; and more! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

🔋 You Need a Super-Fast USB Car Charger — First-Party vs. Third-Party Cookies

Sunday, January 5, 2025

Also: How I Use Shortcuts and Apple Numbers to Track My Time How-To Geek Logo January 5, 2025 Did You Know Theodore Roosevelt was the first US President to ride in an automobile while in office.

RD#487 Instance Hook Pattern

Sunday, January 5, 2025

co-located logic and controlled API ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

PD#607 Systems Ideas that Sound Good But Almost Never Work

Sunday, January 5, 2025

"let's just..." scenarios ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏

Android Weekly #656 🤖

Sunday, January 5, 2025

View in web browser 656 January 5th, 2025 Articles & Tutorials Sponsored Sick of your mobile apps crashing? Simon Grimm will show you how to fix them with less guesswork. Join Sentry's workshop

Daily Coding Problem: Problem #1659 [Easy]

Sunday, January 5, 2025

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by WhatsApp. Given an array of integers out of order, determine the bounds of the smallest

C#538 Unit Testing Clean Architecture Use Cases

Sunday, January 5, 2025

Battle-tested approach to unit testing ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌