APIs

APIs are essential nowadays, make them secure

About

A foundational element of innovation in today’s app-driven world is the API. From banks, retail and transportation to IoT, autonomous vehicles and smart cities, APIs are a critical part of modern mobile, SaaS and web applications and can be found in customer-facing, partner-facing and internal applications. By nature, APIs expose application logic and sensitive data such as Personally Identifiable Information (PII) and because of this have increasingly become a target for attackers. Without secure APIs, rapid innovation would be impossible. [1]

Best practices

Extracted from [2], [3] and [4].

Authentication

JWT (JSON Web Tokens)

Access

OAuth

Input

Processing

Output

CI/CD

Monitoring

More!

Resources

Find here other resources for APIs security...

Tools

Generic

  • API Development tools: A collection of useful resources for building RESTful HTTP+JSON APIs.

  • API Guesser: Simple website to guess API Key / OAuth Token by Muhammad Daffa.

  • API Key Leaks: Tools and exploits: An API key is a unique identifier that is used to authenticate requests associated with your project. Some developers might hardcode them or leave it on public shares.

  • Key-Checker (⚠️): Go scripts for checking API key / access token validity.

  • Keyhacks: Keyhacks is a repository which shows quick ways in which API keys leaked by a bug bounty program can be checked to see if they’re valid.

  • Private key usage verification: Driftwood is a tool that can enable you to lookup whether a private key is used for things like TLS or as a GitHub SSH key for a user.

  • Burp API enumeration: Using Burp to Enumerate a REST API.

  • ZAP scanning: Scanning APIs with ZAP.

  • ZAP exploring: Exploring APIs with ZAP.

  • ZAP API Scan: A ZAP add-on that automates API security scanning.

  • w3af scanning: Scan REST APIs with w3af.

  • Wallarm Free API Firewall: Fast and light-weight API proxy firewall for request and response validation by OpenAPI specs.

  • dredd: Language-agnostic HTTP API Testing Tool.

  • getallurls (gau): Fetch known URLs from AlienVault’s Open Threat Exchange, the Wayback Machine, and Common Crawl.

  • SoapUI: SoapUI is a free and open-source cross-platform functional testing solution for APIs and web services.

  • Step CI: Open-source framework for API Quality Assurance, which tests REST, GraphQL and gRPC automated and from Open API spec.

  • unfurl: Pull out bits of URLs provided on stdin.

  • ModSecurity: An open-source web application firewall (WAF) that can help protect APIs.

GraphQL

  • BatchQL (⚠️): GraphQL security auditing script with a focus on performing batch GraphQL queries and mutations.

  • clairvoyance: Obtain GraphQL API schema despite disabled introspection!.

  • GraphQLmap: GraphQLmap is a scripting engine to interact with a graphql endpoint for pentesting purposes.

  • graphql-path-enum: Tool that lists the different ways of reaching a given type in a GraphQL schema.

  • graphql-playground: GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).

  • graphql-threat-matrix: GraphQL threat framework used by security professionals to research security gaps in GraphQL implementations.

  • graphw00f: graphw00f is GraphQL Server Engine Fingerprinting utility for software security professionals looking to learn more about what technology is behind a given GraphQL endpoint.

  • graphql-shield: A library for securing GraphQL APIs with fine-grained access control.

SOAP

  • Wsdler (⚠️): WSDL Parser extension for Burp.

  • wsdl-wizard (⚠️): WSDL Wizard is a Burp Suite plugin written in Python to detect current and discover new WSDL (Web Service Definition Language) files.

