API Gateway Security Audit Guide: 7 Best Practices

by Endgrate Team 2024-10-28 20 min read

Your API gateway needs rock-solid security. Here's exactly how to audit it and lock it down.

Quick Summary: Run these 7 critical security checks on your API gateway:

Security Check What It Does Why It Matters
Authentication Check login systems Blocks 85% of attacks
Data Protection Test encryption Stops data theft
Usage Limits Set rate limits Prevents overload
Activity Tracking Monitor all traffic Catches threats
Version Control Manage API versions Removes old vulnerabilities
Compliance Meet security standards Avoids fines
Gap Analysis Find weak spots Fixes problems early

The Hard Truth: Companies now handle 162 APIs on average - that's 82% more than last year. Each API attack costs $6.1 million. And 90% of web traffic flows through APIs.

Here's What You'll Learn:

  • Step-by-step security audit process
  • Real tools you can use today
  • Exact settings to check
  • How to fix common problems

Who Needs This:

  • API developers
  • Security teams
  • System admins
  • DevOps engineers

Skip the fluff - let's lock down your API gateway.

Getting Ready for Security Audits

Setting Audit Boundaries

The average company manages 162 APIs, according to Salt Security's Q3 2022 data. That's why you need a clear plan for what to check.

Here's what your audit should cover:

Area What to Check
APIs Active endpoints, versions, data flows
Security Auth methods, encryption, access controls
Compliance Industry rules, legal requirements
Infrastructure Servers, networks, storage systems

Tools and Team Members

You'll need these core tools:

Tool Type What It Does
Static Analysis Spots issues in API definitions
Dynamic Testing Checks live endpoints
Monitoring Watches API behavior
Documentation Tracks findings and fixes

Most teams use tools like SoapUI, Rest-Assured, or Postman for testing. For monitoring, Splunk, Elastic, or Datadog work well.

Must-Have Documents

Keep these close by:

  • API specs and docs
  • Security policies
  • Access control lists
  • Previous audit reports
  • Incident response plans
  • Risk assessments

Who Does What

Role Main Tasks
Security Team Runs the audit
API Developers Explains how things work
System Admins Helps with access
Compliance Officers Checks legal stuff

"We can't afford not to address this problem head-on. Regular security checks aren't optional anymore - they're a must for any company handling APIs."

Tyler Reynolds, Channel & GTM Director at Traceable.ai

Don't wait - check your API security every time you make updates or release patches. It's way easier to fix problems early.

Practice 1: Check Authentication Systems

Authentication stops unwanted API access. Here's your security audit checklist:

Token Security Checks

Check Type What to Look For
Token Storage HTTPS-only sending, secure storage
Token Lifecycle When tokens expire, auto-refresh rules
Token Rotation How often tokens change, how to cancel them
Token Validation Checking signatures, expiration dates

OAuth Setup Check

For OAuth 2.0, focus on these two main parts:

1. Registration Process

Your system needs to handle:

  • Making client IDs and secrets
  • Storing credentials safely
  • Changing client secrets on schedule

2. Authorization Flow

Look at these OAuth steps:

  • How authorization requests work
  • Getting user permission
  • Trading for access tokens
  • Managing resource access

User Role Controls

Access Level Required Checks
Basic Users Base permissions, usage limits
Admin Users Higher access levels, activity logs
Service Accounts API limits, usage caps
System Roles How permissions pass down, role clashes

2FA Check

Factor Type What to Check
Knowledge Passwords, PINs, security questions
Possession Physical tokens, SMS, email codes
Biometric Fingerprints, face scans
Location IP addresses, GPS checks

"API security is a big data problem. You need to know your data, identities, and how your app works from start to finish."

Tyler Reynolds, Channel & GTM Director at Traceable.ai

Check These MFA Points:

  • Do critical endpoints need MFA?
  • Can someone skip MFA through other login paths?
  • What's needed to change MFA settings?
  • How safe are account recovery options?

Salt Security found companies run 162 APIs on average. Each one needs these auth checks.

Practice 2: Test Data Protection

API security attacks with data protection failures cost companies $6.1 million on average. Here's how to test your API gateway's data protection:

Check Encryption Methods

Your API needs three layers of protection:

  1. Transport Layer: Use TLS 1.2+ and HTTPS only
  2. Storage Layer: Set up database encryption
  3. Message Layer: Add perfect forward secrecy

Plus, don't forget API key management - rotate them often and store them safely.

Private Data Protection

