How to Write Palo Alto Networks Custom Vulnerability and Application Signatures with Examples

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
General Articles
7 min read
L6 Presenter
No ratings

How to Write Palo Alto Networks Custom Vulnerability and Application Signatures with Examples

 

 

Palo Alto Networks NGFW and Prima Access have many predefined IPS vulnerability signatures but sometimes extra custom signatures are needed that are specific to the application being protected as this need internal domain knowledge.

 

I'll provide examples related to the most common type of traffic—web application HTTP traffic—using HTTP Forever as the backend to avoid dealing with SSL for the purposes of this article.

 

Also Destination NAT is configured as to redirect traffic from my internal VM-ware Workstation environment to the outside.

 

nikoolayy1_0-1746717480189.png

 

I'll demonstrate how to write custom signatures through four examples: enforcing parameter length and protecting against brute-force password attacks on a login page using both GET and POST methods. The final example will cover creating an application signature.

 

Note: Avoid wrapping the entire pattern match expression in parentheses () by default. Parentheses in regex are used for grouping, so enclosing the entire expression unnecessarily can lead to unintended behavior.

 

 

1. Parameter length enforcement

 

The first example shows how to create a signature that blocks parameters "user" and "pass" if they exceed 14 characters as a parameter protection from buffer overflow or fuzzing attacks, where humans or automations just try random stuff in the parameter fields till something happens. The two parameters are in "OR" with or conditions as I want to match and exceeding parameter length no matter if it is for the "user" or "pass" parameters. The action is to send TCP RST to the client and server as to not leave any connection opened when the signature is matched.

 

It is interesting that the regex for the second ''pass'' parameter matches also the parameter itself so this is why extra 6 characters are added ''{.20}'' as the delimiter & is at start of the second parameter, so regex for the first parameter " user=[^&]{14,} " can't be be used and the second regex is " pass=.{20,} " as you discover such thing by testing and playing around 😉.

 

 

nikoolayy1_2-1746719732662.png

 

 

nikoolayy1_1-1746710994586.png

 

 

nikoolayy1_0-1746720073083.png

 

 


Also not only the "Pattern Match" operator can be used but  the "Greater Then" Operator that has a context different than "http-req-params" that is "http-req-param-length" but this is for the entire parameter field and it is less granular but also simpler.

 

nikoolayy1_0-1746776224969.png

 

 

The command testing is with "curl" and will work for GET and POST parameters as I have not specified a qualifier that I will do in the next examples.

 

nikoolayy1_0-1746777543645.png

 

 

The Threat log shows examples of the triggered custom signatures.

 

nikoolayy1_3-1746794693397.png

 

 

2. Brute force protection for a login page for GET method query parameters

 

Before testing custom signatures for brute force keep in mind Palo Alto already has predefined signatures for such attacks, so first test them and see the reference links for more information.

 

Using combination signatures that allow to trigger a signature by specifying the number of times something needs to happen is a great way to do DOS or brute force protection on the layer 7 application web level. This approach uses a normal signature that is in allow state and it is used only to match the traffic pattern that if seen too many times will cause a block of the source IP address. The action is "Allow" as this signature is used a trigger by the next signature.

 

nikoolayy1_4-1746779468777.png

 

 

I have two "And" matches as the first regex matches the login page as to not cause too much CPU issues with the custom signature and I also added qulifier to tigger only on GET method again for the same reason. Also the login page match when "Ordered Condtion Match" is enabled should be before the parameter match.

 

It is interesting that the regex for the login page "" /login\\? "" needs "" \\  "" for escape as "" ? "" is a special regex character that matches any one charracter but in this case I needed it to be matched literally as the Context "http-req-uri-path" captures it and this is present as delimeter for query parameters. I think two  escape characters \ are needed and not one because of the Palo Alto's XML configuration format.  The second regex for parameters is simple "" user.*pass.* ""  as "" .* "" will match any or more characters in between.

 

nikoolayy1_3-1746779397462.png

 

