Reverse Proxy Misconfigurations: HTTP Headers

OtherExploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

Since headers like X-Forwarded-For, X-Real-IP, and True-Client-IP are just regular HTTP headers, a client can set or override them if it can control part of the traffic path—especially when directly connecting to the application server, or when reverse proxies are not properly filtering or validating these headers.

X-Forwarded-For

X-Forwarded-For is an HTTP header used to identify the originating IP address of a client connecting to a web server through an HTTP proxy or a load balancer.

When a client makes a request through a proxy or load balancer, that proxy adds an X-Forwarded-For header containing the client’s real IP address.

If there are multiple proxies (a request passes through several), each proxy adds the address from which it received the request to the header, comma-separated.

ps1
X-Forwarded-For: 2.21.213.225, 104.16.148.244, 184.25.37.3

Nginx can override the header with the client's real IP address.

ps1
proxy_set_header X-Forwarded-For $remote_addr;

X-Real-IP

X-Real-IP is another custom HTTP header, commonly used by Nginx and some other proxies, to forward the original client IP address. Rather than including a chain of IP addresses like X-Forwarded-For, X-Real-IP contains only a single IP: the address of the client connecting to the first proxy.

True-Client-IP

True-Client-IP is a header developed and standardized by some providers, particularly by Akamai, to pass the original client’s IP address through their infrastructure.

Comments

No comments yet.