Let's look at how Apache APISIX handles encryption. Here's a clear before-and-after:

Bad Setup (DON'T do this):

{
  "username": "foo",
  "plugins": {
    "basic-auth": {
      "password": "bar"
    }
  }
}

Good Setup (DO this):

{
  "plugins": {
    "basic-auth": {
      "password": "+kOEVUuRc5rC5ZwvvAMLwg="
    }
  }
}

Data Transfer Security

Want solid transfer security? Focus on these four areas:

What to Do How to Do It
Certificate Pinning Connect only to trusted certificates
Mutual TLS Make both sides prove their identity
Forward Secrecy Change keys every session
Input Validation Check ALL incoming data

"The scary thing about these breaches is that the exploited APIs worked exactly as they were designed."

Tyler Reynolds, Channel & GTM Director at Traceable.ai

Storage Security Rules

Here's what you NEED to check:

  • Turn on cache encryption for REST APIs
  • Delete old data automatically
  • Keep secure API activity logs
  • Encrypt your backups

For custom domains: Don't use certificate pinning - it breaks things. Let API Gateway handle certificates for execute-api endpoints instead.

Set up CloudFront with:

  • Your own SSL certificate
  • TLS 1.1 minimum
  • Regular security updates

Practice 3: Set Usage Limits

API rate limits protect your system from overload. Here's what you need to know:

Request Limits

Your API gateway needs these three limits:

Limit Type Time Window What It Does
Burst Rate Per second Blocks traffic spikes
Steady Rate Per minute Manages regular traffic
Daily Quota Per 24 hours Limits total daily use

Usage Quotas

Set different limits based on:

  • IP address
  • API key
  • User account
  • Endpoint type

Here's how Facebook does it:

Access Level Requests/Hour Daily Limit
Basic 200 4,800
Standard 3,600 86,400
Premium 36,000 864,000

DDoS Defense

Let's talk numbers: GitHub got hit with 126,900 requests PER MILLISECOND in February 2018. That's 125 GB of data EVERY SECOND.

You need these blocks in place:

  • IP-based filters
  • Geo-restrictions
  • Pattern detection
  • Auto-blacklisting

Traffic Monitoring

Keep an eye out for these red flags:

Pattern Meaning What to Do
Traffic spikes Attack starting Tighten rate limits
Failed logins Brute force try Block IPs
Lots of errors API abuse Check patterns
Weird locations Geo-attack Block locations

The Token Bucket Algorithm helps control traffic:

1. Users get tokens

2. API calls spend tokens

3. Tokens come back slowly

4. No tokens = no API calls

This simple system stops both accidents and attacks.

Practice 4: Track All Activity

Here's how to set up API gateway tracking that spots problems FAST.

Activity Records

You need two types of logs to catch everything:

Log Type What It Records Why It Matters
Access Logs IP addresses, paths, status codes Shows who's using your API
Execution Logs Internal processes, errors Helps fix technical problems

Want access logs in CloudWatch? Use this format:

{
    "requestId": "$context.requestId",
    "ip": "$context.identity.sourceIp",
    "method": "$context.httpMethod",
    "path": "$context.resourcePath",
    "status": "$context.status"
}

Log Storage

Here's what your log system NEEDS:

Rule Details
Storage Time Keep logs for 90 days minimum
Access Control Only security team can view
Backup Plan Daily backups to separate location
Format Check Use JSON or CLF format

Live Monitoring

Keep your eyes on these numbers:

Metric Normal Range Action if Outside Range
Response Time < 200ms Check for bottlenecks
Error Rate < 1% Look for failed attacks
Failed Logins < 3 per minute Block suspicious IPs
API Calls Within rate limits Adjust quotas if needed

Problem Response Tracking

When something goes wrong, do this:

  1. Record time and date
  2. Note affected systems
  3. List actions taken
  4. Track resolution time
  5. Document fixes applied

Use these codes to mark how bad it is:

Code Meaning Response Time
P1 System down Fix within 1 hour
P2 Major feature broken Fix within 4 hours
P3 Minor issue Fix within 24 hours
P4 Low impact Fix within 1 week

Check these endpoints for system health:

  • GET /rest/apigateway/health - System status
  • GET /rest/apigateway/health/engine - Runtime health
  • GET /metrics - Usage stats

Quick tip: Make sure AmazonAPIGatewayPushToCloudWatchLogs policy is ON. Without it? No logs.

Practice 5: API Version Security

Here's how to lock down your API versions with strong security controls.

Version Control

Your API gateway needs these version settings:

Rule Implementation
URI Path /api/v1/resource
Header Accept: application/json;v=2.0
Query ?apiVersion=2.0

Big players like Facebook, Airbnb, and Twitter/X pick URI path versioning. Why? It's simple to spot and use.

Old Version Removal

Here's a clear timeline to phase out old versions:

1. Active Phase (12 months)

Keep track of who's using what and plan your next moves.

2. Warning Phase (12 months)

Tell users it's time to move on with this header:

X-DEPRECATION-WARN: "This version will be removed after 2024-07-31 23:00 UTC"

3. Shutdown Phase

Pull the plug and point everyone to the new version.

Old API Security

Got APIs you need to keep around? Add these guards:

Layer Protection
Rate Limits Stop at 100 calls/minute
IP Rules Only let approved IPs through
Logging Watch every old version call
Access Need special auth tokens

Connection Security Rules

Lock down every API connection:

Type Rule
HTTPS Must use TLS 1.3+
Certs New ones every 90 days
Headers Set up CORS and CSP
Timeouts Cut off after 30 seconds

"APIs tend to expose more endpoints than traditional web applications, making proper and updated documentation highly important."

OWASP

Pro tip: Only keep your latest three versions. When V3 launches, V0 goes away. It's that simple.

sbb-itb-96038d7

Practice 6: Follow Security Rules

Security isn't a "nice-to-have" - it's a must. Here's what you need to know:

Your API gateway needs to meet specific laws and rules:

Requirement What to Check
PCI DSS 4.0 - Payment data handling rules
- Due by March 31, 2024
- 50+ new API security rules
Data Privacy - User data protection
- Access controls
- Data storage rules
Breach Rules - Incident response plan
- User notification process
- Breach documentation

Core Standards

Two main standards matter for API security:

Standard What It Covers
ISO 27001 - Data protection focus
- Information security management
- Regular security audits
SOC 2 - Security controls
- Processing checks
- Privacy standards

Certificate Management

Don't let these expire:

Certificate When to Update
SSL/TLS Every 90 days
ISO 27001 Annual audit
SOC 2 Type 1: Point-in-time
Type 2: 6-month review

"We can't afford not to address this problem head-on."

Tyler Reynolds, Channel & GTM Director at Traceable.ai

Security Documentation

Keep track of:

Record Type What to Log
Audits - Date and scope
- Found issues
- Fix timeline
Incidents - Attack type
- Response steps
- Resolution time
Changes - Security updates
- API versions
- Config changes

The numbers tell the story:

  • API security breaches: $6.1M average cost
  • 90% of web traffic goes through APIs
  • 92% of financial companies face API security problems
  • 70% see delays from API security issues

Just look at Equifax: One security slip-up in 2017 cost them $425M in fines. Don't let that be you.

Practice 7: Find Security Gaps

Here's how to catch API security problems before attackers do.

Security Tests

You need two types of tests to keep your APIs safe:

Test Type What It Does How Often
Static Analysis Spots risky code patterns During development
Dynamic Testing Checks live APIs for holes Weekly or bi-weekly

Attack Tests

Your testing should focus on these key areas:

Attack Type What to Check Tools to Use
SQL Injection How you handle data input APIsec
Cross-site Scripting How you filter scripts OWASP ZAP
Authentication Bypass How secure your login is Burp Suite
Rate Limiting How you handle traffic spikes JMeter

Risk Levels

Each problem needs a score:

Risk Level Impact Fix Timeline
Critical Someone could break in Fix in 24 hours
High They might grab some data Fix in 1 week
Medium Things might slow down Fix in 2 weeks
Low Small issues Fix in 1 month

Fix Problems Fast

Here's your action plan:

Step What to Do When
Document Write down what's wrong Day 1
Prioritize Pick what to fix first Day 1-2
Test Fix Try your fix in staging Day 2-3
Deploy Push to production Day 3-4
Verify Make sure it worked Day 4-5

Let's talk numbers:

  • APIs handle 90% of web traffic now
  • Manual tests? They take 40 hours EACH
  • But automated tools work non-stop

The OWASP API Security Project says these tests catch most attacks. Run them often and you'll spot issues FAST.

Here's why it matters: Equifax skipped ONE security check. The price tag? $425M in fines.

How to Run Security Audits

Here's a breakdown of API security audit essentials:

Phase Tasks Time Required
Planning Map API endpoints, set test scope 2-3 days
Discovery Document data flows, identify threats 3-5 days
Testing Run security tests, check vulnerabilities 5-7 days
Reporting List issues, suggest fixes 2-3 days
Validation Verify fixes work 2-3 days

Your audit schedule depends on what's at risk:

API Type Audit Frequency Why
Payment APIs Monthly High-risk financial data
User Data APIs Quarterly Personal info protection
Public APIs Bi-annual External access risks
Internal APIs Annual Limited exposure

Here's who does what:

Role Tasks Tools
Security Lead Plan audits, review results OWASP Top 10
DevOps Run tests, fix issues SoapUI, Rest-Assured
QA Team Test fixes, check changes Postman
Compliance Check standards, write reports Splunk, Elastic

Pick your tools based on what you need:

Need Tool What It Does
Real-time Detection Traceable Spots threats as they happen
DDoS Protection Imperva Blocks attack traffic
General Testing OWASP ZAP Tests common vulnerabilities
Log Analysis Datadog Tracks API behavior

"The audit process includes five key phases: Defining Scope, Discovery and Threat Modeling, Penetration Testing and Exploitation, Reporting and Remediation, and Rechecks and Validation."

Ravikumar Ramachandran, CISA, CISM, CISSP-ISSAP

Want to nail your security audit? Here's what to do:

  • Map EVERY endpoint before you start
  • Test in staging (not production!)
  • Keep detailed test logs
  • Fix critical issues in 24 hours
  • Test your fixes twice

Here's a pro tip: Mix static analysis during development with weekly dynamic testing. This combo catches most issues before they become problems.

Security Audit Tools

Here's what you need to know about API security testing tools:

Tool Type Popular Tools Price Range Key Features
Gateway Tools IBM API Connect, Salt Security $50K-350K/year API discovery, runtime protection
Pen Testing Astra, Probely $1,999-5,999/year Auto vulnerability scanning
Runtime Security Treblle, APIsec $500-2,200/month Live threat detection
Testing Tools OWASP ZAP, Postman Free - $39/user/month CI/CD testing

Let me break this down into the main categories:

Built-in Gateway Tools

Every API gateway includes these basic security features:

Feature Purpose Tool Example
Access Control Controls who gets in IBM API Connect
Rate Limits Stops overload attacks Salt Security
Threat Alerts Catches bad actors Noname Security
Log Tracking Watches API behavior Treblle

Security Add-ons

These tools give you extra protection:

Tool Price Main Job
Astra $1,999/year 9,300+ security checks
Probely $1,180/year 100+ bug scanners
APIsec $500/month Non-stop testing
Akto Free API monitoring

Connection Tools

Here's what keeps your API connections safe:

Tool Works Best For Top Feature
Postman API testing Auth checks
SoapUI SOAP/REST APIs Security scans
Burp Suite Finding weak spots Bug detection
Fiddler Traffic checks Request analysis

Automated Testing

Tools that do the testing for you:

Tool What It Tests Works With
StackHawk Live testing CI/CD systems
42Crunch OpenAPI checks DevOps tools
Escape GraphQL scans Cloud systems
Data Theorem AI scanning Git repos

"Here's why this matters: In November 2023, Kronos Research lost $26 million in crypto after hackers broke in."

Quick tip: Start with free tools like OWASP ZAP. Add paid options like Astra ($1,999/year) when you need deeper scans.

Problems and Solutions

Here's what goes wrong in API security audits - and how to fix it:

Limited Resources

Most teams don't have enough people or money for proper API security. Here's what works:

Problem Solution Cost
No security tools Start with OWASP ZAP Free
Small team Focus on critical APIs first $0
Limited time Use automated scans $500-2,000/month
No specialists Train existing devs $200-500/person

Technical Problems

These issues pop up in EVERY audit:

Issue Fix Time to Fix
Wrong WAF setup Check WAF Web ACL exists 1-2 hours
Bad permissions Fix IAM user roles 30 mins
Wrong API ARN Update resource ARN 15 mins
Failed scans Check correlation IDs 1 hour

Rule Requirements

Breaking security rules costs BIG money:

Standard What You Need Breaking It Costs
GDPR Data protection Up to €20M or 4% revenue
HIPAA Health data safety Up to $50K per violation
PCI DSS Payment security $5K-100K per month
PSD2 Banking API rules Varies by country

Connection Problems

Here's what breaks API connections - and how to stop it:

Problem What Can Happen Fix It With
Bad tokens Data theft OAuth 2.0
No rate limits DDoS attacks Request caps
Weak encryption Data leaks SSL/TLS
Bad monitoring Missed attacks Live logs

"A single API breach can lead to financial losses, reputational damage, regulatory penalties, and worse."

Kira Lempereur, Sr Technical Writer for DataDome

Want proof? T-Mobile's API breach in January 2023 exposed 37 million users' data.

Start here:

  • Get OWASP ZAP (it's free)
  • Lock down your busiest APIs first
  • Watch your traffic
  • Fix those permissions NOW

Keep Security Strong

Here's how to protect your APIs after an audit:

Daily Operations

Your security needs a schedule that works:

Task Timing What to Check
Quick Look Daily Traffic spikes, login fails
Deep Check Weekly New code, API endpoints
Full Review Every 3 months System health, rules
Attack Tests Yearly Break-in attempts

Fix Your Rules

What to Do When Why
Check Threats Weekly Spot problems early
Update Policies Monthly Close security holes
Clean Up Access Every 3 months Drop old accounts
Test Changes Before going live Stop breaks

Train Your Team

Your team needs to know their stuff:

What Who How Long Goal
Security Basics Developers 4 hours Spot common threats
API Tests Security pros 2 days Find weak points
Crisis Mode Team heads 1 day Fix problems fast
Tools Everyone 8 hours Watch for issues

When Things Break

Know what to do when problems hit:

Problem First Move Time Limit Then What
Data Leak Kill bad APIs 15 min Check logs, patch holes
DDoS Cap traffic 5 min Block attackers
Bad Update Go back 10 min Fix and test code
Login Issues Lock it down 5 min New tokens

Each API attack costs companies about $6.1 million. That's why you need solid security after your audit.

Key Points:

  • Let tools do the daily work
  • Keep your emergency contacts ready
  • Practice your backup plans
  • Document everything

LinkedIn shows it works - they cut API problems by 37% in 2023 just by checking more often.

Conclusion

Let's break down what you NEED to know about API gateway security:

Area What to Do Why It Matters
Authentication Use OAuth 2 or JWT Blocks 85% of attacks
Data Protection Enable HTTPS everywhere Protects data in transit
Monitoring Set up real-time alerts Spots problems fast
Testing Run weekly security scans Gets ahead of hackers

Here's your action plan:

Step Time Needed Expected Result
Security Scan 2-4 hours Find weak spots
Fix Critical Issues 1-2 days Block main threats
Set Up Monitoring 4-6 hours Get alert system running
Train Team 1 day Build team knowledge

"We can't afford not to address this problem head-on."

Tyler Reynolds, Channel & GTM Director at Traceable.ai

The security landscape is changing FAST. Here's what's coming:

Trend Impact Action Needed
Zero Trust Model Tighter security rules Update access controls
AI-Based Attacks Smarter threats Improve monitoring
Cloud API Growth More entry points Upgrade gateways
New Regulations More compliance needs Monthly checks

The numbers tell the story:

  • APIs handle 90% of web traffic now
  • An API breach costs $6.1 million
  • By 2030? That cost might hit $12.2 million

Bottom line: API security needs constant attention. Keep testing. Keep updating. Keep watching. That's how you stay protected.

FAQs

Does API gateway handle security?

API gateways handle basic security - but they're not enough by themselves. Here's what you get:

Security Feature What It Does Success Rate
Rate Limiting Blocks volumetric attacks Stops 54% of basic attacks
Data Protection Encrypts data in transit Prevents data leaks
Access Control Manages user permissions Controls API usage
Attack Blocking Stops known threat patterns Basic protection

But there's a problem:

Salt's Q3 2022 State of API Security survey shows that 54% of companies use API gateways for security. But 82% say these tools can't stop attacks on their own.

The numbers tell the story:

API Security Stats (2022) Impact
API Traffic Growth Up 168%
Companies with API Security Issues 94%
Companies Using Gateway Security 54%

"Security is an extremely serious and important part of any API, and as such, it should be given the importance and weight that it deserves."

Nordic APIs

You'll need these extra security layers:

  • Two-Factor Authentication (2FA)
  • Transport Layer Security (TLS)
  • Zero-Trust Security Model
  • Weekly security tests
  • API traffic monitoring

Bottom line: API gateways are just ONE part of security. You need more tools to protect against OWASP API Security Top 10 threats.

Related posts

Ready to get started?

Book a demo now

Book Demo