Starting today, you can configure your DNS Firewall to automatically trust all domains in a resolution chain (such as aCNAME
, DNAME
, or Alias
chain).
Let’s walk through this in nontechnical terms for those unfamiliar with DNS.
Why use DNS Firewall?
DNS Firewall provides protection for outbound DNS requests from your private network in the cloud (Amazon Virtual Private Cloud (Amazon VPC)). These requests route through Amazon Route 53 Resolver for domain name resolution. Firewall administrators can configure rules to filter and regulate the outbound DNS traffic.
DNS Firewall helps to protect against multiple security risks.
Let’s imagine a malicious actor managed to install and run some code on your Amazon Elastic Compute Cloud (Amazon EC2) instances or containers running inside one of your virtual private clouds (VPCs). The malicious code is likely to initiate outgoing network connections. It might do so to connect to a command server and receive commands to execute on your machine. Or it might initiate connections to a third-party service in a coordinated distributed denial of service (DDoS) attack. It might also try to exfiltrate data it managed to collect on your network.
Fortunately, your network and security groups are correctly configured. They block all outgoing traffic except the one to well-known API endpoints used by your app. So far so good—the malicious code cannot dial back home using regular TCP or UDP connections.
But what about DNS traffic? The malicious code may send DNS requests to an authoritative DNS server they control to either send control commands or encoded data, and it can receive data back in the response. I’ve illustrated the process in the following diagram.
To prevent these scenarios, you can use a DNS Firewall to monitor and control the domains that your applications can query. You can deny access to the domains that you know to be bad and allow all other queries to pass through. Alternately, you can deny access to all domains except those you explicitly trust.
What is the challenge with CNAME, DNAME, and Alias records?
Imagine you configured your DNS Firewall to allow DNS queries only to specific well-known domains and blocked all others. Your application communicates with alexa.amazon.com;
therefore, you created a rule allowing DNS traffic to resolve that hostname.
However, the DNS system has multiple types of records. The ones of interest in this article are
A
records that map a DNS name to an IP address,CNAME
records that are synonyms for other DNS names,DNAME
records that provide redirection from a part of the DNS name tree to another part of the DNS name tree, andAlias
records that provide a Route 53 specific extension to DNS functionality. Alias records let you route traffic to selected AWS resources, such as Amazon CloudFront distributions and Amazon S3 buckets
When querying alexa.amazon.com
, I see it’s actually a CNAME
record that points to pitangui.amazon.com
, which is another CNAME
record that points to tp.5fd53c725-frontier.amazon.com
, which, in turn, is a CNAME
to d1wg1w6p5q8555.cloudfront.net
. Only the last name (d1wg1w6p5q8555.cloudfront.net
) has an A
record associated with an IP address 3.162.42.28
. The IP address is likely to be different for you. It points to the closest Amazon CloudFront edge location, likely the one from Paris (CDG52
) for me.
A similar redirection mechanism happens when resolving DNAME
or Alias
records.
To allow the complete resolution of such a CNAME
chain, you could be tempted to configure your DNS Firewall rule to allow all names under amazon.com (*.amazon.com
), but that would fail to resolve the last CNAME
that goes to cloudfront.net
.
Worst, the DNS CNAME chain is controlled by the service your application connects to. The chain might change at any time, forcing you to manually maintain the list of rules and authorized domains inside your DNS Firewall rules.
Introducing DNS Firewall redirection chain authorization
Based on this explanation, you’re now equipped to understand the new capability we launch today. We added a parameter to the UpdateFirewallRule API (also available on the AWS Command Line Interface (AWS CLI) and AWS Management Console) to configure the DNS Firewall so that it follows and automatically trusts all the domains in a CNAME
, DNAME
, or Alias
chain.
This parameter allows firewall administrators to only allow the domain your applications query. The firewall will automatically trust all intermediate domains in the chain until it reaches the A
record with the IP address.
Let’s see it in action
I start with a DNS Firewall already configured with a domain list, a rule group, and a rule that ALLOW queries for the domain alexa.amazon.com
. The rule group is attached to a VPC where I have an EC2 instance started.
When I connect to that EC2 instance and issue a DNS query to resolve alexa.amazon.com
, it only returns the first name in the domain chain (pitangui.amazon.com
) and stops there. This is expected because pitangui.amazon.com
is not authorized to be resolved.
To solve this, I update the firewall rule to trust the entire redirection chain. I use the AWS CLI to call the update-firewall-rule
API with a new parameter firewall-domain-redirection-action
set to TRUST_REDIRECTION_DOMAIN
.
The following diagram illustrates the setup at this stage.
Back to the EC2 instance, I try the DNS query again. This time, it works. It resolves the entire redirection chain, down to the IP address .
Thanks to the trusted chain redirection, network administrators now have an easy way to implement a strategy to block all domains and authorize only known domains in their DNS Firewall without having to care about CNAME
, DNAME
, or Alias
chains.
This capability is available at no additional cost in all AWS Regions. Try it out today!
from AWS News Blog https://ift.tt/Ici2n5b
Share this content: