Is it possible to create a waf rule that matches a specific port?

Hello,

I have an internal app (not public facing) that runs on a non-standard port (3000) on a load balancer that is protected by WAF. WAF is blocking something valid so I need to put on an exclusion/allow rule. The security people are asking that any exclusions be as granular as possible.

I asked the main engineer on this project if it was possible to create an allow rule that matches to the specific host name and port. His answer is no. The host name/header yes, but the port no. I can’t find any documentation to dispute what he’s telling me, though I feel like it should be possible. The way it looks now the exception he will put in will also bypass waf for the services running on port 443. It’s not the end of the world because it’s all internal traffic but I will still be surprised if port can’t be queried.

Thanks for your help.

I’m not sure, but I guess that the WAF works on the application level. If you want to filter on port’s (or IP addresses) you will need to use security groups or access control lists.

You are writing rules for the incoming traffic, not outgoing. Host makes sense because this information comes in, port of the service does not because this is going out of the LB.

EDIT: didn’t take into account that you might be exposing this service on the 3000 port as well. Still the answer seems to be no according to this https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-fields.html

I find it odd that you’re using WAF on an internal facing app. But what you described sounds like a use case for security groups rather than waf.

That’s fair, trust me it’s not my call, you know how some security people are.

The application is being blocked due to sql injection, which is required in this case. The users can be anywhere within the org so don’t think a security group will help.

Hi yes 3000 is the incoming port on the LB.

It’s not that I want to filter, it’s that the waf is blocking a valid application and I need an exception for it.