Web Application Firewalls Explained. Types & Attributes

published
August 12, 2024
TABLE OF CONTENTS
Get Secure Remote Access with Netmaker
Sign up for a 2-week free trial and experience seamless remote access for easy setup and full control with Netmaker.

A Web Application Firewall (WAF) sits between your web applications and the internet, filtering the traffic that comes through. Like a checkpoint, it scans everything that tries to get in and out.

WAFs are essential because they help block malicious attacks, including common threats like SQL injection and cross-site scripting (XSS). A WAF identifies and blocks these threats before they can cause any damage. It provides a shield that constantly scans for known attack patterns.

Having a WAF isn’t just about blocking bad traffic. It also ensures that legitimate users have a smooth experience. Good WAFs distinguish between malicious bots and real users. They block the former while letting the latter through, ensuring your website’s performance isn’t hampered.

Types of web application firewalls

Network-based WAF

Network-based WAFs are implemented at the network perimeter. This means they can monitor and filter traffic before it even reaches your web servers.

One of the key advantages of a network-based WAF is its efficiency. Because it's placed at a central point in the network, it can handle traffic for multiple applications. This centralization can simplify management and improve performance. 

For instance, if you have multiple web applications running on different servers, a network-based WAF can protect all of them from a single point. That's a huge win in terms of scalability and maintenance.

Suppose you are using AWS and have several web applications deployed across multiple EC2 instances. With a network-based WAF like AWS WAF, you can set up rules that apply to all incoming traffic at the CloudFront distribution level. This means your WAF is inspecting traffic before it hits your EC2 instances, blocking malicious requests and reducing the load on your web servers.

Another example is using a hardware appliance like the F5 BIG-IP ASM (Application Security Manager). When you deploy it at the edge of our corporate network, it provides robust security for all your web applications, whether they're hosted on-premises or in the cloud. 

The BIG-IP ASM can inspect traffic, perform SSL termination, and apply security policies uniformly across all applications. That way, you have a consistent security posture regardless of where your applications reside.

Network-based WAFs also offer high availability and redundancy. For example, they can be deployed in a cluster. This ensures that even if one device fails, the other can take over without any disruption to your web traffic. It's like having a safety net that guarantees continuous protection.

The deployment of network-based WAFs can be a bit more complex compared to host-based ones. You must consider network architecture, routing, and potential bottlenecks. But the payoff is significant. By filtering malicious traffic at the network level, you are effectively safeguarding your web servers from threats before they can cause any damage.

So, while setting up a network-based WAF might require a bit more planning, the benefits in terms of scalability, efficiency, and comprehensive protection make it a compelling option for securing our web applications.

Host-based WAF

Host-based WAFs sit right on individual web servers. They keep an eye on the traffic coming into that specific web application and block anything suspicious. 

Using a host-based WAF is like having a personal bodyguard for each of your applications. These WAFs work by analyzing the incoming requests to the web server and filtering out any that don’t match the security rules we set up.

A host-based WAF works like an app-specific guardian. It gives you a lot of control over what gets through to your application. You can tailor the security settings to match the particular needs of each app. 

For instance, if you are running an e-commerce platform, you can configure the WAF to specifically look out for patterns of attacks like SQL injection or cross-site scripting (XSS).

Deploying these WAFs doesn’t need extra hardware. They are software solutions that we install directly on your web servers. Take ModSecurity, for example. It’s an open-source WAF that you can install on servers running Apache, Nginx, or IIS. Once set up, it can help you block common threats with its built-in rule sets, or you can create custom rules to meet your unique security requirements.

However, keep in mind that host-based WAFs only protect the web application on the server they’re installed on. So, if you have multiple applications on different servers, you need to manage the WAF configurations on each one separately. That can sometimes require a bit more effort in terms of resources and maintenance.

Despite this, the granular control you get is often worth it. You can fine-tune the security measures to match the behavior and risk profile of each application. This way, you ensure that you are not just blocking bad traffic but doing so in a way that minimizes disruption to legitimate users.

Cloud-based WAF

Cloud-based WAFs offer robust protection without the need for on-premise hardware. This makes them ideal for businesses of all sizes. 

One of the best attributes of cloud-based WAFs is that they are highly scalable. They can easily adapt to increased traffic without any physical modifications. 

Take Cloudflare, for example. It offers a comprehensive WAF that integrates smoothly with their CDN services. This means you get both speed and security in one package.

Another great feature is the ease of management. With a cloud-based WAF, updates and patches are handled by the provider. AWS WAF is a good case in point. You configure it through the AWS Management Console, and AWS takes care of the rest. No need to stress about maintenance or updates.

