<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom Application/Site Findings in Firewall and Security Management</title>
    <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179620#M32885</link>
    <description>&lt;P data-unlink="true"&gt;Important notes:&lt;/P&gt;
&lt;P data-unlink="true"&gt;HTTPS requests appear to get normalized as https://&amp;lt;domain&amp;gt;&amp;nbsp;with the scheme, but no trailing slash. HTTP requests keep their trailing slash. Thus, to ensure I'm matching to the end of the domain name for both HTTP and HTTPS, I had to add "(/|$)" to the end of the expressions.&lt;/P&gt;
&lt;P data-unlink="true"&gt;Some other results I got along the way confirm either the matching engine is case-insensitive or the input is normalized to lowercase. At one point, I made a request for "http://baddomain.local/gOoDdOmAiN.lOcAl/",&amp;nbsp;and it was allowed by an expression which was entirely lowercase. This isn't strictly correct (paths in URLs are case-sensitive), but I don't see any way it could really present a problem. If there are things you need to access at a domain and things you must not be able to access on the same domain, and the paths to these resources differ only by case, you have much bigger issues.&lt;/P&gt;
&lt;P data-unlink="true"&gt;The "(/|$)" tail to these expressions triggers the "URLs containing characters that may affect performance" warning.&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2023 19:46:42 GMT</pubDate>
    <dc:creator>Bob_Zimmerman</dc:creator>
    <dc:date>2023-05-01T19:46:42Z</dc:date>
    <item>
      <title>Custom Application/Site Findings</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179606#M32883</link>
      <description>&lt;P&gt;For years, I've been wanting to test Check Point's Custom Application/Site objects' matching logic. Finally got a chance to.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Custom App-Site Test Topology.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/20707i72884591411E6216/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Custom App-Site Test Topology.png" alt="Custom App-Site Test Topology.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;/etc/hosts on the client has these two lines added:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;192.168.5.2     gooddomain.local subdomain.gooddomain.local
192.168.5.2     baddomain.local gooddomain.local.baddomain.local subdomain.gooddomain.local.baddomain.local&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I built a self-signed certificate on the server and set up &lt;A href="https://man.openbsd.org/httpd" target="_self"&gt;httpd(8)&lt;/A&gt;&amp;nbsp;to serve a simple page via both HTTP and HTTPS using that self-signed cert. I build a small KSH script on the client with my test cases:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#!/bin/ksh
set -A domainsList "http://gooddomain.local/" \
"https://gooddomain.local/" \
"http://gOoDdOmAiN.lOcAl/" \
"https://gOoDdOmAiN.lOcAl/" \
"http://gooddomain.local:80/" \
"https://gooddomain.local:443/" \
"http://gOoDdOmAiN.lOcAl:80/" \
"https://gOoDdOmAiN.lOcAl:443/" \
"http://subdomain.gooddomain.local/" \
"https://subdomain.gooddomain.local/" \
"http://baddomain.local/" \
"https://baddomain.local/" \
"http://gooddomain.local.baddomain.local/" \
"https://gooddomain.local.baddomain.local/" \
"http://subdomain.gooddomain.local.baddomain.local/" \
"https://subdomain.gooddomain.local.baddomain.local/" \
"http://baddomain.local/gooddomain.local/" \
"http://gooddomain.local:password@baddomain.local/" \
"http://user:gooddomain.local@baddomain.local/" \
"http://baddomain.local/gooddomain.local" \
"http://baddomain.local/gooddomain.local/" \

