Threat Level: green Handler on Duty: Xavier Mertens

SANS ISC: Internet Storm Center Internet Storm Center

Watch ISC TV. Great for NOCs, SOCs and Living Rooms: https://isctv.sans.edu

Sign Up for Free!   Forgot Password?
Log In or Sign Up for Free!

Latest Diaries

Abusing Web Filters Misconfiguration for Reconnaissance

Published: 2019-11-22
Last Updated: 2019-11-22 06:34:39 UTC
by Xavier Mertens (Version: 1)
0 comment(s)

Yesterday, an interesting incident was detected while working at a customer SOC. They use a “next-generation” firewall that implements a web filter based on categories. This is common in many organizations today: Users' web traffic is allowed/denied based on an URL categorization database (like “adult content”, “hacking”, “gambling”, …). How was it detected? 

We received notifications about suspicious traffic based on bad websites detection (read: “not allowed” in the firewall policy). The alert could be read like:

The IP x.x.x.x  tried to access the URL xxxxxxxxx (matching category: xxxxxxxxx)

Why was it more suspicious than usual? It was generated by an “external” IP address (not belonging from any subnet - routed or non-routable). This was strange and it deserved some deeper investigations! No routing issue, no spoofing, it looked like the traffic was really coming from the wild Internet and triggered the web filter. After a deeper check with the team in charge of the firewall, they discovered the mistake: The web filter was also applied on incoming interfaces and the default denied page was returned to the visitor! The offending IP address was (ab)using the web filter feature to perform some reconnaissance: To detect which web sites are allowed/denied by the organization. How? Just visit the website to be tested by connecting to the public address of the target! 

To achieve this, just adapt your '/etc/hosts' (UNIX) or '%SYSTEM%\drivers\etc\hosts' (Windows) and add a static entry:

x.x.x.x    www.maliciouswebsite.com

Where ‘x.x.x.x.’ is an IP address belonging to the customer.

Not very practical if you must test a lot of sites. Thanks to curl[1], we can automate this in a nice way. Let’s save our malicious sites to be tested in a file, one hostname per line:

$ echo <<__END__ >sites.txt
www.malicious1.com
www.malicious2.be
www.malicious3.tk
__END__

Now, use the power of curl! It has a nice feature to resolve sites to a specific address (via the '--resolve' parameter):

$ cat sites.txt | while read URL
do
  curl -s --resolve $URL:x.x.x.x http://$URL | grep -i “blocked” >/dev/null || echo “$URL is NOT blocked”
done

This command will visit potential malicious URLs by connecting to the customer's IP address. If the website is not allowed in the policy, the default access denied page will be displayed and we search for an interesting keyword like 'blocked'. Keep this in mind in your future security tests, always try to access a suspicious URL combined with an IP address of your target.

Since this incident, the firewall policy has been fixed!

[1] https://isc.sans.edu/forums/diary/Exploiting+the+Power+of+Curl/23934

Xavier Mertens (@xme)
Senior ISC Handler - Freelance Cyber Security Consultant
PGP Key

0 comment(s)

If you have more information or corrections regarding our diary, please share.

Recent Diaries

Gathering information to determine unusual network traffic
Nov 21st 2019
22 hours ago by Manuel Humberto Santander Pelaacuteez (0 comments)

Hancitor infection with Pony, Evil Pony, Ursnif, and Cobalt Strike
Nov 20th 2019
2 days ago by Brad (0 comments)

Cheap Chinese JAWS of DVR Exploitability on Port 60001
Nov 19th 2019
3 days ago by Johannes (0 comments)

SMS and 2FA: Another Reason to Move away from It.
Nov 18th 2019
4 days ago by Johannes (0 comments)

View All Diaries →

Latest Discussions

"slow" half open tests (preparation for attacks?)
created Oct 28th 2019
3 weeks ago by Anonymous (0 replies)

Recommended Desktop Antivirus to use?
created Oct 21st 2019
1 month ago by Anonymous (0 replies)

Suspicious Domain Scoring
created Oct 4th 2019
1 month ago by Luke (1 reply)

SANS ISC InfoSec News RSS Feed broken?
created Aug 29th 2019
2 months ago by Adi (2 replies)

Attack
created Aug 14th 2019
3 months ago by Anonymous (0 replies)

View All Forums →

Latest News

Top Diaries

An infection from Rig exploit kit
Jun 17th 2019
5 months ago by Brad (0 comments)

Wide-scale Petya variant ransomware attack noted
Jun 27th 2017
2 years ago by Brad (0 comments)

Using a Raspberry Pi honeypot to contribute data to DShield/ISC
Aug 3rd 2017
2 years ago by Johannes (0 comments)

Second Google Chrome Extension Banker Malware in Two Weeks
Aug 29th 2017
2 years ago by Renato (0 comments)

Detection Lab: Visibility & Introspection for Defenders
Dec 15th 2017
1 year ago by Russ McRee (0 comments)