REST APIs

  • Akto: API discovery, automated business logic testing and runtime detection.

  • APICheck: The DevSecOps toolset for REST APIs.

  • APIClarity: Reconstruct Open API Specifications from real-time workload traffic seamlessly.

  • APIFuzzer: Fuzz test your application using your OpenAPI or Swagger API definition without coding.

  • APIKit: Discovery, Scan and Audit APIs Toolkit All In One.

  • Arjun: HTTP parameter discovery suite.

  • Astra: Automated Security Testing For REST API’s.

  • Automatic API Attack Tool (⚠️): Imperva’s customizable API attack tool takes an API specification as an input, generates and runs attacks that are based on it as an output.

  • CATS: CATS is a REST API Fuzzer and negative testing tool for OpenAPI endpoints.

  • Cherrybomb: Stop half-done API specifications with a CLI tool that helps you avoid undefined user behaviour by validating your API specifications.

  • ffuf: Fast web fuzzer written in Go.

  • fuzzapi (⚠️): Fuzzapi is a tool used for REST API pentesting anTnT-Fuzzerd uses API_Fuzzer gem.

  • gotestwaf: An open-source project in Golang to test different web application firewalls (WAF) for detection logic and bypasses.

  • kiterunner (⚠️): Contextual Content Discovery Tool.

  • Metlo | Open-source API security tool: to discover, inventory, test, and protect your APIs.

  • mitmproxy2swagger: Automagically reverse-engineer REST APIs via capturing traffic.

  • Optic: Verify the accuracy of your OpenAPI 3.x spec using real traffic and automatically apply patches that keep it up-to-date.

  • RESTler: RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.

  • Swagger-EZ: A tool geared towards pentesting APIs using OpenAPI definitions.

  • TnT-Fuzzer (⚠️): OpenAPI 2.0 (Swagger) fuzzer written in python. Basically TnT for your API.

  • wadl-dumper: Dump all available paths and/or endpoints on WADL file.

  • fuzz-lightyear (⚠️): A pytest-inspired, DAST framework, capable of identifying vulnerabilities in a distributed, micro-service ecosystem through chaos engineering testing and stateful, Swagger fuzzing.

Books

Videos & presentations

YouTube Playlists

Other videos & presentations

Specifications

Learning

Learning Path

Topic

Resources

Understanding APIs and their importance

API Security Basics

Authentication and Authorization

API Security Best Practices

Rate Limiting and Throttling

Input Validation and Sanitization

Transport Security

API Security Testing

Project 1 - Building a Secure RESTful API

Project 2 - Implementing OAuth 2.0 and JWT

Project 3 - API Security Audit

Workshops & labs

  • API security, REST Labs: Pentester Academy - attack & defense.

  • API Security University: APIsec University provides training courses for application security professionals.

  • BankGround API: Banking-like REST and GraphQL API for training/learning purposes.

  • GraphQL challenges: GraphQL Week on The Hacker101 Capture the Flag Challenges.

  • GraphQL Labs: GraphQL Labs on the OWASP Security Knowledge Framework.

  • Hacking APIs: Hacking APIs: workshop.

  • OWASP Top 10 for API: Is a series of free interactive application security training modules that teach developers how to identify and mitigate security vulnerabilities in their web API endpoints.

  • Practical API Security Walkthrough: Learn practical Mobile and API security techniques: API Key, Static and Dynamic HMAC, Dynamic Certificate Pinning, and Mobile App Attestation.

Fuzzing and others