for domain in ${domainsList[*]}; do
printf "%60s: " $domain
curl -k "$domain" &amp;gt;/dev/null 2&amp;gt;/dev/null
exitCode=$?
if [ $exitCode -eq 0 ]; then
echo "Success"
else
echo "   Fail ${exitCode}"
fi
done&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And finally, I set up the policy on the firewall (standalone, R81.10 jumbo 94) in the middle. Here it is in abbreviated form:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;"rulebase" : [ {
	"rule-number" : 1,
	"source" : [ "Any" ],
	"destination" : [ "Any" ],
	"service" : [ "GoodDomain" ],
	"action" : "Accept",
}, {
	"rule-number" : 2,
	"source" : [ "Any" ],
	"destination" : [ "Internet" ],
	"service" : [ "Any" ],
	"action" : "Accept",
}, {
	"rule-number" : 3,
	"source" : [ "ClientNet", "ServerNet" ],
	"destination" : [ "Outside Private (to reach my NTP server)" ],
	"service" : [ "Any" ],
	"action" : "Accept",
}, {
	"rule-number" : 4,
	"source" : [ "Any" ],
	"destination" : [ "Any" ],
	"service" : [ "SSH" ],
	"action" : "Accept",
}, {
	"rule-number" : 5,
	"source" : [ "Any" ],
	"destination" : [ "Any" ],
	"service" : [ "Any" ],
	"action" : "Drop",
} ]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"GoodDomain" is the Application/Site object I built for testing. HTTPS Inspection is not set up.&lt;/P&gt;
&lt;P&gt;With the first rule's Application/Site object set to match "gooddomain.local" not as a regular expression:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;obsd-client# ./domainTest.sh
                                    http://gooddomain.local/: Success
                                   https://gooddomain.local/: Success
                                    http://gOoDdOmAiN.lOcAl/: Success
                                   https://gOoDdOmAiN.lOcAl/: Success
                                 http://gooddomain.local:80/: Success
                               https://gooddomain.local:443/: Success
                                 http://gOoDdOmAiN.lOcAl:80/: Success
                               https://gOoDdOmAiN.lOcAl:443/: Success
                          http://subdomain.gooddomain.local/:    Fail 56
                         https://subdomain.gooddomain.local/:    Fail 35
                                     http://baddomain.local/:    Fail 56
                                    https://baddomain.local/:    Fail 35
                    http://gooddomain.local.baddomain.local/: Success
                   https://gooddomain.local.baddomain.local/: Success
          http://subdomain.gooddomain.local.baddomain.local/:    Fail 56
         https://subdomain.gooddomain.local.baddomain.local/:    Fail 35
                    http://baddomain.local/gooddomain.local/:    Fail 56
           http://gooddomain.local:password@baddomain.local/:    Fail 56
               http://user:gooddomain.local@baddomain.local/:    Fail 56
                     http://baddomain.local/gooddomain.local:    Fail 56
                    http://baddomain.local/gooddomain.local/:    Fail 56&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not great. It allows some potential phishing domains.&lt;/P&gt;
