Security Assessment of JWKS-Based Authentication: Mitigating JWT Attack Vectors Through Penetration Testing - Pratama, Ferry Andhika; Hermanto, Agus; Kusnanto, Geri (Jurnal Teknik Informatika (Jutif), 2026)
JSON Web Tokens (JWT) have become the de facto standard for stateless authentication in modern web applications and microservices architectures. However, improper implementation exposes systems to critical vulnerabilities including algorithm confusion attacks, signature bypass, and key injection exploits. This paper presents a comprehensive resilience analysis of JSON Web Key Set (JWKS)-based authentication mechanisms against known JWT attack vectors through a systematic penetration testing approach. We implemented and evaluated a production-grade courier management system (City Courier) featuring dynamic JWKS key rotation, RFC 7517-compliant public key distribution, and encrypted private key storage. Our penetration testing methodology systematically evaluated the system against 10 critical JWT attack vectors including algorithm confusion (CVE-2022-29217), kid parameter injection, weak secret exploitation, and signature verification bypass. Results demonstrate that proper JWKS implementation with dynamic key rotation, strict algorithm validation, and comprehensive audit logging provides robust defense against all tested attack vectors. The system successfully mitigated algorithm confusion attacks through explicit algorithm whitelisting, prevented kid injection via UUID-based key identifiers, and maintained security during key rotation events. Performance analysis shows minimal overhead (less than 50ms) for JWKS endpoint queries with aggressive caching. This research contributes practical implementation patterns for secure JWT authentication, providing both empirical evidence for JWKS-based security controls and a validated blueprint to neutralize critical vulnerabilities in modern microservices architectures.