Cloud-based WAFs are also great for multi-cloud environments. If you're using services from multiple cloud providers, a cloud-based WAF can offer a unified security front. You get consistent protection across different cloud platforms, ensuring your web applications remain secure.

Additionally, cloud-based WAFs often come with advanced analytics. This helps in monitoring traffic patterns and identifying potential threats. Their detailed analytics and reporting features help in making informed decisions about your security posture.

Attributes of a good web application firewall

Traffic monitoring and logging

WAFs constantly watch all traffic, both incoming and outgoing, and take note of every little detail. This allows you to spot any suspicious activity before it turns into a real threat.

Let’s say someone tries a SQL injection attack on your website. Your WAF would catch this by looking for patterns in the traffic that match known attack signatures. 

It doesn’t just block the attempt; it logs the event with details like timestamps, source IP addresses, and the exact nature of the attack. This information is invaluable. It helps you understand what happened, who tried it, and how to prevent it in the future.

Another example would be monitoring for brute force attacks. If an attacker tries to guess login credentials by hitting the login page with thousands of attempts, the WAF notices this unusual spike in traffic. 

The WAF can then log each failed attempt, including the IP address and the specific time the attempts were made. This detailed logging means you can take action, like blocking the offending IP or notifying our security team right away.

The logs WAFs generate also help with compliance. Many regulations require detailed records of network activity. With WAF logs, you have a clear and organized record of all traffic events. If you are ever audited, you can easily provide this information to show you are compliant with industry standards.

Moreover, these logs are useful for tuning fine-your defenses. By examining the data, you can see trends and adjust your security measures accordingly. 

For example, if you notice a lot of automated bot traffic, you can tweak your WAF settings to handle bots more effectively, maybe by implementing CAPTCHAs or blocking known bad IP ranges.

Customization of rules

Customizing rules gives you the power to control incoming traffic by filtering requests based on your specific needs. For instance, you might block a particular type of traffic or challenge users with a security question

Custom rules hinge on two main parameters: expressions and actions. The expression part is where you define the criteria for matching traffic. Think of it as setting the rules for what kind of traffic gets the special treatment. 

You're going to use the Rules language for this, which lets you write out these criteria in a way that the WAF can understand. For example, if you want to match traffic based on the country it originates from, you'd specify that in your expression.

Once your expression is set, it's time to decide on the action. Actions tell the WAF what to do with the matched traffic. Maybe you'll choose to block it outright, which means the unwanted visitors won't get to see your site at all. 

Or, you might go for a Managed Challenge, where users have to complete a task to prove they're legitimate. Other possibilities include allowing the traffic or just logging it for future analysis. It’s entirely up to you and what makes the most sense for your needs.

One thing to note is the order of evaluation. Custom rules are processed one after the other. Certain actions, like blocking, can halt further evaluation. This means if a request meets the criteria of a blocking rule, it gets blocked immediately and no other rules are checked. It's crucial to plan the order of your rules carefully.

The beauty of custom rules lies in their adaptability. Whether you're aiming to fend off bad bots, allow only traffic from certain IP addresses, or enforce cookie requirements, there's almost always a way to make it happen.

Threat intelligence integration

Integrating threat intelligence into Web Application Firewalls (WAF) is crucial for robust security. A good WAF updates threat intelligence daily, using multiple sources to identify known IP address threats. 

For instance, they monitor Webroot BotNets, which includes botnet C&C channels and infected machines controlled by botmasters. They also track Webroot Denial of Service, focusing on DOS, DDOS, sync flood anomalies, and traffic detection.

AWS WAF, for example, also integrates intelligent threat mitigation through Managed Rules. One example is the AWS WAF Fraud Control account creation fraud prevention (ACFP) rule group. This manages fraudulent account creation attempts by leveraging APIs to verify client browsers and detect human interactions. They use this to filter legitimate traffic from malicious ones.

Some WAFs also include various threat categories. For example, Oracle’s identify Webroot Mobile Threats related to malicious mobile applications. Webroot Phishing handles IPs hosting phishing sites. It also covers Webroot Proxy, dealing with IPs providing proxy services, and Webroot Reputation, which tracks IPs infected with malware or having a low reputation score.

AWS WAF offers a Bot Control managed rule group. This is essential as it covers a range from benign bots to harmful ones. The targeted protection level of this rule group uses client session data from APIs to better detect malicious activities.

By integrating threat intelligence with your WAF, you ensure your applications remain secure against a wide array of threats. Both Oracle and AWS provide comprehensive solutions to safeguard your network.

DDoS protection