After this you make a second signature that is combination based and it is triggered by the first signature and by the time component if there are 10 hits for 60 seconds. The action is to block the source IP address for 10 second. The "Track By" in some cases needs to be change to source and destination if there are several servers behind maybe DNS FQDN name.

 

nikoolayy1_5-1746779831719.png

 

 

nikoolayy1_6-1746779856927.png

 

 

nikoolayy1_7-1746779877599.png

 


To test you just need to run curl command more than 10 seconds in 1 minute and then you will get no reply and timeout after the 10th time.

 

nikoolayy1_1-1746786185920.png

 


 

 

3. Brute force protection for a login page for POST method body parameters
 
The last example is just modification of the first example but the qualifier is changed to "POST" and the second change is the url path is changed "" /login "" as there is no "" ? "" at the parameters are in the POST Body.
 
 
nikoolayy1_1-1746786573055.png

 

To test this you can use curl command with  -d  "user=da&pass=da" and the method is auto switched to POST. 

 
 
nikoolayy1_0-1746786538085.png

 

I used the same code for POST and GET parameters but another example for the query parameters could be "http-req-uri" that unifies the login page and Query pameter match but I saw some issues on my NGFW version.

 

 

nikoolayy1_1-1746787837544.png

 

To implement site wide protection as to allow the number of hits on a login page to be for example 200 per second as this could be number the server can handle you can change the aggregation criteria to be "" destination "" and then maybe change the action to do RST and not block IP addresses as this is like a rate limiter for a URL as the TCP RST will be send to the client till "Time Attribute" value expires, similar to Rate Limiter.

 

 

nikoolayy1_0-1746789543587.png

 

 

 
nikoolayy1_0-1746791671289.png

 

 

4. Application signature basic example

 

In some cases you may want to mark maybe your internal website as a separate application as in this way the default Timeouts and other parameters can be changed just when the website is accessed.

 

In the first tab selects parent application "web-browsing" as Palo Alto needs this as initially the HTTP traffic will match this App ID.

 

The second tab is where port tcp/80 is configured as the example web I used is httpforever and also the timeouts can be controller from this tab as could be the main purpose to create a custom app id.

 

The final tab is where the match signature is configured and the most simple way is Host header match "" httpforever\\.com "" or  "" ^httpforever\\.com$ "" .

 

nikoolayy1_0-1746794140719.png

 

 

nikoolayy1_1-1746794159605.png

 

 

 

nikoolayy1_2-1746794198861.png

 

 
5. Summary
 
As a summary you should be careful when using custom signatures as the command  ""  show bad-custom-signature  "" to see if there are signatures that cause performance issues.
 
My examples are shown as causing performance as they check Web traffic similar to WAF proxies and Palo Alto NGFW and Prisma Access SASE are streaming technologies.
 
Using qualifier as GET or POST and first matching first the "" /login "" URL optimizes the matching to be less CPU intensive and still the examples need to correctly tested on different devices that have different load.
 
Also except the examples I have shown newer versions of NGFW and Prisma Access can use layer 3 and 4 information like TCP and UDP flags and this combined with the Combination signatures can implement Layer 3/4 DOS custom protections (see the reference links). 
 
For HTTP stateless protocol using "" Transaction "" based signatures is the best while for layer3/4 signatures maybe to enforce something that is based on a TCP-SYN then TCP-ACK from the client a "" Session "" based signatures could be better.
 
nikoolayy1_0-1746786941092.png

 

 

Rate this article:
(1)
Comments
Community Team Member

Hi @nikoolayy1 ,

 

This is great stuff !

Thanks for putting this together !

Community Team Member

This is awesome @nikoolayy1 ! Thank you for providing such detailed info! Super helpful!

Community Manager
Community Manager

@Retired Member The amount of effort and detail you put into this is really evident. Thank you for being so generous with your knowledge—it's a huge benefit to the entire community.

  • 455 Views
  • 3 comments
  • 4 Likes
Register or Sign-in
Contributors
Labels
Article Dashboard
Version history
Last Updated:
‎05-28-2025 04:42 PM
Updated by: