{"id":107,"date":"2020-05-23T17:46:19","date_gmt":"2020-05-23T16:46:19","guid":{"rendered":"http:\/\/www.labtinker.net\/?p=107"},"modified":"2020-05-23T17:46:19","modified_gmt":"2020-05-23T16:46:19","slug":"palo-alto-and-non-std-ssh","status":"publish","type":"post","link":"http:\/\/18.135.13.153\/?p=107","title":{"rendered":"Palo Alto and non-std SSH"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Initially, I wanted to explore the ways that different models of Next Generation firewalls defeat (or not) the simple tunnelling scenario of the previous labs (see &#8216;SSH forwarding&#8217;). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In fact, I didn&#8217;t really get much further than looking at running applications on non-standard ports but it shows a little of the application awareness abilities of a next-gen firewall, in this case a Palo Alto.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As I didn&#8217;t have a physical Palo to hand the one I used is the model available in the AWS marketplace<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-20.png\" alt=\"\" class=\"wp-image-121\" width=\"609\" height=\"141\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-20.png 665w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-20-300x70.png 300w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">(At first, I tied myself in knots setting this lab up  in AWS  after forgetting how routing works there and will maybe put together a note on this later )<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the firewall&#8217;s configuration, I tried to use as basic an out-of-the-box set-up as possible. The OS version in case you can&#8217;t see it above is 9.1.2<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"341\" height=\"88\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/06\/Palo-Version-1.png\" alt=\"\" class=\"wp-image-156\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/06\/Palo-Version-1.png 341w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/06\/Palo-Version-1-300x77.png 300w\" sizes=\"auto, (max-width: 341px) 100vw, 341px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Going into the full configuration options on each model or vendor is beyond the scope of the this post so I will only touch on them where they are relevant to the scope of the lab.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The Lab setup is as follows&#8230;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"373\" height=\"436\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-9.png\" alt=\"\" class=\"wp-image-110\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-9.png 373w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-9-257x300.png 257w\" sizes=\"auto, (max-width: 373px) 100vw, 373px\" \/><figcaption class=\"wp-element-caption\">Figure 1: Topology<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Windows host is on a DMZ with an address of 172.31.200.10, the Linux host on the Internet and our trusty Palo sits between them. It is in turn is configured thusly:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have a source NAT rule to hide our outbound traffic behind the firewall\u2019s external interface in common with almost every firewall that connects to the Internet. The actual configuration is shown here:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-8.png\" alt=\"\" class=\"wp-image-109\" width=\"560\" height=\"156\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-8.png 564w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-8-300x84.png 300w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><figcaption class=\"wp-element-caption\">Figure 2: Palo NAT Tab 1<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"170\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-10.png\" alt=\"\" class=\"wp-image-111\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-10.png 602w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-10-300x85.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><figcaption class=\"wp-element-caption\">Figure 3 Palo NAT Tab 2<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We have the following access rule named &#8216;Windows Out&#8217; (for those without a magnifying glass) which is allowing any traffic out from the Windows Host on the DMZ zone to the External zone which leads to the Internet. This being a stateful firewall it will allow traffic back in if it is return traffic from the outbound session.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"89\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-12-1024x89.png\" alt=\"\" class=\"wp-image-113\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-12-1024x89.png 1024w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-12-300x26.png 300w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-12-768x67.png 768w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-12.png 1400w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Figure 4: Let it all out&#8230;<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Tunnelling Out<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The linux host<em> linux.labtinker.net<\/em> has an ssh listener listening on tcp port 80 which we will connect to from the Windows host as a precursor to tunnelling back in (spoiler alert &#8211; we&#8217;re not going to get as far as tunnelling back)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve realised it is difficult to show the log screens in any detail so will capture the relevant bits&#8230; when our Windows host tried to ssh out to <em>linux.labtinker.net<\/em> on port 80 the traffic was denied.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"101\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-13.png\" alt=\"\" class=\"wp-image-114\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-13.png 472w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-13-300x64.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><figcaption class=\"wp-element-caption\">Figure 5: Oh no you don&#8217;t.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The log shows the traffic is hitting the \u2018default\u2019 deny rule and falling past our \u2018Windows Out\u2019 rule. It\u2019s not immediately clear why this is as the source and destination ip addresses are both allowed by the &#8216;Windows Out&#8217; rule.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, in my rule I have selected any \u2018application\u2019 but not any \u2018service\u2019.  The distinction is important. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> I stipulated that any application should be allowed out. However, on a Palo the service (port) associated with an application is defined separately, and the default option for  this setting is \u2018application default\u2019.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"341\" height=\"144\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-15.png\" alt=\"\" class=\"wp-image-116\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-15.png 341w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-15-300x127.png 300w\" sizes=\"auto, (max-width: 341px) 100vw, 341px\" \/><figcaption class=\"wp-element-caption\">Figure 6: Application Default<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This means is that application traffic will only match the service portion of the rule if is using the application&#8217;s default port which for ssh is tcp 22, for http is 80 etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> We were trying to use tcp port 80 for ssh which is not the default port for this application hence we fell foul of this part of the rule and our trafffic was blocked.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Let\u2019s test this further in two ways: first by changing the ssh listener on <em>linux.labtinker.net<\/em> back to the standard tcp port 22 and trying to connect and secondly by reverting the ssh listener to port 80 and changing the Palo&#8217;s rule to allow the application to be accessed on any service (port) not just the default one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Test One<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">OK, Scout&#8217;s Honour, nothing changed on the rule but running the traffic over the correct port allowed it to sail through&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"104\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-16.png\" alt=\"\" class=\"wp-image-117\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-16.png 700w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-16-300x45.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\">Figure 7: SSH on its default port.<br><br><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Test Two<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And then changing the service in appropirate rule from &#8216;application default&#8217; to &#8216;any&#8217; and re-setting the ssh listener back to tcp port 80.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"384\" height=\"89\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-17.png\" alt=\"\" class=\"wp-image-118\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-17.png 384w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-17-300x70.png 300w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><figcaption class=\"wp-element-caption\">Figure 7: Set service to &#8216;any&#8217;<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We are able to connect  to <em>linux.labtinker.net<\/em> on ssh over tcp port 80<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"91\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-18.png\" alt=\"\" class=\"wp-image-119\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-18.png 551w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-18-300x50.png 300w\" sizes=\"auto, (max-width: 551px) 100vw, 551px\" \/><figcaption class=\"wp-element-caption\">Figure 8: SSH on its non-default port<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Applications not Ports<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Palo Alto typically espouse using applications in the firewall&#8217;s rules rather than services (ports) but as has been demonstrated even if you do use services the \u2018application-default\u2019 settting would give you some protection. &nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A best-practice Palo Alto rule to allow outbound browsing would use the application \u2018web-browsing\u2019 for clear text browsing in conjunction with application &#8216;ssl&#8217; to allow https. (DNS would also be required but probably to specific destinations) &#8211; and of course the rule(s) would have &#8216;application-default&#8217; specified for the service.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"350\" height=\"208\" src=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-19.png\" alt=\"\" class=\"wp-image-120\" srcset=\"http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-19.png 350w, http:\/\/18.135.13.153\/wp-content\/uploads\/2020\/05\/image-19-300x178.png 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><figcaption class=\"wp-element-caption\">Figures 9: No ports please, we&#8217;re Next Generation!<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I didn&#8217;t get around to seeing if tunnelling back over ssh would work but then it seems a bit moot if you&#8217;re defeated getting out of the enterpise using a port that would be allowed (even the most slap-dash outfits wouldn&#8217;t allow port 22 out)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the next couple of posts I&#8217;m going to compare a couple more NG firewalls and see how they fare in a similar set up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Initially, I wanted to explore the ways that different models of Next Generation firewalls defeat (or not) the simple tunnelling scenario of the previous labs (see &#8216;SSH forwarding&#8217;). In fact, I didn&#8217;t really get much further than looking at running applications on non-standard ports but it shows a little of the application awareness abilities of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-firewalls"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":0,"href":"http:\/\/18.135.13.153\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"wp:attachment":[{"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/18.135.13.153\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}