Securing and Testing your Exchange Server with Pfsense HAProxy

<div> &NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2526 " id&equals;"quads-ad2526" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine; <h2>&ndash&semi; Using the CVE-2021-26855 Payload<&sol;h2><p>After the recent vulnerabilities that hit Exchange Servers On-premises I found sometime to install KaliLinux and try to check what kind of information would I get from the patched servers&period; <&sol;p><div> &NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2531 " id&equals;"quads-ad2531" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine; <&sol;div><div> &NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2522 " id&equals;"quads-ad2522" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine; <&sol;div><div> &NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2527 " id&equals;"quads-ad2527" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine; <&sol;div><p>I downloaded the payloads and tried to run it against couple of clients that I have patched the servers for luckily no authentication was made&period; <&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-1&period;png"><img width&equals;"504" height&equals;"235" title&equals;"image" style&equals;"display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-1&period;png" border&equals;"0"><&sol;a> &NewLine;<&sol;p><div> &NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2529 " id&equals;"quads-ad2529" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine; <&sol;div><h2>&ndash&semi; Using Nikto scanner<&sol;h2><p>By using Nikto command from Kali Linux I could see what&nbsp&semi; Information could Exchange expose using <&sol;p><p>The command line is nikto &ndash&semi;h mail&period;domain&period;com and the result of the scan would be exposing the Server&rsquo&semi;s name&comma; local IP address&comma; OWA Version&comma;&nbsp&semi; ASP Net platform and version&period; <&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-2&period;png"><img width&equals;"1025" height&equals;"451" title&equals;"image" style&equals;"display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-2&period;png" border&equals;"0"><&sol;a><&sol;p><p>Since I have my Exchange Server published via HAProxy 1&period;8 on Pfsense then I had to tweak HAProxy to strengthen the ciphers&comma; make sure that HSTS is in place and deny the headers that expose the server&rsquo&semi;s sensitive information&period; <&sol;p><p>The result is pretty good as it also has affected the server&rsquo&semi;s score on ssllabs&period;com <&sol;p><p>Prior to the tweaking&nbsp&semi; my owa scan result on SSL Labs would get an A <&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-3&period;png"><img width&equals;"1028" height&equals;"389" title&equals;"image" style&equals;"margin&colon; 0px&semi; display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-3&period;png" border&equals;"0"><&sol;a><&sol;p><p>&NewLine;<p><&sol;p>&NewLine;<&sol;p><h2>&ndash&semi; Pfsense&rsquo&semi;s HAProxy Settings before<&sol;h2><p>Before upgrading Pfsense to the latest version HAProxy was on 1&period;6 and the ssl&sol;tls settings were also different as they were setup through the Advanced SSL options on the frontend however&comma; now this is no longer supported and you&rsquo&semi;ll have to remove that and set it up on the &ldquo&semi;Global Advanced pass thru&rdquo&semi; in the General setting page&period;<&sol;p><blockquote>&NewLine;<h6>ssl-default-bind-options ssl-min-ver TLSv1&period;2<&sol;h6>&NewLine;<h6><font style&equals;"font-weight&colon; normal&semi;"><br>&NewLine;tune&period;ssl&period;default-dh-param 2048<&sol;font><&sol;h6>&NewLine;<h6><font style&equals;"font-weight&colon; normal&semi;"><br>&NewLine;ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256&colon;ECDHE-ECDSA-AES128-GCM-SHA256&colon;ECDHE-RSA-AES256-GCM-SHA384&colon;ECDHE-ECDSA-AES256-GCM-SHA384&colon;DHE-RSA-AES128-GCM-SHA256&colon;DHE-DSS-AES128-GCM-SHA256&colon;kEDH&plus;AESGCM&colon;ECDHE-RSA-AES128-SHA256&colon;ECDHE-ECDSA-AES128-SHA256&colon;ECDHE-RSA-AES128-SHA&colon;ECDHE-ECDSA-AES128-SHA&colon;ECDHE-RSA-AES256-SHA384&colon;ECDHE-ECDSA-AES256-SHA384&colon;ECDHE-RSA-AES256-SHA&colon;ECDHE-ECDSA-AES256-SHA&colon;DHE-RSA-AES128-SHA256&colon;DHE-RSA-AES128-SHA&colon;DHE-DSS-AES128-SHA256&colon;DHE-RSA-AES256-SHA256&colon;DHE-DSS-AES256-SHA&colon;DHE-RSA-AES256-SHA&colon;&excl;aNULL&colon;&excl;eNULL&colon;&excl;EXPORT&colon;&excl;DES&colon;&excl;RC4&colon;&excl;3DES&colon;&excl;MD5&colon;&excl;PSK<&sol;font><&sol;h6>&NewLine;<&sol;blockquote><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-4&period;png"><img width&equals;"895" height&equals;"168" title&equals;"image" style&equals;"margin&colon; 0px&semi; display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-4&period;png" border&equals;"0"><&sol;a><&sol;p><p>Right after you save this&comma; you will still need to change another settings on the Frontend to protect your server&rsquo&semi;s information from being exposed&period;<&sol;p><p>In the HAProxy settings Go to Frontend &gt&semi; Scroll down all the way to &ldquo&semi;Advanced pass thru&rdquo&semi; and paste the following&colon;<&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-5&period;png"><img width&equals;"771" height&equals;"412" title&equals;"image" style&equals;"margin&colon; 0px&semi; display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-5&period;png" border&equals;"0"><&sol;a><&sol;p><blockquote>&NewLine;<p>&num; Remove headers that expose security-sensitive information&period;<&sol;p>&NewLine;<p>rspadd X-Frame-Options&colon;&bsol; SAMEORIGIN<br>&NewLine;rspidel X-FeServer&colon;&period;&ast;&dollar;<br>&NewLine;rspidel &Hat;Server&colon;&period;&ast;&dollar;<br>&NewLine;rspidel &Hat;X-Powered-By&colon;&period;&ast;&dollar;<br>&NewLine;rspidel &Hat;X-AspNet-Version&colon;&period;&ast;&dollar;<br>&NewLine;rspidel X-WsSecurity-Enabled&colon;&period;&ast;&dollar;<br>&NewLine;rspidel X-WsSecurity-For&colon;&period;&ast;&dollar;<br>&NewLine;rspidel X-OAuth-Enabled&colon;&period;&ast;&dollar;<br>&NewLine;rspadd X-Xss-Protection&colon;&bsol; 1&semi;&bsol; mode&equals;block<br>&NewLine;rspadd Strict-Transport-Security&colon;&bsol; max-age&equals;31536000&semi;includeSubDomains&semi;preload<br>&NewLine;rspadd Referrer-Policy&colon;&bsol; no-referrer-when-downgrade<br>&NewLine;rspidel Request-Id&colon;&period;&ast;&dollar;<br>&NewLine;rspidel X-RequestId&colon;&period;&ast;&dollar;<br>&NewLine;rspadd X-Content-Type-Options&colon;&bsol; nosniff<&sol;p>&NewLine;<p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-6&period;png"><br><&sol;a><&sol;p>&NewLine;<&sol;blockquote><p>In the below result&comma; I have got almost everything protected well except for the OWA version which can be a bit problematic&period; In the next article I am going to try and mitigate this so the server can be protected in the expected manner&period; <&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-6&period;png"><img width&equals;"1028" height&equals;"277" title&equals;"image" style&equals;"display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-6&period;png" border&equals;"0"><&sol;a><&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-7&period;png"><img width&equals;"1028" height&equals;"429" title&equals;"image" style&equals;"display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-7&period;png" border&equals;"0"><&sol;a><&sol;p><h2>&ndash&semi; The Result<&sol;h2><p>Now the server is showing a totally different result and the Nikto scan is not revealing anything anymore&period; <&sol;p><p>SSLabs<&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-8&period;png"><img width&equals;"1028" height&equals;"472" title&equals;"image" style&equals;"display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-8&period;png" border&equals;"0"><&sol;a><&sol;p><p><a title&equals;"https&colon;&sol;&sol;securityheaders&period;com&sol;" href&equals;"https&colon;&sol;&sol;securityheaders&period;com&sol;">https&colon;&sol;&sol;securityheaders&period;com&sol;<&sol;a><&sol;p><p>The reason why I got B on security headers is due to the fact that Content-Security-Policy header will malfunction the ECP and OWA Login pages&period; Permission Policy is new feature and I couldn&rsquo&semi;t find anything about it on HAProxy&period; <&sol;p><p><a href&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image-9&period;png"><img width&equals;"1028" height&equals;"506" title&equals;"image" style&equals;"display&colon; inline&semi; background-image&colon; none&semi;" alt&equals;"image" src&equals;"https&colon;&sol;&sol;www&period;moh10ly&period;com&sol;wp-content&sol;uploads&sol;2021&sol;03&sol;image&lowbar;thumb-9&period;png" border&equals;"0"><&sol;a><&sol;p><p>I hope this helps<&sol;p><p>&NewLine;<p><&sol;p>&NewLine;<&sol;p><p>Refences&colon;<&sol;p><p><a title&equals;"https&colon;&sol;&sol;securityheaders&period;com&sol;" href&equals;"https&colon;&sol;&sol;securityheaders&period;com&sol;">https&colon;&sol;&sol;securityheaders&period;com&sol;<&sol;a><&sol;p><p><a title&equals;"https&colon;&sol;&sol;www&period;ssllabs&period;com&sol;" href&equals;"https&colon;&sol;&sol;www&period;ssllabs&period;com&sol;">https&colon;&sol;&sol;www&period;ssllabs&period;com&sol;<&sol;a><&sol;p><p><a title&equals;"https&colon;&sol;&sol;www&period;haproxy&period;com&sol;documentation&sol;aloha&sol;12-0&sol;traffic-management&sol;lb-layer7&sol;http-rewrite&sol;" href&equals;"https&colon;&sol;&sol;www&period;haproxy&period;com&sol;documentation&sol;aloha&sol;12-0&sol;traffic-management&sol;lb-layer7&sol;http-rewrite&sol;">https&colon;&sol;&sol;www&period;haproxy&period;com&sol;documentation&sol;aloha&sol;12-0&sol;traffic-management&sol;lb-layer7&sol;http-rewrite&sol;<&sol;a><&sol;p><div> &NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2523 " id&equals;"quads-ad2523" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine; <&sol;div><p><a title&equals;"https&colon;&sol;&sol;www&period;net7&period;be&sol;blog&sol;article&sol;xss&lowbar;csrf&lowbar;http&lowbar;security&period;html" href&equals;"https&colon;&sol;&sol;www&period;net7&period;be&sol;blog&sol;article&sol;xss&lowbar;csrf&lowbar;http&lowbar;security&period;html">https&colon;&sol;&sol;www&period;net7&period;be&sol;blog&sol;article&sol;xss&lowbar;csrf&lowbar;http&lowbar;security&period;html<&sol;a><&sol;p><&sol;div>&NewLine;&NewLine;<&excl;-- WP QUADS Content Ad Plugin v&period; 2&period;0&period;92 -->&NewLine;<div class&equals;"quads-location quads-ad2530 " id&equals;"quads-ad2530" style&equals;"float&colon;none&semi;margin&colon;0px 3px 3px 3px&semi;padding&colon;0px 0px 0px 0px&semi;" data-lazydelay&equals;"0">&NewLine;&NewLine;<&sol;div>&NewLine;&NewLine;

moh10ly

Recent Posts

Reset passwords for Active Directory Users

Reset and manage your Active Directory users' Passwords Active Directory is one of the most…

3 years ago

Finding Exchange Database hidden mailboxes. ​

Finding Exchange Database hidden mailboxes. Story:Maybe you have been in this situation before, trying to…

3 years ago

Setting up ADConnect and PTA (Password auth through) servers agents behind proxy

If you're using a Proxy server in your firewall or in your network and have…

3 years ago

Get Report of Active Directory Locked Accounts and Machine they logged in from

Story:I got some clients  that have reported some of their users being locked out and…

3 years ago

Checking and Providing Full and SendAs delegate access on O365 Exchange Online

Delegate Permissions This is a code that I have wrote recently to check if an…

3 years ago

Retrieving attachments from Exchange mailbox using python

Story: I got a request from a client who constantly gets CVs and have to…

4 years ago

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298

Warning: Undefined array key "adsense_ad_type" in /www/wwwroot/www.moh10ly.com/wp-content/plugins/quick-adsense-reloaded/includes/amp-condition-display.php on line 298