At their core, WAFs act like a shield for your applications, blocking malicious traffic and ensuring only legitimate requests get through. They help protect the integrity of your website and keep it running smoothly, even under attack.

Good WAFs filter out harmful traffic before it even reaches your servers. This is especially useful during a DDoS attack when an overwhelming number of requests try to take your site down. The WAF analyzes incoming traffic and decides whether to allow or block it based on various rules and patterns.

So, for a website that is frequently attacked, you can use a WAF to create custom rules that identify and block malicious traffic. You can set up rate limiting to control the number of requests from a single IP. This helps mitigate the impact of potential DDoS attacks.

Another real-world example is how e-commerce websites use WAFs. During peak shopping seasons, these sites can become targets for DDoS attacks. 

A WAF can help keep the site up and running by blocking bad actors while letting genuine customers make their purchases. Imagine what would happen during Black Friday if your e-commerce site is not protected. It could mean a significant loss in revenue.

Modern WAFs also come with bot protection features. They can differentiate between human traffic and automated bots. This is crucial because many DDoS attacks use botnets. By identifying and blocking these bots, the WAF ensures that your website remains functional for real users.

It's worth mentioning that setting up and maintaining a WAF requires attention and expertise. You need to keep your rules updated to deal with the latest threats. But the effort is worth it. With a WAF in place, you can have peace of mind knowing that your application has an extra layer of defense against DDoS attacks.

SSL/TLS support

SSL/TLS support is crucial for a WAF because it ensures that sensitive information remains secure as it travels over the internet. For example, let's say a customer is entering their credit card details on an e-commerce site. The WAF can decrypt this data, inspect it for threats, and then re-encrypt it before passing it to the server. 

One of the best features of WAFs is how they handle SSL/TLS termination. This means they can terminate the secure connection, inspect the data, and then establish another secure connection with the backend server. This offers a layer of security that’s invaluable. 

Say an attacker tries to exploit a vulnerability in the SSL/TLS protocol itself. The WAF can detect this anomaly and block the malicious traffic before it ever reaches the internal network.

Not all WAFs are equal in their SSL/TLS capabilities, though. Some provide comprehensive support for the latest encryption standards. For example, many modern WAFs support TLS 1.3, which offers better performance and security compared to older versions. This is particularly useful for web applications that handle a lot of sensitive data, like financial services or healthcare platforms.

Another useful feature is how WAFs manage SSL/TLS certificates. The best ones can automate the certificate renewal process, sparing you from the headache of expired certificates causing downtime or security risks. 

For instance, if a certificate is about to expire, the WAF can generate a new one and install it without any manual intervention. This is a massive time-saver and ensures that your encrypted traffic is always secure.

Some WAFs even offer SSL offloading, meaning they take on the heavy lifting of encrypting and decrypting data, so your web servers don't have to. This can significantly boost the performance of your web applications because it frees up server resources.

Lastly, it's worth mentioning that many WAFs provide detailed logging and reporting for SSL/TLS traffic. This can be incredibly valuable for diagnosing issues and for regulatory compliance. 

For example, if your company must adhere to GDPR or HIPAA, these logs can provide the necessary audit trails to demonstrate compliance.

So, when considering a WAF, don't underestimate the importance of robust SSL/TLS support. It’s not just about securing data; it's about ensuring your entire network infrastructure is resilient against threats.

Common threats mitigated by web application firewalls

When we talk about the common threats that WAFs mitigate, there are quite a few that come to mind. One of the first is SQL injection attacks. Let's say someone tries to sneak in malicious SQL code through a web form on our site. A WAF spots this abnormal behavior and blocks it, keeping our database safe from unauthorized access or manipulation.

Another biggie is Cross-Site Scripting (XSS). Imagine a scenario where an attacker injects malicious scripts into our web pages. When unsuspecting users visit the page, their browsers execute the harmful script. A WAF helps by catching these scripts before they ever reach the user's browser, ensuring a safer browsing experience.

Then there's the issue of Cross-Site Request Forgery (CSRF). This can be pretty sneaky. It tricks users into performing actions they didn't intend to, like changing account details or making unauthorized transactions. Our WAF can recognize and stop these kinds of requests, helping to protect user accounts from unauthorized changes.

Bot attacks are another common threat. Think of bots trying to overwhelm our site with fake traffic, scraping content, or even attempting brute force login attacks. WAFs have algorithms to distinguish between legit users and bots, so they can block the harmful ones and keep our site running smoothly.

Malware injection is also a concern. Hackers may try to inject malicious software into our web applications. A WAF scans for known patterns of malware and blocks them, safeguarding both our server and our users' devices.

