AWS and IP spoofing

0

Hey everyone, I use Cloudflare as my WAF, and host my server on AWS and I was wondering, and I want to only whitelist IPs relating to Cloudflare, but I have a problem... how does AWS handle IP spoofing? what if someone changed their X-Forwarded-For header to one of Cloudflare's IP addresses. how does AWS handle it? does it allow it to enter? is there any documentation how AWS secures this properly?

3개 답변
2

AWS does not directly handle IP spoofing or verify the accuracy of the X-Forwarded-For header. It's important to understand that the X-Forwarded-For header can be manipulated by clients, including malicious actors, and should not be solely relied upon for security measures. However, AWS provides several features and best practices to enhance security:

Security Groups: AWS Security Groups act as a virtual firewall for your EC2 instances to control inbound and outbound traffic. You can restrict access to your instances based on IP addresses, protocols, and ports. Ensure that your Security Groups only allow traffic from trusted sources, such as Cloudflare IP ranges.

Network Access Control Lists (NACLs): NACLs are an additional layer of security that act as a firewall for controlling traffic in and out of one or more subnets. You can use NACLs to deny traffic from suspicious or unauthorized IP addresses.

AWS WAF: AWS Web Application Firewall (WAF) helps protect your web applications from common web exploits. You can create rules to allow, block, or monitor web requests based on conditions that you define. While AWS WAF can be integrated with Cloudflare, it's important to properly configure your WAF rules to mitigate potential threats. Could you check this if this will be useful :- https://aws.amazon.com/it/blogs/security/automatically-block-suspicious-traffic-with-aws-network-firewall-and-amazon-guardduty/

Hope it clarifies and if does I would appreciate answer to be accepted so that community can benefit for clarity, thanks ;)

profile picture
전문가
답변함 2달 전
2

As Adeleke mentioned,X-Forwarded-For can be spoofed.

However, X-Forwarded-For does not contain Cloudflare IP, only original visitor IP. As per Cloudflare documentation

For example, if the original visitor IP address is 203.0.113.1 and the request sent to Cloudflare does not contain an X-Forwarded-For header, then Cloudflare will send X-Forwarded-For: 203.0.113.1 to the origin.

To restrict EC2 access to Cloudflare only, you can modify your EC2 SG (security group) HTTP/HTTPS inbound to Cloudflare IP only.

Refer to 3 ways AWS is helping to make the internet more secure note about IP spoofing,

One common technique that DDoS actors use is “IP spoofing”, sending messages as part of an attack while disguising the source to make it hard to stop the activity. Historically, IP spoofing has been a challenge for security teams to deal with because it’s so hard to identify the true source. (Imagine if you simultaneously received a thousand calls on your phone from a thousand different numbers. You would need to trace back step-by-step to find each message’s originating network.) Because AWS runs a large global network footprint, interconnecting with thousands of unique networks, we can directly engage with our peer networks to trace an attack back to the source and shut it down. We work with a variety of network operators to engage in trace-back exercises to shut down the infrastructure used for these kinds of attacks.

AWS
전문가
Mike_L
답변함 2달 전
1

As discussed above you can add CloudFlare IP ranges to a security group to restrict access to CloudFlare.

While the HTTP 'X-Forwarded-For' header can be spoofed, if you are able to verify that the requests came from CloudFlare, then you should be able to trust at least the right-most 'X-Forwarded-For' (assuming you have not instructed CloudFlare not to add the true client IP. Don't trust any of the addresses except the rightmost as all of these could have been manipulated upstream.

AWS
답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