LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 06-30-2010, 08:38 PM   #1
peridot121
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Rep: Reputation: 2
UFW block on legitimate ports


Hi, I enabled ufw yesterday, and am finding log entries like:
Jun 30 13:07:51 xxxx kernel: [15702368.296557] [UFW BLOCK] IN=eth1 OUT= MAC=00:22:19:5e:8f:23:00:0c:db:fc:8b:00:08:00 SRC=xx.xx.xx.xx DST=xx.xx.xx.xx LEN=40 TOS=0x00 PREC=0x00 TTL=55 ID=47632 PROTO=TCP SPT=58875 DPT=80 WINDOW=65535 RES=0x00 ACK FIN URGP=0

What is puzzling is I did the command: ufw allow 80. Anyone know what might be going on?
 
Old 07-01-2010, 04:17 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by peridot121 View Post
Hi, I enabled ufw yesterday, and am finding log entries like:
Jun 30 13:07:51 xxxx kernel: [15702368.296557] [UFW BLOCK] IN=eth1 OUT= MAC=00:22:19:5e:8f:23:00:0c:db:fc:8b:00:08:00 SRC=xx.xx.xx.xx DST=xx.xx.xx.xx LEN=40 TOS=0x00 PREC=0x00 TTL=55 ID=47632 PROTO=TCP SPT=58875 DPT=80 WINDOW=65535 RES=0x00 ACK FIN URGP=0

What is puzzling is I did the command: ufw allow 80. Anyone know what might be going on?
Can you cross-reference this with your HTTP server's log files?

Was the source address making authorized use of your server? If so, what was the time/date range?

Last edited by win32sux; 07-01-2010 at 04:21 AM.
 
Old 07-01-2010, 01:38 PM   #3
peridot121
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Original Poster
Rep: Reputation: 2
Interesting, they're all links to our newsletter banner, and seem legit, just accessed through email instead of a browser. Actually, I should say, the links preceeding the blocked ones. They come a couple of minutes before the blocked timestamps.

Last edited by peridot121; 07-01-2010 at 01:43 PM.
 
Old 07-01-2010, 07:37 PM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by peridot121 View Post
Interesting, they're all links to our newsletter banner, and seem legit, just accessed through email instead of a browser. Actually, I should say, the links preceeding the blocked ones. They come a couple of minutes before the blocked timestamps.
I don't use ufw, but I just installed it on a test box to see what the default rule set looks like, and after a quick glance I saw it filters packets in state INVALID (and it applies the "[UFW BLOCK]" prefix to the log entries when it does so, just like you're seeing). So basically, one possibility is that these packets are being sent to DROP because they are in state INVALID, which would imply that the relevant IPs were not in the state table any more. Perhaps the clients are using buggy software and/or awkward termination methods (the packet has the FIN and ACK bits set)? In any case, it should be easy for you to verify whether that is what is happening by manually inserting a LOG rule for packets in state INVALID at the top of your INPUT chain, then comparing it to what ufw is generating:
Code:
iptables -I INPUT -i eth1 -p TCP --dport 80 \
-m state --state INVALID -j LOG --log-prefix "LQ TEST: "
If it does turn out to be the INVALID match at work here (I don't know why ufw doesn't make log file entries more specific), then maybe you can find a common denominator amongst the different IPs which are causing these entries? Like, maybe they are the same OS or user agents?

Last edited by win32sux; 07-04-2010 at 04:49 AM. Reason: Fixed typo.
 
Old 07-06-2010, 03:57 PM   #5
peridot121
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Original Poster
Rep: Reputation: 2
I did add that log entry like you said, and couldn't find anything similar about the entries at all, except that they were all either "ACK FIN" "ACK RST" and one was "ACK PSH". I found on google this person writing in response to someone asking about ACK FIN dropped packets (sorry I lost the link):

"Yes, I would agree with the above - blocking RST-ACK does no harm whatever,
and is often an accidental consequence of using stateful firewalls - they see

the RST packet (and pass it on), then drop the details from the connection
tracking table, so by the time the RST-ACK comes along in response, the
firewall thinks "this isn't part of any established connection, so I'm going

to drop it" (and maybe log it too if you are logging dropped packets).

Either way, the connection gets dropped as required, and both ends are happy,
because the end which sent the RST has said bye-bye anyway, and the end which

recieved it has taken the hint and gone quiet too.

The other thing you see logged quite often for similar reasons is FIN-ACK
packets - the reply FIN-ACK is regarded as optional by many systems, so
netfilter often ends up logging (and dropping) the second one to come along.

No harm done though, because the first one has done the job."
 
Old 07-06-2010, 07:21 PM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally Posted by peridot121 View Post
I did add that log entry like you said, and couldn't find anything similar about the entries at all,
That's great, it means the test was successful (you confirmed the packet is being filtered somewhere else).

Quote:
except that they were all either "ACK FIN" "ACK RST" and one was "ACK PSH". I found on google this person writing in response to someone asking about ACK FIN dropped packets (sorry I lost the link):
No worries. Here it is: http://lists.netfilter.org/pipermail...ne/053782.html

Quote:
"Yes, I would agree with the above - blocking RST-ACK does no harm whatever,
and is often an accidental consequence of using stateful firewalls - they see

the RST packet (and pass it on), then drop the details from the connection
tracking table, so by the time the RST-ACK comes along in response, the
firewall thinks "this isn't part of any established connection, so I'm going

to drop it" (and maybe log it too if you are logging dropped packets).

Either way, the connection gets dropped as required, and both ends are happy,
because the end which sent the RST has said bye-bye anyway, and the end which

recieved it has taken the hint and gone quiet too.

The other thing you see logged quite often for similar reasons is FIN-ACK
packets - the reply FIN-ACK is regarded as optional by many systems, so
netfilter often ends up logging (and dropping) the second one to come along.

No harm done though, because the first one has done the job."
Yeah, that sounds like what I was thinking (that the packet was coming from a non-hostile IP which was simply not in the state table anymore). It would have been nice if he would have elaborated a bit - perhaps hinted at which systems are known for doing this.

Last edited by win32sux; 07-06-2010 at 07:23 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to block all ports and open only select ports on Ubuntu 7.1 Mr.J Linux - Networking 1 11-18-2008 02:45 AM
block ports or websites sujitkale Linux - Server 1 09-23-2007 06:23 AM
how to block torrent ports? LinuxNewbie999 Linux - Networking 1 09-04-2007 08:30 AM
Ports to Block chrisfirestar Linux - General 1 10-28-2003 03:27 AM
how to block ports furquan Linux - Security 9 02-21-2002 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration