LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-2009, 01:10 AM   #1
arunplr
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Rep: Reputation: 0
Question I want to filter tcp packets depending upon the payload. is it possible.?


Hi ,

I am trying to implement SCADA aware firewall in RHEL 4 (2.6.16.14). Here using modbus/TCP for communcation.Here modbus packet is attached in the payload of tcp.Required kernel module for modbus is added in the netfilter.Iptables rules are added to filter undesirable modbus packets. here i face a problem :- Once a modbus packet is dropped , none of the packets from the client reaches the server. Client resends the dropped tcp packet(in the server) again and again for the ack. if no packets dropped no problem at all.Problem occurs only after when drop a packet from client. Here firewall and modbus server is in the same machine. i tried the same with firewall and server as separate machines, but again the results are same.

When i check the connection status in the server using netstat -a , is ESTABLISHED.

So is it possible to drop a tcp packet in an ESTABLISHED connection state of TCP.?

Please help me to solve this problem.
 
Old 06-30-2009, 02:48 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Well TCP connections are streams of data, it doesn't make sense to disrupt data in the middle of the connection at a per packet level. Some systems will permit interception and rewriting of TCP data, but this is still at a higher level than a per packet thing. As you're seeing, if you remove a packet, then TCP's job is to resend it, that has to happen.
 
Old 07-01-2009, 05:48 AM   #3
arunplr
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Hai,
Thanks for the reply.
Is it possible to modify payload of a tcp packet using netfilter.?

I think if an undesirable packet arrives ,firewall will change the payload of that packet to a default value.
 
Old 07-01-2009, 07:29 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by arunplr View Post
Is it possible to modify payload of a tcp packet using netfilter.? I think if an undesirable packet arrives ,firewall will change the payload of that packet to a default value.
Generally speaking there are two opposing views: one states it is OK to normalize or modify user input to allow further processing, the other says user input that does not conform to specifications should be discarded, making the user responsable for "getting things right". In the first one the developer tries to think from a users perspective, trying to make the ride as smooth as possible by interpreting things and mitigate errors. This causes more (interpretation) errors, overhead, kludgy workarounds and the approach is fundamentally flawed regardless because user input should never be trusted anyway. Making the user responsable for "getting things right" avoids all of that and should be the default way to do things.

I'm saying this because from what I've read sofar I am quite certain you are trying to fix the right solution with the wrong problem. If you want MBAP (Layer 7) dissectors please have a look at Digitalbonds SCADA IDS Preprocessors, Searching File Content with Nessus the other SCADA-related stuff they provide, DHS CSSP and sans.org best practice whitepapers instead.
 
  


Reply

Tags
filtering, packet


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
Difference between FTP payload Data and simply chopping a file into payload size ahm_irf Programming 1 11-07-2007 08:58 AM
In TCP/IP stack,problem with payload of icmp raklo Linux - Networking 1 08-02-2007 10:43 PM
need to extract payload from the tcp packet ahm_irf Programming 1 07-22-2007 06:31 AM
Accessing TCP flags in TCP packets on Linux using C !! vishamr2000 Programming 2 10-16-2006 09:46 AM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM

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

All times are GMT -5. The time now is 10:57 PM.

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