{"id":60776,"date":"2024-03-16T11:51:17","date_gmt":"2024-03-16T06:21:17","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=60776"},"modified":"2024-03-21T11:59:03","modified_gmt":"2024-03-21T06:29:03","slug":"aws-waf-web-application-firewall","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/aws-waf-web-application-firewall\/","title":{"rendered":"AWS WAF \u2013 Web Application Firewall"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">AWS WAF is a web application firewall that helps protect your web applications or APIs against common web exploits by monitoring and filtering the HTTP and HTTPS requests that reach your application. It allows you to create rules to block, allow, or monitor (count) web requests based on conditions that you define. AWS WAF is designed to integrate seamlessly with other AWS services, such as Amazon CloudFront and Application Load Balancer (ALB), to provide a comprehensive security solution for your applications.<\/span><\/p>\n<h2><strong>Working with AWS WAF<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">AWS WAF works by inspecting web requests that reach your application and applying rules to determine whether to allow, block, or monitor the requests. You can create rules based on various criteria, such as IP addresses, HTTP headers, or request parameters. When a request matches a rule, AWS WAF takes the specified action, such as blocking the request or allowing it to proceed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">AWS WAF also provides a feature called Managed Rules, which are pre-configured rules that are designed to protect against common web exploits, such as SQL injection and cross-site scripting (XSS). You can use these Managed Rules to quickly enhance the security of your applications without having to create custom rules.<\/span><\/p>\n<h2><strong>Features of WAF<\/strong><\/h2>\n<h3>Key Features of AWS WAF:<\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Customizable Rules: You can create custom rules tailored to your application&#8217;s specific security requirements.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Managed Rules: AWS WAF provides managed rule sets that help protect against common threats like SQL injection and cross-site scripting (XSS).<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Logging and Monitoring: AWS WAF provides detailed logs and metrics that help you monitor incoming traffic and identify potential security threats.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Integration with AWS Services: AWS WAF integrates seamlessly with other AWS services like CloudFront and ALB, allowing you to protect your applications without impacting performance.<\/span><\/li>\n<\/ul>\n<h2><strong>Use of WAF<\/strong><\/h2>\n<h3><strong>How to Use AWS WAF?<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\"><strong>1.<\/strong> <strong>Create a Web ACL<\/strong>: Start by creating a Web ACL, which is a set of rules that define how AWS WAF filters incoming requests.<\/span><\/p>\n<p><b>1.1<\/b><span style=\"font-weight: 400;\"> Choose a resource type for Cloudfront distributions the region is N.Virginia as it\u2019s a global service, for Regional services such as Application Load Balancers, Amazon API Gateway REST APIs, Amazon App Runner services, AWS AppSync GraphQL APIs, Amazon Cognito user pools and AWS Verified Access Instances region needs to be selected where the resource that needs to be protected exists.<\/span><\/p>\n<p><b>1.2<\/b><span style=\"font-weight: 400;\"> Provide a name for WebACL &amp; Cloudwatch Metric name.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60778 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-08-03-1.png\" alt=\"\" width=\"561\" height=\"517\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-08-03-1.png 561w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-08-03-1-300x276.png 300w\" sizes=\"(max-width: 561px) 100vw, 561px\" \/><\/p>\n<p><b>1.3 <\/b><span style=\"font-weight: 400;\">Choose the actual resources on which WAF needs to be implemented, here we are placing WAF over the Application load balancer named <\/span><i><span style=\"font-weight: 400;\">k8s-main-aaab12ceaf<\/span><\/i><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60779 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-08-44.png\" alt=\"\" width=\"571\" height=\"137\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-08-44.png 571w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-08-44-300x72.png 300w\" sizes=\"(max-width: 571px) 100vw, 571px\" \/><\/p>\n<p><span style=\"font-weight: 400;\"><strong>2<\/strong>.<strong> Define Rules:<\/strong> Define the rules within your Web ACL to specify which requests to Allow, Block, or Count.<\/span><\/p>\n<p><b>2.1<\/b><span style=\"font-weight: 400;\"> We can either add managed rules or own rules, Managed rules are both free as well as paid and are managed by big vendors such as AWS,Cloudbric Corp., Cyber Security Cloud, F5, Fortinet, GeoGuard, Imperva, ThreatSTOP.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60780 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-09-35.png\" alt=\"\" width=\"635\" height=\"155\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-09-35.png 635w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-09-35-300x73.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-09-35-624x152.png 624w\" sizes=\"(max-width: 635px) 100vw, 635px\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60781 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-12.png\" alt=\"\" width=\"629\" height=\"327\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-12.png 629w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-12-300x156.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-12-624x324.png 624w\" sizes=\"(max-width: 629px) 100vw, 629px\" \/><\/p>\n<p><b>2.2<\/b><span style=\"font-weight: 400;\"> For Own managed Rules we can have rules such as IP list of our self-resources that we need to Allow and do not want our WAF to inspect and block.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60782 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-51.png\" alt=\"\" width=\"472\" height=\"498\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-51.png 472w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-51-284x300.png 284w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-10-51-24x24.png 24w\" sizes=\"(max-width: 472px) 100vw, 472px\" \/><\/p>\n<p><b>2.3<\/b><span style=\"font-weight: 400;\"> Rules that are implemented have 5 actions that can be if a rule matches our condition, actions are to Allow, Block, Count, CAPTCHA, Challenge.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60783 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-11-29.png\" alt=\"\" width=\"379\" height=\"213\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-11-29.png 379w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-11-29-300x169.png 300w\" sizes=\"(max-width: 379px) 100vw, 379px\" \/><\/p>\n<p><b>2.4<\/b><span style=\"font-weight: 400;\"> Default action for WAF should be decided to either Allow or Block connections and this is selected as per the use case.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>3.<\/strong> Setting the Rule Priority &#8211; Prioritize the rules as rules are evaluated from top to bottom, one such example is to keep the Allow list in top order.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60784 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-08.png\" alt=\"\" width=\"817\" height=\"195\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-08.png 817w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-08-300x72.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-08-768x183.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-08-624x149.png 624w\" sizes=\"(max-width: 817px) 100vw, 817px\" \/><\/p>\n<p><span style=\"font-weight: 400;\"><strong>4. <\/strong>Enable\/Disable sampled requests that are used just for the quick look for the last 3 hours of data.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60785 size-full\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-57.png\" alt=\"\" width=\"810\" height=\"354\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-57.png 810w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-57-300x131.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-57-768x336.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/Screenshot-from-2024-03-11-16-12-57-624x273.png 624w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/p>\n<p><strong>Snapshot of Sampled Requests<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>5.<\/strong> <strong>Successful WAF implementation:<\/strong> One More step towards Successful WAF implementation is to enable logging and to store logs so that which IPs are being blocked and under what Rules these IPs are blocked can be tracked.<\/span><\/p>\n<p><b>5.1<\/b><span style=\"font-weight: 400;\"> Having track of these logs are required to monitor whether the genuine IP are being blocked or not.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>6.<\/strong> <strong>Monitor and Fine-tune:<\/strong> Monitor the traffic to your web applications using AWS WAF logs and metrics. Fine-tune your rules based on the traffic patterns and security requirements of your applications.<\/span><\/p>\n<h2><strong>Points to Remember<\/strong><\/h2>\n<ol>\n<li><span style=\"font-weight: 400;\">WAF should always be implemented in Count mode for first time.<\/span><\/li>\n<li><span style=\"font-weight: 400;\"> WAF Logs should be evaluated in order to track IPs that are being blocked if WAF would be in block mode.<\/span><\/li>\n<\/ol>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">AWS WAF is a powerful tool that can help enhance the security of your web applications hosted on AWS. By creating rules to block, allow, or monitor web requests, you can protect your applications against common web exploits and ensure their availability and security. With its seamless integration with other AWS services, such as CloudFront and ALB, AWS WAF provides a comprehensive security solution for your applications in the cloud.<\/span><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Introduction AWS WAF is a web application firewall that helps protect your web applications or APIs against common web exploits by monitoring and filtering the HTTP and HTTPS requests that reach your application. It allows you to create rules to block, allow, or monitor (count) web requests based on conditions that you define. AWS WAF [&hellip;]<\/p>\n","protected":false},"author":1259,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":19},"categories":[2026,4308,2348],"tags":[248,227,2533],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60776"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1259"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=60776"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60776\/revisions"}],"predecessor-version":[{"id":60896,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60776\/revisions\/60896"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=60776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=60776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=60776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}