Vulnerable APIs to learn

  • APISandbox: Pre-Built Vulnerable Multiple API Scenarios Environments Based on Docker-Compose.

  • Bookstore: TryHackMe room - A Beginner level box with basic web enumeration and REST API Fuzzing.

  • crAPI: completely ridiculous API (crAPI)

  • Damn-Vulnerable-GraphQL-Application: Damn Vulnerable GraphQL Application is intentionally vulnerable implementation of Facebook’s GraphQL technology to learn and practice GraphQL Security.

  • Damn Vulnerable Micro Services (⚠️): This is a vulnerable microservice written in many languages to demonstrating OWASP API Top Security Risk (under development).

  • Damn Vulnerable Web Services: Damn Vulnerable Web Services is a vulnerable web service/API/application that we can use to learn webservices/API vulnerabilities.

  • Generic-University: Vulnerable API with Laravel App.

  • node-api-goat: A simple Express.JS REST API application that exposes endpoints with code that contains vulnerabilities.

  • Pixi (⚠️): The Pixi module is a MEAN Stack web app with wildly insecure APIs!

  • REST API Goat (⚠️): This is a β€œGoat” project so you can get familiar with REST API testing.

  • VAmPI: Vulnerable REST API with OWASP top 10 vulnerabilities for APIs.

  • vAPI: vAPI is Vulnerable Adversely Programmed Interface which is Self-Hostable API that mimics OWASP API Top 10 scenarios through Exercises.

  • vulnapi: Intentionaly very vulnerable API with bonus bad coding practices.

  • vulnerable-graphql-api (⚠️): A very vulnerable implementation of a GraphQL API.

  • Websheep: Websheep is an app based on a willingly vulnerable ReSTful APIs.

  • DVNA (⚠️): Damn Vulnerable Node.js Application with insecure APIs.

  • WebGoat: A deliberately insecure web app for security training.

  • Juice Shop: A modern, intentionally insecure web application

  • Gruyere: A web application with security holes used for training.

  • Railsgoat: A vulnerable Ruby on Rails application for learning security.

  • Mutillidae: A deliberately vulnerable set of PHP scripts.

  • NodeGoat: A Node.js/Express app with security vulnerabilities.

  • Hackazon (⚠️): A modern, vulnerable e-commerce web app.

  • GoatDroid (⚠️): A vulnerable Android app with insecure APIs.

  • AltoroJ: A vulnerable Java web app for learning application security.

  • Hackademic (⚠️): A vulnerable web app to learn and practice web application security.

Others

  • The API Specification Toolbox: This Toolbox goal is to try and map out all of the different API specifications in use, as well as the services, tooling, extensions, and other supporting elements.

  • Understanding gRPC, OpenAPI and REST: gRPC vs REST: Understanding gRPC, OpenAPI and REST and when to use them in API design.

  • API security design best practices: API security design best practices for enterprise and public cloud.

  • REST API Design Guide: This design guide or style guide contains best practices suitable for most REST APIs.

  • How to design a REST API: How to design a REST API? - Full guide tackling security, pagination, filtering, versioning, partial answers, CORS, etc.

  • Awesome REST: A collaborative list of great resources about RESTful API architecture, development, test, and performance. Feel free to contribute to this ongoing list.

  • Collect API Requirements: Collecting Requirements for your API with APIOps Cycles.

  • API Audit: API Audit is a method to ensure APIs are matching the API Design guidelines. It also helps check for usability, security and API management platform compatibility

Podcasts

Wikis & Collections

Mind maps:

Books, collections:

Newsletters

  • The Hacker News: A blog and newsletter that covers various API topics, including security.

  • API Evangelist: A blog and newsletter by Kin Lane that covers various API topics, including security.

  • The New Stack: A platform for news and analysis on various technology topics, including API security. Subscribe to their newsletter for regular updates.

  • Secjuice: A cybersecurity publication with a dedicated section for API security articles. Subscribe to their newsletter for updates.

  • Security Weekly: A cybersecurity podcast network and newsletter that occasionally covers API security topics.

  • StatusCode Weekly: A weekly newsletter that covers web operations and occasionally includes API security articles.

  • api security articles: API Security Articles - The Latest API Security News, Vulnerabilities & Best Practices.

Conferences

  • APIsecure: The world’s first conference dedicated to API threat management; bringing together breakers, defenders, and solutions in API security.

Others

Sources

[1]: OWASP API Security Project | OWASP Foundation

[2]: JBAhire/awesome-api-security-essentials: Awesome API Security: A Curated Collection of Resources for Bulletproof API Protection! (github.com)

[3]: arainho/awesome-api-security: A collection of awesome API Security tools and resources. The focus goes to open-source tools and resources that benefit all the community. (github.com)

[4]: shieldfy/API-Security-Checklist: Checklist of the most important security countermeasures when designing, testing, and releasing your API (github.com)

Last updated