badaboom003-asdf@xxxxxxxxx wrote:
Hi,
My server was brought down by a group in China who were able to use my squid proxy to send and receive requests from their IPs. There were over 370 IPs hitting my server. I'm wondering where I went wrong and what I need to fix to prevent this in the future? Below are a snippet from my cache.log and my squid.conf file with IP obfuscated. One thing I noticed was that they connected through port 443, which I have in my Safe_Ports list. Should I remove all of those ports from my safe list?
Any help would be greatly appreciated. Thanks,
Chris-
My cache.log file
=================
2008/05/27 01:36:21| The request CONNECT 205.188.153.121:443 is DENIED, because it matched 'all'
2008/05/27 01:36:21| The reply for CONNECT 205.188.153.121:443 is ALLOWED, because it matched 'all'
The CONNECT attempt was blocked. What you see there being 'ALLOWED' is
the denial 404 response going out to whomever tried it.
2008/05/27 01:36:21| The request GET http://ad.media-servers.net/st?ad_type=pop&ad_s...ed_pop_types=29&pop_times=1&pop_frequency=0$
2008/05/27 01:36:22| The request GET http://ad.media-servers.net/st?ad_type=pop&ad_s...ed_pop_types=29&pop_times=1&pop_frequency=0$
2008/05/27 01:36:22| The request GET http://202.86.6.132/config?.redir_from=?&.tries=...ntl=us&.bypass=&.partner=&.chkP=Y&.done=ht$
2008/05/27 01:36:22| The reply for GET http://ad.media-servers.net/st?ad_type=pop&ad_...size=053&banned_pop_tyimes=1&pop_frequency$
2008/05/27 01:36:22| The request GET http://www.clickclickclick.com:80/default.asp is ALLOWED, because it matched 'port80'
This is the key bit. You blanket accept on port 80.
2008/05/27 01:36:22| The request GET http://203.209.228.245/isp_verify_user?l=_Dave_M_&p=ty is ALLOWED, because it matched 'port80'
2008/05/27 01:36:22| The request POST http://fly.emirates.com/IBE/SearchAvailability.aspx is ALLOWED, because it matched 'port80'
2008/05/27 01:36:22| The request GET http://edit.in.yahoo.com/config/loginpasswd=23131&.save=1 is ALLOWED, because it matched 'por$
2008/05/27 01:36:22| The request GET http://fly.emirates.com/ is ALLOWED, because it matched 'port80'
2008/05/27 01:36:22| The reply for GET http://ad.media-servers.net/st?ad_type=pop&adtion=24_pop_types=29&pop_times=1&pop_frequency$
2008/05/27 01:36:22| The request POST http://fly.emirates.com/IBE/SearchAvailability.aspx is ALLOWED, because it matched 'port80'
2008/05/27 01:36:22| The request POST http://mihen.info/Res/CheckProxy.php is ALLOWED, because it matched 'port80'
2008/05/27 01:36:22| The request GET http://fly.emirates.com/ is ALLOWED, because it matched 'port80'
2008/05/27 01:36:22| storeLateRelease: released 0 objects
and on and on...
My Squid Config File:
=====================
http_port XXX.XXX.XXX.XXX:80 defaultsite=www.mysite.com vhost
cache_peer 127.0.0.1 parent 80 0 no-query originserver name=server_1 login=PASS
cache_peer_domain server_1 .mysite.com mysite.com
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
cache deny QUERY
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
debug_options ALL,1 33,2
hosts_file /etc/hosts
url_rewrite_host_header off
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl SSL_ports port 443 563 # https, snews
acl SSL_ports port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 563 # https, snews
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl port80 port 80
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny to_localhost
http_access allow port80
http_access allow localhost
http_access deny all
http_reply_access allow all
icp_access allow all
visible_hostname www.mysite.com
coredump_dir /var/spool/squid
It's situations like these is why I always recommend using ACL to
crontol the accelerator/reverse proxy access.
The problem was your "http_access allow port80" - thats a blanket accept
of any request going to *any* webserver.
You would do well to add an ACL listing your domain names:
acl mydomains dstdomain .mysite.com mysite.com
and using it to control both the peer access and the acceptable
requests. Like so:
# pass accelerated domains to the peer
cache_peer_access server_1 allow mydomains
cache_peer_access server_1 deny all
# keep DNS out of the equation.
never_direct allow mydomains
# prevent access through the proxy to anywhere else
http_access allow mydomains
http_access deny all
instead off all these (adding to the config in their position would be
good):
> http_access deny CONNECT !SSL_ports
> http_access deny to_localhost
> http_access allow port80
> http_access allow localhost
> http_access deny all
It also makes "cache_peer_domain" irrelevant.
Amos
--
Please use Squid 2.7.STABLE1 or 3.0.STABLE6