Issue 143: GraphQL API leaking credit cards, SQLi in JWT, XML attacks mind map 🗺️

The Latest API Security News, Vulnerabilities and Best Practices
Issue: #143
GraphQL API leaking credit cards, SQLi in JWT, XML attacks mind map
This week, we have a detailed write-up on finding credit card numbers leaking from a GraphQL API, a lab walkthrough on hacking JSON web tokens (JWT) through SQL injection, and HackerOne’s new Capture The Flag (CFT) API Security challenge. On the resource side, we have another good mind map, this time on XML attack vectors with APIs.
Case study: Cracking encrypted credit card numbers exposed by an API
 

Craig Hays has published a fascinating write-up from his recent pentesting in a private bug bounty program.

The company allowed their customer to store their credit cards for ease of use. Hays managed to retrieve and decode credit card numbers that the system stored for all their customers.

The application used a GraphQL API under the hood. Hays found the ‘about me’ call that was susceptible to Broken Object-Level Authorization (BOLA) attacks. He could call that endpoint to enumerate each user in the system and retrieve their profile information.

He found that the API exposed much too much data on each user and even returned stored credit cards on file. The credit card numbers were encrypted. However, Hays noticed that the encryption was 2-way and unsalted, meaning that supplying a specific credit card number to save would always return the same, specific encrypted version of the number.

Considering that the credit card numbers are not completely random but conform to an international standard, he could create a script to enumerate all possible credit card numbers and create a rainbow table of their encrypted counterparts in the system. With such a table, he could then decrypt each card number he got from the API to cleartext by simply finding it in the table.

As Hays notes in his write-up, the main lesson learned here is again to tightly lock down your API responses and avoid exposing any more data than strictly necessary. Other things to consider:

  • As always with cases of BOLA, make sure that on top of authentication, the authorization checks are in place and enforced, so that users can only access data they are supposed to.
  • Rate limiting can help prevent easy enumeration with a flood of calls. We discussed in our last week’s newsletter the quirks of rate-limiting with GraphQL APIs.
  • If using encryption, make sure to use modern best practices: adding salt to randomize the results, and so on.
Lab walkthrough: Hacking JWTs with Blind SQLi
 

JWTs are one of the most frequently used methods to pass caller information in authentication tokens of REST API calls. When JWTs retrieve signing keys from a database using the keyID (kid) header, this itself can become a SQL injection attack vector.

If the API implementation blindly uses kid to retrieve the key from a database, attackers can pass a SQL injection such as “non-existent-index’ UNION SELECT ‘ATTACKER’; --“. Unsanitized SQL request like this will produce “ATTACKER” as the retrieved value. Thus, API would now be verifying JWT signature with the value that the attacker supplied – making it possible for the attacker to forge any tokens they like.

Shivlam Bathla from Pentester Academy has put together a great lab “Hacking JWT Tokens: Blind SQLi” for hands-on experience.

For those too busy to try this themselves, there is a step-by-step walkthrough on how the lab and the attack progresses, but you can also just read the intro for the task description and try to figure it out yourself with the lab.

If you need an overview of JWT and possible JWT attacks, see the recording from my JWT security talk at AppSec California 2020. Isabelle Mauny and I also did a webinar on the approach to externalize JWT security checks.

Capture the Flag: API security
 

CTF challenges are fun security quests and a great way to test your penetration testing skills in action.

HackerOne has just released a new “RTFM”-level CTF by Adam Langley, specifically dedicated to API security. If you are looking for a fun way to hone your skills, check it out.

Mind map: XML attacks
 

APIs that accept XML payloads can be exposed to various XML-related attacks if they do not properly define and validate these payloads.

Harsh Bothra has put together a mind map of possible XML attack vectors, both as an XMind map and a PDF. Many of the attack vectors also provide reference links to further reading.

XML_attacks_mindmap

 

 
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 142: API vulnerabilities in Coursera and Huawei, GraphQL rate limiting and discovery 🔎

Friday, July 16, 2021

Hi, this week we look at the recent vulnerabilities in Coursera & Huawei, and discuss rate-limiting best practices for GraphQL as well as new APIsecurity.io The Latest API Security News,

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

You Might Also Like

Introducing our new mobile app! 🥁📱

Tuesday, April 16, 2024

Inside: a major new mobile update and a limited edition giveaway 🎁 Get it on Google Play Get it on Google Play Add to Home Screen Add to Home Screen Giveaway! 🎁 When we launch things, we like to

BetterDev #256 - How to write a code formatter and a search engine in 80 lines of Python

Tuesday, April 16, 2024

Better Dev #256 Apr 15, 2024 Hi all, We come back with a new issue this week. If you like BetterDev, please help spead word out by refer to your friends. Buy Me a coffee would be great too. This issue

New Blogs on ThomasMaurer.ch for 04/16/2024

Tuesday, April 16, 2024

View this email in your browser Thomas Maurer Cloud & Datacenter Update This is the update for blog posts on ThomasMaurer.ch. Automate on-premises Windows Server from the cloud using Azure Arc By

April TC39 meeting; Rspack v0.6; future of JS packages; Evan You on Vue, Vite, etc.

Tuesday, April 16, 2024

We have 7 links for you - Stay up-to-date on JavaScript and tools This Week In React - Keeps senior React devs up to date thisweekinreact.com Partner We keep over 37k mid/senior React devs up-to-date

Ingesting & Using CAD Data for Real-Time 3D

Tuesday, April 16, 2024

How engineering firms leverage real-time 3D technology View this email in your browser engineering.com White Paper - Ingesting and Using CAD Data for Real-Time 3D Ingesting and Using CAD Data for Real-

It’s Easy. But Is It Easy Enough? 🤓

Monday, April 15, 2024

Is self-hosting still too hard for normal people? Here's a version for your browser. Hunting for the end of the long tail • April 15, 2024 It's Easy. But Is It Easy Enough? Self-hosted apps are

Re: Free Class: Master the Notes app

Monday, April 15, 2024

Hi there, We are holding a Free Notes App Class tomorrow (Wednesday, April 17) at 4:30 pm ET! We do expect this class to fill up so register soon to save your spot! I wanted to take a minute to answer

Two Tesla execs leave amid layoffs

Monday, April 15, 2024

Tesla execs bid adieu View this email online in your browser By Christine Hall Monday, April 15, 2024 Welcome back to TechCrunch PM, where you can find me each day bringing you the most important

🍏 Why You Should Buy the MacBook Air Over the Pro — Thrift Stores Are a Goldmine for Geeks

Monday, April 15, 2024

Also: How to Play Epic Game Titles on the Steam Deck, and More! How-To Geek Logo April 15, 2024 📩 Get expert reviews, the hottest deals, how-to's, breaking news, and more delivered directly to your

JSK Daily for Apr 15, 2024

Monday, April 15, 2024

JSK Daily for Apr 15, 2024 View this email in your browser A community curated daily e-mail of JavaScript news Embracing Functional Programming: Streamlining Code with Reusability and Maintainability