It's also worth mentioning that WAFs can keep an eye out for file inclusion attacks. This is where attackers try to execute or access unauthorized files. By monitoring file requests and blocking anything that looks fishy, a WAF can stop this threat in its tracks.

These are just a few examples, but as you can see, WAFs play a crucial role in shielding our web applications from a variety of threats. It’s like having a vigilant guard on duty 24/7, always ready to spot and neutralize any suspicious activity.

SQL injection

A Web Application Firewall (WAF) is designed to protect against SQL injection attacks by monitoring network traffic at the application level. It inspects and blocks incoming requests for potentially malicious signatures, character sequences, or patterns indicative of an SQL injection attempt. 

By monitoring and filtering HTTP GET and POST requests, WAFs can block data packets deemed malicious, identify and block known harmful SQL syntax, and parse incoming SQL syntax to assess its potential harm. They may also add "escape" characters to SQL in order to de-risk it.

However, there are many situations where a WAF may fail to protect against SQL injections. For instance, WAFs focus on detecting known attack patterns and signatures, which leaves them vulnerable to more sophisticated or unknown attack methods that bypass their defenses. 

Attackers can manipulate the payload, use nested encodings, or place the malicious part of the request beyond the bytes of the request checked by the WAF. These techniques exploit loopholes within the set rules and configurations, allowing attackers to get through.

Misconfiguration is another issue. If a WAF isn't configured correctly, or if it uses only general rules without tuning to the specific web application, it may not provide sufficient protection. Changes made by developers to the application might also render the protection ineffective if the WAF isn't updated and adjusted regularly.

Additionally, a WAF can't deal with issues arising from the application's own code or other data sources outside incoming network traffic. This limitation means potential vulnerabilities remain exposed. 

Some WAFs are also vulnerable due to fail open and fail close settings during software or hardware failures, allowing attackers to exploit these vulnerabilities with DoS or DDoS attacks. Zero-day exploits, where vulnerabilities are discovered and exploited by attackers before developers or system administrators are aware, also pose a significant risk.

WAFs might miss payloads using JSON syntax in SQL injection attacks. For example, Claroty researchers bypassed Amazon Web Services' built-in WAF by using JSON syntax in their SQL injection attack. They were able to exfiltrate sensitive information using the SQLi vulnerability over the cloud. 

The same JSON-in-SQL attack also worked against WAFs from Cloudflare, F5, Imperva, and Palo Alto Networks. Another example involved a Reddit user who tested several SQL injection payloads against a WAF, finding that the WAF inconsistently blocked some requests based on certain keywords while allowing other suspicious queries.

A true SQL injection like `/?id=1' or 1=1--` returned a 403 error, indicating that the WAF blocked the request, while a false SQL injection like `/?id=1' or 1=2--` returned a 404 error, suggesting no block.

Finally, an attacker could bypass case-sensitive WAF rules by sending custom requests with mixed-case letters. This technique shows that WAFs, relying on rule-based detection, can sometimes be easily tricked, letting malicious requests slip through.

Cross-site scripting (XSS)

Cross-site scripting, or XSS, is where an attacker injects malicious scripts into web pages viewed by other users. These scripts can then execute in the victim's browser, potentially leading to data theft, session hijacking, or other malicious actions.

Web Application Firewalls (WAFs) can be a powerful tool against XSS attacks. They inspect incoming traffic and filter out the bad stuff before it can do any harm. With XSS, a WAF can detect and block those malicious scripts before they reach the user's browser.

For example, if an attacker tries to inject a script like `<script>alert('XSS')</script>`, a well-configured WAF will recognize this pattern and stop it in its tracks. It does this by employing a set of rules or heuristics designed to identify and block common XSS payloads. This means your users are protected from attackers trying to run unauthorized scripts on their browsers.

Of course, no security measure is perfect. While a WAF can significantly reduce the risk of XSS, it's essential to also follow secure coding practices. This means validating and sanitizing all user inputs on the server side and using proper frameworks that escape output automatically.

In essence, while a WAF provides a first line of defense against XSS, it should be part of a broader, multi-layered security strategy. Combining a WAF with secure coding practices and regular security testing can give you the best shot at keeping those nasty XSS attacks at bay.

Remote File Inclusion (RFI)

Remote File Inclusion (RFI) is where attackers exploit vulnerabilities to include a remote file, often a malicious script, into the server or application. This can lead to data breaches, unauthorized code execution, and even a full system compromise.

When configuring a web application firewall to defend against RFI attacks, there are a few key steps to focus on. Firstly, input validation is crucial. The WAF can check incoming requests for potentially malicious payloads. 

