The sooner the better: Web App Scanning Without Internet Exposure

In the fast-paced world of app development, security often takes a backseat to feature delivery and tight deadlines. Many organizations rely on external teams to perform penetration testing on their web applications and APIs, but this typically happens after the app has been live for some time and is driven by compliance or regulatory requirements. Waiting until this stage can leave vulnerabilities unaddressed during critical early phases, potentially leading to costly fixes, reputational damage, or even breaches. Early-stage application security testing is key to building a strong foundation and mitigating risks before they escalate.

Wouldn't it be cool if there was a way you could scan your apps in a proactive, automated way while they are still in beta? Since you are reading this article, here in the F5 community, you probably already know, that F5 Distributed Cloud Web App Scanning allows you to dynamically and continuously scan your external attack surface to uncover exposed web apps and APIs.

We all know that exposing apps, which are at an early stage of their development, to the internet is risky because they may contain unfinished or untested code that could lead to unintended data leaks, privacy violations, or other risks.

Therefore you want to keep access to your beta-stage apps restricted.

Scanning but not exposing your apps

At this point in time XC Web App Scanning can only scan apps that are exposed on the internet. But with some configuration tweaks, you can ensure that only WAS has access to your apps.

I want to show a real-world example of how you can restrict access to your application solely to the XC WAS scan engine.

Let's take a look at the beta-stage application we aim to perform penetration testing on. It is hosted on an EC2 instance in AWS. Of course we don't plan to expose our application directly to the internet with a Web Application Firewall. Hence F5 Distributed Cloud Web App & API Protection (WAAP) will be positioned as a cloud-proxy in front of our app. Therefore we must make sure only traffic from F5 Distributed Cloud Services has access to our app.

Next we want to make sure that only the scan engine of F5 Distributed Cloud Web App Scanning can reach our app, again we want to block the rest of the internet from accessing our app.

A pictures of says more then words, we want to achieve something like this:

How to set it up

Let's take a look how we can satisfy our requirements.

... in AWS

In AWS Security Groups are used to control which traffic is allowd to reach reach and leave the resources that it is associated with. Since our application is hosted on an EC2 instance, the Security Group controlls the ingress and egress traffic for the instance. One can think of it like a virtual packet filter firewall.

Usually protocol, port and a source IP address range in CIDR notation for an inbound Security Group. We want to allow access only from F5 Distributed Cloud Services to our EC2 instance. Creating hundreds of ingress rules inside of a Security Group did not seem very efficient to me. Hence I used a customer-managed prefix lists and added all F5 Regional Edges.

Prefix lists are configured in the VPC section of AWS.

The IPv4 address list of all F5 Regional Edges is available here: Public IPv4 Subnet Ranges for F5 Regional Edges

After you created you prefix list, you can use it in a Security Group

This way we met our first goal. Only F5 Regional Edges can reach our app.

... in XC

In the F5 Distributed Cloud a similar kind of access control can be achieved by using Service Policies. Service Policies are a mechanism to control and enforce fine-grained access control for applications deployed in XC. I created a Service Policy that allows access only from the list of ephemeral IP addresses associated with XC Web App Scanning, while blocking all other traffic.

First create a Service Policy, in the Rules section select Allowed Sources.
In the XC Console Service Policies are created in Security > Service Policies > Service Policies.

Then add the IP ranges to the IPv4 Prefix List.

The list of all IP addresses associated with XC Web App Scanning is available here: Use Known IPs in Web App Scanning

The Service Policy is then applied in the section Common Security Controls of a HTTP Load Balancer configuration.

Conclusion

By combining AWS Security Groups and XC Security Policies, I can ensure that my beta app (or beta API) is accessible exclusively to the scan engine of XC Web App Scanning, while blocking access from malicious actors on the internet.

Published Nov 27, 2024
Version 1.0
  • Nice write-up! It will be cool in the future to stream scanning from the XC cloud through the XC Customer Edges(CE) tunnel and this way no inbound ACL or firewall rules will be added as XC CE connect outbound to the XC cloud.