&lt;P&gt;With the Application/Site object set to match "gooddomain.local/":&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;obsd-client# ./domainTest.sh                                                   
                                    http://gooddomain.local/: Success
                                   https://gooddomain.local/:    Fail 35
                                    http://gOoDdOmAiN.lOcAl/: Success
                                   https://gOoDdOmAiN.lOcAl/:    Fail 35
                                 http://gooddomain.local:80/: Success
                               https://gooddomain.local:443/:    Fail 35
                                 http://gOoDdOmAiN.lOcAl:80/: Success
                               https://gOoDdOmAiN.lOcAl:443/:    Fail 35
                          http://subdomain.gooddomain.local/:    Fail 56
                         https://subdomain.gooddomain.local/:    Fail 35
                                     http://baddomain.local/:    Fail 56
                                    https://baddomain.local/:    Fail 35
                    http://gooddomain.local.baddomain.local/:    Fail 56
                   https://gooddomain.local.baddomain.local/:    Fail 35
          http://subdomain.gooddomain.local.baddomain.local/:    Fail 56
         https://subdomain.gooddomain.local.baddomain.local/:    Fail 35
                    http://baddomain.local/gooddomain.local/:    Fail 56
           http://gooddomain.local:password@baddomain.local/:    Fail 56
               http://user:gooddomain.local@baddomain.local/:    Fail 56
                     http://baddomain.local/gooddomain.local:    Fail 56
                    http://baddomain.local/gooddomain.local/:    Fail 56&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Worse, as it doesn't allow HTTPS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would anybody like to see other URLs tested? I plan to explore other matching expressions, and I plan to try to enable HTTPS Inspection.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;: I realized I should include the exit codes in case some failures are for things other than connectivity being prevented. And of course, I discovered that subdomain.gooddomain.local.baddomain.local was failing to resolve, so I added that to /etc/hosts on the client. Modifications made to the hosts file, the script, and the results above.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit 2&lt;/STRONG&gt;: Added some phishy paths to the script and the results.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 19:51:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179606#M32883</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2023-05-02T19:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Application/Site Findings</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179619#M32884</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Require at least one subdomain:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;^https?://([^/]+\\.)+gooddomain.local(/|$)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As regular expression&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;obsd-client# ./domainTest.sh
                                    http://gooddomain.local/:    Fail 56
                                   https://gooddomain.local/:    Fail 35
                                    http://gOoDdOmAiN.lOcAl/:    Fail 56
                                   https://gOoDdOmAiN.lOcAl/:    Fail 35
                                 http://gooddomain.local:80/:    Fail 56
                               https://gooddomain.local:443/:    Fail 35
                                 http://gOoDdOmAiN.lOcAl:80/:    Fail 56
                               https://gOoDdOmAiN.lOcAl:443/:    Fail 35
                          http://subdomain.gooddomain.local/: Success
                         https://subdomain.gooddomain.local/: Success
                                     http://baddomain.local/:    Fail 56
                                    https://baddomain.local/:    Fail 35
                    http://gooddomain.local.baddomain.local/:    Fail 56
                   https://gooddomain.local.baddomain.local/:    Fail 35
          http://subdomain.gooddomain.local.baddomain.local/:    Fail 56
         https://subdomain.gooddomain.local.baddomain.local/:    Fail 35
                    http://baddomain.local/gooddomain.local/:    Fail 56
           http://gooddomain.local:password@baddomain.local/:    Fail 56
               http://user:gooddomain.local@baddomain.local/:    Fail 56
                     http://baddomain.local/gooddomain.local:    Fail 56
                    http://baddomain.local/gooddomain.local/:    Fail 56&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Allow any number of subdomains (including zero):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;^https?://([^/]+\\.)*gooddomain.local&lt;/SPAN&gt;&lt;SPAN&gt;(/|$)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As regular expression&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;obsd-client# ./domainTest.sh
                                    http://gooddomain.local/: Success
                                   https://gooddomain.local/: Success
                                    http://gOoDdOmAiN.lOcAl/: Success
                                   https://gOoDdOmAiN.lOcAl/: Success
                                 http://gooddomain.local:80/: Success
                               https://gooddomain.local:443/: Success
                                 http://gOoDdOmAiN.lOcAl:80/: Success
                               https://gOoDdOmAiN.lOcAl:443/: Success
                          http://subdomain.gooddomain.local/: Success
                         https://subdomain.gooddomain.local/: Success
                                     http://baddomain.local/:    Fail 56
                                    https://baddomain.local/:    Fail 35
                    http://gooddomain.local.baddomain.local/:    Fail 56
                   https://gooddomain.local.baddomain.local/:    Fail 35
          http://subdomain.gooddomain.local.baddomain.local/:    Fail 56
         https://subdomain.gooddomain.local.baddomain.local/:    Fail 35
                    http://baddomain.local/gooddomain.local/:    Fail 56
           http://gooddomain.local:password@baddomain.local/:    Fail 56
               http://user:gooddomain.local@baddomain.local/:    Fail 56
                     http://baddomain.local/gooddomain.local:    Fail 56
                    http://baddomain.local/gooddomain.local/:    Fail 56&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Exact match, no subdomains:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;^https?://gooddomain.local&lt;/SPAN&gt;&lt;SPAN&gt;(/|$)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As regular expression&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;obsd-client# ./domainTest.sh
                                    http://gooddomain.local/: Success
                                   https://gooddomain.local/: Success
                                    http://gOoDdOmAiN.lOcAl/: Success
                                   https://gOoDdOmAiN.lOcAl/: Success
                                 http://gooddomain.local:80/: Success
                               https://gooddomain.local:443/: Success
                                 http://gOoDdOmAiN.lOcAl:80/: Success
                               https://gOoDdOmAiN.lOcAl:443/: Success
                          http://subdomain.gooddomain.local/:    Fail 56
                         https://subdomain.gooddomain.local/:    Fail 35
                                     http://baddomain.local/:    Fail 56
                                    https://baddomain.local/:    Fail 35
                    http://gooddomain.local.baddomain.local/:    Fail 56
                   https://gooddomain.local.baddomain.local/:    Fail 35
          http://subdomain.gooddomain.local.baddomain.local/:    Fail 56
         https://subdomain.gooddomain.local.baddomain.local/:    Fail 35
                    http://baddomain.local/gooddomain.local/:    Fail 56
           http://gooddomain.local:password@baddomain.local/:    Fail 56
               http://user:gooddomain.local@baddomain.local/:    Fail 56
                     http://baddomain.local/gooddomain.local:    Fail 56
                    http://baddomain.local/gooddomain.local/:    Fail 56&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless somebody else wants to suggest any other URLs to try, it looks like we have a winner.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 19:21:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179619#M32884</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2023-05-01T19:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Application/Site Findings</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179620#M32885</link>
      <description>&lt;P data-unlink="true"&gt;Important notes:&lt;/P&gt;
