To solve this problem, Cloudifyops implemented a Web Application Firewall (WAF). This blog will explain how to set up WAF and scan for vulnerabilities.
WAF helps protect web applications by filtering and monitoring HTTP traffic between a web application and the internet. It typically protects web applications from attacks such as cross-site forgery, cross-site-scripting (XSS), file inclusion, and SQL injection, among others. A WAF is a protocol layer 7 defense (in the OSI model), and is not designed to defend against all types of attacks.
How does it work? By deploying a WAF for a web application, a shield is placed between the web application and the internet. While a proxy server protects a client machine’s identity by using an intermediary, a WAF is a type of reverse-proxy, protecting the server from exposure by having clients pass through the WAF before reaching the server.
A WAF operates through a set of rules often called policies. These policies aim to protect against vulnerabilities in the application by filtering out malicious traffic. The value of a WAF comes in part from the speed and ease with which policy modification can be implemented, allowing for faster response to varying attack vectors; during a DDoS attack, rate limiting can be quickly implemented by modifying WAF policies.
AWS WAF supports and can be used to control how resources like Amazon CloudFront distribution, Amazon API Gateway REST API, Application Load Balancer (ALB), or AWS AppSync GraphQL API respond to web requests.
Web Access Control List (Web ACL) is used to protect a set of AWS resources. You create a Web ACL and define its protection strategy by adding rules. Rules define criteria for inspecting web requests and specify how to handle requests that match the criteria. A default action for the Web ACL is set that indicates whether to block or allow requests that pass the rules inspections.
Rules contain a statement that defines the inspection criteria, and an action to take if a web request meets the criteria. When a web request meets the criteria, it is a match. We can use rules to block or allow matching requests. We can also count matching requests using rules.
Rules groups are reusable. AWS Managed Rules and AWS Marketplace sellers provide managed rule groups. We can also define our own rule groups.
Priority of Rules — If we define more than one Rule in a Web ACL, AWS WAF evaluates each request against the Rules in order based on the Priority value. AWS WAF processes rules with lower priority first. The priorities need not be consecutive, but they must all be different.
AWS Managed Rule groups
AWS WAF Bot control — protection against automatic bots, provides additional visibility through cloudwatch and generates labels that you can use to control bot traffic to your applications (paid rule group, Capacity 50)
Free rule groups
Custom rules can be created to block, allow or count traffic/access which
WAF Setup for ALB
Sample WAF Setup
Here a sample WAF is set up associated with an application load balancer. We have enabled some custom rules and managed rule groups.
Setting up WAF
In the WAF and shield dashboard, create a Web ACL and associate it with the load balancer of the application. It is possible to connect or link with CloudFront, API gateway and AppSync.
Select add resource from the Associated AWS resources.
Select ALB and click next. We will be able to configure rules now.
Once we set the rules, we can set the rule priorities in the next tab.
Click next and the metrics configuration tab will appear.
Configure the CloudWatch metrics and click next. You will be prompted to review the WAF details before clicking create.
WAF Dashboard
Here is a sample dashboard of WAF with the metrics as per the rules we specified.
Rules and Priorities
Rules work on priorities. Consider we add a rule1 allowing traffic from a particular IP address and a rule2 denying access if the URL has a particular path/string. If rule1 is set to be prior than rule2, then a request coming from an IP address that is denied in rule2 but is allowed in rule1 will not be denied.
Requests and status in WAF Dashboard
Here, the drop-down on the right side shows all the rules and rule groups, which can be used to filter out the requests. In this drop down india and pathbase are metrics of custom rules and other metrics starting with AWS are managed rule groups from AWS.
To learn more about these cutting edge technologies & real time industry applied best practices, follow our LinkedIn Page. To explore our services, visit our website.
CloudifyOps Pvt Ltd, Ground Floor, Block C, DSR Techno Cube, Survey No.68, Varthur Rd, Thubarahalli, Bengaluru, Karnataka 560037
Indiqube Vantage, 3rd Phase, No.1, OMR Service Road, Santhosh Nagar, Kandhanchavadi, Perungudi, Chennai, Tamil Nadu 600096.
CloudifyOps Inc.,
200, Continental Dr Suite 401,
Newark, Delaware 19713,
United States of America
Copyright 2024 CloudifyOps. All Rights Reserved