For example, if a URL parameter is supposed to be a simple value but contains suspicious patterns like "http://", the WAF can flag or block it. 

Additionally, you must implement strict whitelisting rules for file paths and URLs. By allowing only predefined, trusted sources, you limit the scope of potential RFI exploits. For instance, if your application should only fetch resources from your domain, the WAF can enforce this policy by blocking requests to any other domains.

Another aspect is the use of regular expressions. These can be set up in the WAF to identify and block common RFI attack attack vectors. For example, patterns like "(base64_decode|" or "shell_exec(" can be used to identify malicious file inclusions. 

Many WAFs come with built-in rulesets that cover these scenarios, but fine-tuning them to fit the specific needs of your application can significantly enhance security.

Logging and monitoring also play a vital role. By keeping an eye on the WAF logs, ou can identify and respond to suspicious activity promptly. If you notice repeated attempts to exploit an RFI vulnerability, you could investigate further and apply deeper security measures, such as patching the application code or updating server configurations.

Remember, while a WAF is a powerful tool in protecting against RFI, it's just one layer of defense. Combining it with secure coding practices, regular updates, and comprehensive monitoring creates a much stronger shield against potential threats.

Cross-Site Request Forgery (CSRF)

Cross-Site Request Forgery (CSRF) is a sneaky attack where someone tricks a user into performing actions they didn't intend to. Imagine you're logged into your bank account in one tab, and in another tab, you click on a link that transfers money without your knowledge. That's CSRF in action.

WAFs can play a crucial role in defending against CSRF attacks. A WAF sits between the end user and your web application, analyzing all HTTP requests. When it detects anything fishy, like a request that doesn’t match the expected pattern or lacks proper authorization tokens, it blocks it.

Let's say your web app uses a specific token to verify user actions. A WAF monitors incoming requests to ensure that this token is present and correct. If an attacker tries to send a forged request without the token, the WAF identifies the anomaly and blocks it immediately. This barrier is essential in stopping unauthorized actions that could compromise user accounts.

Another interesting point is how a WAF can manage cookie-based protection. Let's say your CSRF protection relies on cookies. The WAF can inspect these cookies to make sure they are valid and haven't been tampered with. If an attacker somehow manipulates the cookie to bypass CSRF protections, the WAF can catch this and prevent the action.

So, a WAF acts like a digital bodyguard for your web application, ensuring that every request is legitimate. It inspects, verifies, and blocks anything that doesn’t comply with your security policies. This way, CSRF attacks have a much harder time getting through.

Zero-Day exploits

Zero-day exploits are one of the stealthiest threats in the cybersecurity world. These are vulnerabilities that developers don't know about yet. So, there's no patch available. When attackers discover these flaws, they can do a lot of damage before anyone even notices.

One of the best defenses we have against zero-day exploits is a Web Application Firewall (WAF). A WAF sits between your web application and the internet, filtering out suspicious requests. Its job is to catch attacks before they hit your application.

For instance, take the 2017 Equifax breach. Hackers exploited a zero-day vulnerability in the Apache Struts framework. They gained access to sensitive data of nearly 147 million people. Equifax didn't have the right defenses in place, including an effective WAF.

A WAF works by examining incoming traffic based on predefined rules. It looks for patterns that suggest malicious activity. If a request looks sketchy, the WAF blocks it. For example, if someone tries SQL injection, the WAF can recognize the malicious string in the query and stop it.

Cloud-based WAFs are particularly powerful. They benefit from threat intelligence gathered across their vast networks. These WAFs are constantly updated with new patterns and threat signatures. So, they can block zero-day exploits that they haven't seen before, based on behavior alone.

Let's say you're running an e-commerce site. You notice your site is suddenly getting weird requests. These requests try to exploit a vulnerability that wasn't known before. A solid WAF would intercept those requests before they reach your servers. This preemptive strike can save you a lot of trouble, from data breaches to downtime.

A WAF is not foolproof, but it dramatically lowers the chances of an attacker walking right in. And when a new zero-day exploit surfaces, having a WAF in place gives you crucial time to patch your system while the WAF handles the incoming threats.

A well-configured WAF doesn't just block known threats; it adapts to new ones. And in today's rapidly evolving threat landscape, that adaptability is key.

Get Secure Remote Access with Netmaker
Sign up for a 2-week free trial and experience seamless remote access for easy setup and full control with Netmaker.
More posts

GET STARTED

A WireGuard® VPN that connects machines securely, wherever they are.
Star us on GitHub
Can we use Cookies?  (see  Privacy Policy).