&lt;P data-unlink="true"&gt;HTTPS requests appear to get normalized as https://&amp;lt;domain&amp;gt;&amp;nbsp;with the scheme, but no trailing slash. HTTP requests keep their trailing slash. Thus, to ensure I'm matching to the end of the domain name for both HTTP and HTTPS, I had to add "(/|$)" to the end of the expressions.&lt;/P&gt;
&lt;P data-unlink="true"&gt;Some other results I got along the way confirm either the matching engine is case-insensitive or the input is normalized to lowercase. At one point, I made a request for "http://baddomain.local/gOoDdOmAiN.lOcAl/",&amp;nbsp;and it was allowed by an expression which was entirely lowercase. This isn't strictly correct (paths in URLs are case-sensitive), but I don't see any way it could really present a problem. If there are things you need to access at a domain and things you must not be able to access on the same domain, and the paths to these resources differ only by case, you have much bigger issues.&lt;/P&gt;
&lt;P data-unlink="true"&gt;The "(/|$)" tail to these expressions triggers the "URLs containing characters that may affect performance" warning.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 19:46:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179620#M32885</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2023-05-01T19:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Application/Site Findings</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179662#M32887</link>
      <description>&lt;P&gt;Great work showing how this works!&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 12:53:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179662#M32887</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2023-05-02T12:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Application/Site Findings</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179751#M32898</link>
      <description>&lt;P&gt;With HTTPS Inspection enabled, HTTPS URLs get their terminal slash after the domain name!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;gooddomain.com/&lt;/P&gt;
&lt;P&gt;Not as a regular expression&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;obsd-client# ./domainTest.sh  
                                    http://gooddomain.local/: Success
                                   https://gooddomain.local/: Success
                                    http://gOoDdOmAiN.lOcAl/: Success
                                   https://gOoDdOmAiN.lOcAl/: Success
                                 http://gooddomain.local:80/: Success
                               https://gooddomain.local:443/: Success
                                 http://gOoDdOmAiN.lOcAl:80/: Success
                               https://gOoDdOmAiN.lOcAl:443/: Success
                          http://subdomain.gooddomain.local/:    Fail 56
                         https://subdomain.gooddomain.local/:    Fail 52
                                     http://baddomain.local/:    Fail 56
                                    https://baddomain.local/:    Fail 52
                    http://gooddomain.local.baddomain.local/:    Fail 56
                   https://gooddomain.local.baddomain.local/:    Fail 52
          http://subdomain.gooddomain.local.baddomain.local/:    Fail 56
         https://subdomain.gooddomain.local.baddomain.local/:    Fail 52
                    http://baddomain.local/gooddomain.local/:    Fail 56
           http://gooddomain.local:password@baddomain.local/:    Fail 56
               http://user:gooddomain.local@baddomain.local/:    Fail 56
                     http://baddomain.local/gooddomain.local:    Fail 56
                    http://baddomain.local/gooddomain.local/:    Fail 56&lt;/LI-CODE&gt;
&lt;P&gt;HTTPS Inspection also avoids the need for the "(/|$)" and lets us end the regular expressions with a slash.&lt;/P&gt;
&lt;P&gt;This makes a sort of sense to me, since the path of an HTTPS request is encrypted, and the slash after the domain name is arguably part of the path. The firewall is clearly reconstructing the URL, though, since it adds a scheme to HTTPS requests. If HTTPS Inspection is disabled, it should probably add the terminal slash at the same time.&lt;/P&gt;
&lt;P&gt;Next, I think I need to test HTTP and HTTPS on ports other than 80 and 443 respectively to see if those cause the port numbers to be included in the reconstructed URL.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 21:05:41 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/179751#M32898</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2023-05-02T21:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Application/Site Findings</title>
      <link>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/183213#M33652</link>
      <description>&lt;P&gt;Nice one!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 13:43:53 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Firewall-and-Security-Management/Custom-Application-Site-Findings/m-p/183213#M33652</guid>
      <dc:creator>_Val_</dc:creator>
      <dc:date>2023-06-05T13:43:53Z</dc:date>
    </item>
  </channel>
</rss>

