Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
95 lines (56 sloc) 6.02 KB
title: Use a web application firewall (WAF)
last_reviewed_on: 2018-11-29
review_in: 6 months
# <%= %>
[Web application firewall (WAF)]( is an application layer protection for bi-directional web-based traffic. With WAF, you can track web traffic and use specific tools to configure access control for your web content. Doing this improves your service’s security monitoring and security position.
## Why you should use WAF
Your Continuous Integration (CI) and Continuous Deployment (CD) pipelines should include security tests in their workflows to identify any common vulnerabilities in your code. Some common vulnerabilities like [Cross-site Scripting (XSS)]( and [XML command injection attacks]( are still possible in your production environments due to human error.
Combine WAF with CI and CD tools to reduce the risk from those tools, and provide enhanced layered security coverage for your service.
You may also need to use WAF because of:
- GDS or departmental policies or standards
- [Information Assurance (IA)]( to minimise risk
- [Payment Card Industry Data Security Standard (PCI DSS)]( compliance
## When and how to use WAF
Set up a baseline of tests in your project’s alpha phase to identify any security vulnerabilities. As your service’s features grow, extend your tests to cover new vulnerabilities you identify. For example, through exercises like [application threat modeling](
[Good development practices]( should detect and fix common vulnerabilities before they reach production environments. Use WAF to track digital services vulnerabilities that an attacker could exploit.
You should:
- have an independent security audit in place
- use established [logging techniques](
- encrypt data at rest as well as in transit
- subscribe to and apply security patches
- use query variables instead of plain text (stored procedure) to prevent [SQL injections](
You should monitor the Open Web Application Security Project (OWASP) [top 10 most critical web application vulnerabilities](
Adopting WAF is not a formality and should align it with your other security monitoring solutions, like [Security Information Event Management (SIEM)]( When developing use cases you should also factor in the extra time and resources needed to configure WAF rules.
## Managing your WAF
Identify any areas in your app not covered by your WAF and define measures to protect them like using:
- [alerts](#alerts) - as part of your incident management strategy
- [threat modelling](#threat-modelling) - to assess potential weaknesses in your environment
- [reviews](#reviews) - to manage your security controls
### Alerts
It’s not always possible to block a detected attack because some services need to process transactions for any user of that service. In these situations you should [raise events as alerts](
When WAF alerts are raised, make sure you already have an incident policy including:
who should manage an alerts
what their responsibilities are
how to investigate an alert
how to tune out false positives
### Threat modelling
When your service matures, explore its architecture and conduct a threat modelling exercise to locate any specific threats to its environment.
For threats you cannot reduce due to their complexity, cost of fixing or project deadlines, change your WAF rules or add new ones to provide reactive coverage.
### Reviews
Review your WAF after each application change against the risks in the OWASP top 10 category rules.
This should be similar to how you use an [IT Health Check (ITHC)]( to test and confirm the effectiveness of security controls in your environment.
## Case study GOV.UK PaaS
A [GOV.UK PaaS]( tenant uses a pattern with [Amazon Web Services (AWS) WAF]( before forwarding traffic to their apps with enabled shield advance for extra protection.
For more information read the proposed architecture for [implementing a DDoS-resistant Website using AWS Services](
## Case study GOV.UK Pay
[GOV.UK Pay]( use a [NAXSI WAF (pay-nginx-proxy)]( for its Nginx, forked from the Home Office.
GOV.UK Pay operates under the governance of [PCI compliance and DSS point 6.6]( which states the need for web application scanning.
## Contact Cyber Security
Contact the security architects in the GDS Cyber Security team by email at []( or use the [#cyber-security-help Slack channel]( for help and advice.
## Further reading
To find out more about WAF refer to:
- [Open Web Application Security Project (OWASP)]( the OWASP Foundation
- [WASC OWASP Web Application Firewall]( Evaluation Criteria Project
- [National Cyber Security Centre (NCSC)]( guidance