Home / Companies / StackHawk / Blog / Post Details
Content Deep Dive

Do You Trust Your X-Forwarded-For Header?

Blog post from StackHawk

Post Details
Company
Date Published
Author
Brandon Ward
Word Count
1,597
Language
English
Hacker News Points
-
Summary

X-Forwarded-For headers can be easily spoofed, posing security challenges such as bypassing API rate limiting, as initially experienced by StackHawk. The header, which is intended to track the originating IP address through a chain of proxies, can be manipulated by users to include false or invalid IP addresses. Various cloud providers and application frameworks handle this header differently; for example, AWS appends a single client IP, while GCP appends both the client and load balancer IPs. Application frameworks like Spring Boot and Tomcat differ in their handling of the header, with Spring Boot selecting the first unvalidated IP and Tomcat offering a more secure, configurable approach. StackHawk addressed the issue by restricting rate limiting to user IDs and implementing a more intelligent system to select trusted IP addresses, highlighting the importance of validating input sources and regularly reviewing framework configurations to prevent vulnerabilities.