Blocking Web Advertisements with an External Dynamic List

Showing results for 
Search instead for 
Did you mean: 

Blocking Web Advertisements with an External Dynamic List

L0 Member

Hello everyone,


I am attempting to block web advertisements on our PA-3020. We have two of these devices which utilize Panorama. We have blocked anything categorized as "web-advertisement" on the firewall, which is great, but a ton of ads are still getting through. What we would like to do is as follows:


  • Utilize an external dynamic list (a text file) to block domains
  • When a blocked site is visited, the page will resolve to an "ad blocked" page rather than just not resolving the page at all.


Does anyone have any suggestions we can use? For our typical malware blacklisting, the sites just do not resolve and show a "page cannot be displayed" message. This is logged, which is great, but for the web advertisement blocking, our CIO wants it to show an "Ad Blocked" message. This message works for anything classified as "web-advertisement."


Any suggestions would be greatly appreciated.





nice 🙂
so i'll try it on 8.0beta .

You can use the Yoyo lists in two EDL types, Domain and URL.

With the Domain type, you can block access to the Ads when there is a DNS query to resolve the IP of the server hosting the Ads.

With the URL type, you can block access to the Ads when the host already has a cached IP for the domain, and submits a Client Hello with a matching SNI, or matching the HTTP GET. For HTTPS sessions you need to combine this solution with SSL Decryption to be able to pick up on the HTTP GET message inside the encrypted session.


The way that I implemented this is:


EDL as a Domain list 'Yoyo Ads - Domains':


EDL as an URL list 'Yoyo Ads - URL':;showintro=0&startdate%5Bday%5D=&startdate%...


I configured 'Yoyo Ads - Domains' under my Anti-Spyware profile to block:

Screen Shot 2017-01-31 at 10.48.39 AM.png



Note that the drawback of this solution is that the Threat logs will still get filled up with 'Suspicious DNS query' drop alerts for TID 12000000 - I couldn't find a way to create a logging exception.


The next step was to configure a Security Policy that precedes my 'Internet access' rule to block any Client Hello messages containing a matching SNI. This will take care of HTTPS sessions that got as far as resolving to an IP and attempting to initiate an SSL session to the Ad servers in the list.

Screen Shot 2017-01-31 at 10.53.51 AM.png

Screen Shot 2017-01-31 at 10.54.51 AM.png

You could remove the checkbox for 'Log at Session End' to reduce logging in the Traffic logs if you're not interested in logging for this.


Finally the last step is, if any clear text or decrypted HTTP makes it through, we block the Ad with URL filtering, which profile is tied to our Internet access security rule.

Screen Shot 2017-01-31 at 10.58.41 AM.png


Note that this should be combined with SSL decryption to extend coverage for encrypted HTTP(S) traffic. To make SSL Decryption effective for Chrome browsers, configure a security policy that precedes these rules to Deny 'quic' traffic.


Finally my Security policy set looks like this:

Screen Shot 2017-01-31 at 11.02.34 AM.png



(The Sinkhole rule ties to the sinkhole action for Palo Alto Networks DNS Signatures in the Anti-Spyware profile, you can alternatively choose to sinkhole your 'Yoyo Ads - Domains', but as a result, that will mix your Traffic log entries for compromised host detection, as both, an infected host, or a host browsing to an advertisement will result in a 'subsequent' connection to the Sinkhole IP - so instead - using block for Ads will help you prevent the unintended Traffic log pollution).


If you have better ways to implement this please feel free to pitch in.



I set this up as you describe and it appears to be working great. I see the denies in the various logs. 


Your post is over a year old. Do you have any words of wisdom to add to it since then?


My commit alert is telling me I need to enable certificates. Will look into that next.



With the release of PAN-OS 8.0, there are a couple things to add. Even though you won't be able to except TID 12000000 from writing to the Threat Logs, you can actually define a log forwarding filter to prevent these from propagating to Panorama or Splunk (Syslog).


Screen Shot 2018-04-20 at 9.34.43 AM.png


For a tutorial see:


Also, if there happens to be any domain that needs to be excepted, you can now search and Except domains directly from the EDL's.


Screen Shot 2018-04-20 at 9.32.13 AM.pngScreen Shot 2018-04-20 at 9.31.23 AM.png

Very good. Thank you for posting this information!

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!