
Hardening Docker Images: Distroless Build Pipelines
October 20, 2026
Defending Against Kerberoasting And AS-REP Roasting In Active Directory
October 21, 2026An API gateway breach doesn’t announce itself with alarms. It arrives quietly—an attacker probing endpoints at 4 AM, a misconfigured JWT validation routine silently accepting forged tokens, or a distributed client hammering your payment API until rate limits fail. According to the 2026 Salt Security State of API Security Report, 95% of organizations experienced at least one API security incident in the past twelve months, with API-layer attacks now representing the single fastest-growing category in enterprise breach vectors. Yet the majority of security investments still focus on perimeter firewalls and endpoint protection, leaving the API gateway—the actual front door to business logic and sensitive data—comparatively underguarded.
This post examines three foundational but frequently misimplemented controls for hardening API gateways: rate limiting architecture, Mutual TLS (mTLS) configuration, and JWT validation pipelines. Each addresses a distinct threat surface. Together, they form a layered defense that transforms your API gateway from a convenient attack vector into a hardened authentication and authorization checkpoint.
Why API Gateways Are High-Value Targets
An API gateway consolidates access to backend microservices, databases, and third-party integrations into a single programmable entry point. That centralization is operationally powerful and strategically dangerous. Compromise the gateway, and an attacker inherits authenticated access to every downstream resource it proxies—without ever touching individual services.
The Attack Surface Profile
API gateways face attacks at multiple protocol layers simultaneously. At the network layer, volumetric floods and connection exhaustion attacks target availability. At the application layer, injection attacks, broken object-level authorization (BOLA), and token manipulation dominate. The OWASP API Security Top 10 (2023 edition, still the operational standard in 2026) lists Broken Authentication and Unrestricted Resource Consumption in the top four positions—both directly addressable through the controls covered in this article.
Real-world illustration: In early 2025, a major European fintech disclosed that attackers had successfully enumerated 2.3 million customer account IDs through their API gateway by exploiting predictable object IDs and the complete absence of rate limiting on their /accounts/{id} endpoint. The breach cost an estimated €4.7 million in regulatory fines and remediation. The gateway itself was enterprise-grade; the configuration was not.
What Proper Gateway Hardening Actually Means
Gateway hardening is not about enabling every security feature a vendor ships. It’s about understanding the specific threat models your API topology faces and implementing controls with appropriate precision. A public-facing consumer API, a B2B partner integration endpoint, and an internal service mesh all warrant different rate limiting thresholds, different certificate trust chains, and different JWT claim validation logic. Treating them identically is itself a security failure.
Rate Limiting: More Than Just Request Counts
Rate limiting is often implemented as an afterthought—a simple request-per-minute cap on a per-IP basis. That approach fails against distributed attacks and provides no protection against slow, low-volume credential stuffing or API scraping campaigns that stay deliberately under threshold. Effective rate limiting is multi-dimensional.
Designing a Multi-Dimensional Rate Limiting Strategy
Enterprise-grade rate limiting operates across at least four dimensions simultaneously:
- IP-based limits: Baseline protection against unsophisticated floods. Necessary but easily circumvented by botnets with rotating IPs.
- User/token-based limits: Tied to authenticated identity, not network origin. A single user token exceeding 500 requests per minute to a search endpoint is suspicious regardless of what IP it originates from.
- Endpoint-specific limits: Authentication endpoints warrant far stricter limits than read-only data endpoints. Apply 5–10 requests per minute to /auth/token and /auth/login; higher limits are operationally unjustifiable and tactically dangerous.
- Resource-based limits: Some endpoints are computationally expensive. A report generation endpoint that triggers heavy database queries should have limits that reflect backend capacity, not just network throughput.
Sliding window algorithms are generally preferable to fixed window counters. Fixed windows allow burst attacks at window boundaries—an attacker who knows your window resets at the top of each minute can fire 200 requests at :59 and 200 more at :01 and technically stay within a 200 req/min limit while generating 400 requests in 2 seconds. Sliding windows—whether token bucket or leaky bucket implementations—smooth these boundary exploits.
Rate Limit Bypass Prevention and Response Handling
Rate limiting configuration without bypass prevention is performative security. Common bypasses include IP rotation via residential proxies, header manipulation (particularly X-Forwarded-For spoofing to fool gateway trust logic), and distributing requests across multiple API keys obtained through low-friction registration flows.
Mitigations include: enforcing rate limits on authenticated identity (not just IP), configuring gateways to distrust client-supplied X-Forwarded-For headers in favor of verified network-layer source IPs, and implementing progressive penalties rather than hard cutoffs. When a client hits 80% of their rate limit, increase response latency slightly. At 100%, return HTTP 429 with a Retry-After header. At repeated violations, trigger an alert and initiate temporary account review. Rate limit responses should never reveal internal thresholds—attackers treat HTTP 429 responses as calibration data.
Mutual TLS: Establishing Cryptographic Identity for Clients
Standard TLS authenticates the server to the client. The client verifies that the server’s certificate was issued by a trusted CA and that the server possesses the corresponding private key. That’s necessary but asymmetric—the server knows nothing cryptographically verifiable about the client. Mutual TLS (mTLS) extends this handshake bidirectionally: the client presents its own certificate, and the server validates it against a trusted certificate authority before the connection proceeds.
Implementing mTLS at the Gateway Layer
For B2B API integrations and service-to-service communication within a microservices architecture, mTLS provides strong machine identity assurance that bearer tokens and API keys cannot match. An mTLS client certificate is bound to a specific cryptographic key pair—unlike a stolen API key, a stolen certificate cannot be used without the corresponding private key, which should never leave the client’s secure hardware or key store.
Implementation steps for gateway-level mTLS typically include:
- Establish a private PKI: For internal service meshes, a dedicated internal CA (HashiCorp Vault PKI, AWS Private CA, or Cloudflare PKI) issues client and server certificates with short validity periods (24–72 hours) and automated rotation via ACME or platform-native tooling.
- Configure the gateway to require client certificates: In Kong, this means enabling the mTLS plugin and specifying the CA certificate pool. In AWS API Gateway with custom domain names, client certificate validation is configured at the domain level. Nginx-based gateways use ssl_verify_client require directives with ssl_client_certificate pointing to the CA bundle.
- Certificate pinning for high-assurance scenarios: Beyond CA validation, pin specific certificate fingerprints for partner integrations where the partner certificate changes infrequently. Pinning survives CA compromise scenarios at the cost of operational flexibility.
- Forward client certificate metadata to backend services: Many gateway deployments validate the certificate at the gateway layer and then pass subject CN or SAN fields as HTTP headers (X-Client-Cert-Subject) to backend services for fine-grained authorization decisions.
A 2026 NIST internal study on zero-trust architecture deployments found that organizations implementing mTLS for east-west API traffic reduced successful lateral movement incidents by 68% compared to those relying solely on network segmentation without cryptographic identity verification.
Certificate Revocation and Lifecycle Management
mTLS introduces certificate lifecycle complexity. A certificate issued to a now-terminated partner or a compromised service must be revocable without waiting for expiry. Deploy Online Certificate Status Protocol (OCSP) stapling at the gateway to enable real-time revocation checking without the latency of CRL distribution points. Automate certificate issuance and rotation through your PKI platform’s API—manual certificate management at scale is operationally unsustainable and a leading cause of expired-certificate outages.
JWT Validation: The Subtleties That Cost Organizations Dearly
JSON Web Tokens have become the dominant mechanism for conveying identity and authorization claims across API boundaries. Their adoption is so widespread that JWT misconfiguration vulnerabilities now appear in virtually every major API security audit. The Auth0 2025 Identity Threat Report noted that JWT algorithm confusion attacks increased by 340% year-over-year as more organizations adopted token-based API authentication without implementing rigorous validation pipelines.
Critical JWT Validation Checks That Are Routinely Missed
A production-grade JWT validation pipeline at the gateway layer must enforce all of the following—not some:
| Validation Check | What It Prevents | Common Failure Mode |
|---|---|---|
| Algorithm enforcement (alg header) | Algorithm confusion attacks (RS256 → HS256 downgrade) | Accepting alg: none or arbitrary algorithms |
| Signature verification | Forged or tampered tokens | Skipping verification in debug modes left enabled in production |
| Expiration (exp claim) | Stolen token replay after session end | Missing clock skew tolerance configuration causing valid token rejection |
| Issuer (iss claim) | Tokens from untrusted identity providers | Accepting tokens from any issuer that produces a valid signature |
| Audience (aud claim) | Token misuse across different APIs (confused deputy attacks) | Not validating aud at all, or accepting wildcards |
| JTI (JWT ID) uniqueness | Token replay attacks within the validity window | Not implementing a token ID cache/blocklist |
JWKS Endpoint Security and Key Rotation
Modern systems fetch public keys dynamically from a JSON Web Key Set (JWKS) endpoint published by the identity provider. This is operationally elegant but introduces a supply chain dependency—if the JWKS endpoint is compromised or a MITM attack intercepts key fetching, an attacker can substitute their own public key and issue tokens your gateway will trust.
Harden JWKS consumption by: caching keys with explicit TTLs aligned to your rotation schedule, pinning the JWKS endpoint’s TLS certificate, validating the kid (key ID) header in incoming JWTs against known key IDs before fetching, and alerting when unexpected key IDs appear. Key rotation should be automated and tested quarterly at minimum—a key rotation procedure that’s never been exercised in production is a key rotation procedure that will fail when needed most.
Integrating Controls: The API Gateway Security Stack in Practice
Rate limiting, mTLS, and JWT validation are most effective as coordinated layers rather than independent controls. Consider a realistic enterprise scenario: a financial services firm exposing a payment initiation API to third-party applications. The security stack operates as follows:
The partner application connects via mTLS, presenting a certificate issued by the firm’s private CA. The gateway validates the certificate chain, checks OCSP status, and extracts the client identity from the certificate subject. Before processing further, the gateway applies endpoint-specific rate limits keyed to the client’s certificate subject (not IP address). The partner’s OAuth 2.0 Bearer token is then validated: algorithm enforcement (RS256 only), signature verification against the current JWKS, exp, iss, aud, and JTI claims all checked. Only requests passing all three layers reach the payment microservice.
This architecture means that even if a partner’s JWT is stolen (through a client-side compromise), the stolen token cannot be replayed from an unauthorized system—the mTLS layer rejects connections without a valid client certificate. Even if both the JWT and certificate are somehow compromised, rate limiting at the client-identity level will flag abnormal request volume patterns and trigger alerts long before significant damage occurs.
Observability and Security Signal Integration
None of these controls provide value in isolation from observability infrastructure. Rate limit triggers, certificate validation failures, and JWT validation errors must be emitted as structured log events and ingested into your SIEM. Define alert thresholds: more than 50 JWT validation failures per minute from a single client ID warrants immediate investigation. Unusual spikes in 429 responses may indicate a targeted enumeration campaign. mTLS handshake failures from previously trusted client certificates may indicate certificate theft and unauthorized use attempts.
Connect gateway security telemetry to your threat intelligence platform to correlate client IPs and certificate subjects against known malicious indicators. Gateway logs that sit in S3 buckets and are reviewed quarterly are compliance artifacts, not security controls.
Key Takeaways
- Rate limiting must be multi-dimensional. IP-based limits alone are trivially bypassed. Layer user/token-based, endpoint-specific, and resource-cost-based limits using sliding window algorithms with progressive penalty responses.
- mTLS provides cryptographic client identity that bearer tokens cannot. For B2B and service-to-service communication, mTLS with short-lived certificates and automated rotation significantly reduces lateral movement risk and eliminates credential-sharing attack patterns.
- JWT validation pipelines must enforce all claims—not just signature and expiry. Algorithm enforcement, audience validation, issuer pinning, and JTI uniqueness checking are the controls most commonly omitted and most frequently exploited.
- Gateway controls only function as a defense layer when integrated with real-time observability. Security events from rate limiting, mTLS, and JWT validation must feed live alerting pipelines, not periodic log reviews.
- Configuration specificity matters as much as feature enablement. Enterprise gateway platforms ship with these capabilities. The security value comes from precise, threat-model-driven configuration—not from toggling features on with default settings.
Conclusion: Treat Your API Gateway as a Security Control, Not a Traffic Router
The API gateway sits at the intersection of business functionality and security architecture. Organizations that treat it purely as a routing and load-balancing layer consistently appear in breach disclosures. Those that treat it as a primary security enforcement point—with carefully configured rate limiting, cryptographic client authentication via mTLS, and rigorous JWT validation—build a resilient outer perimeter around their most sensitive data and logic.
The specific, actionable step for your team this week: conduct a configuration audit of your existing API gateway deployment against the JWT validation checklist in this article. Specifically check whether alg: none is rejected, whether the aud claim is validated for every protected endpoint, and whether JTI replay prevention is implemented. These three checks alone will close vulnerabilities that attackers actively probe. If the audit reveals gaps, prioritize remediation above new feature delivery—an API gateway that routes traffic efficiently but validates tokens loosely is a liability the business has not accounted for in its risk model.
{
“title”: “Securing API Gateways: Rate Limiting, mTLS & JWT”,
“excerpt”: “Learn how to secure API gateways using rate limiting, mutual TLS, and JWT validation to
💡 Enjoyed this article?
Subscribe for more expert insights delivered to your inbox.
Follow us or subscribe below xe2x80x94 free, no spam.





