📄 readme.tcpstream
字号:
I. SummaryThe TCP Stream Reassembly plugin allows one to reconstruct the tcpstreams between two hosts based on the observed packets going betweenthem. This is necessary as it is quite easy to ellude snort's currentincarnation by writing a program to send attack code 1 byte at a time.The victim's tcp stack will correctly reassemble this data and pass iton to the process listening at the designated port. Snort which onlydoes content matching from packets will never see a thing. The authorhas demonstrated this quite satisfactorily to himself and will not bedistributing the (trivial) code to do so. :-)II. TCP StreamsA little on the design philosophy here (yes there is a philosophy ofsorts). TCP is designed to insure correct and sequential delivery ofdata betwen two hosts even over noisy links. To achieve this, eachhost (A and B) pick a (in theory) random number representing the firstbyte of data being sent by that host (this is the initial sequencenumber). Each chunk of data in the stream is sent with a sequencenumber which indicates where in the stream this particular bit of datastarts at. The use of SEQ numbers allows TCP to meet the orderedrequirement placed on it. A receiving host can take an individualpacket of data and determine where within the stream the data belongs.To acheive correct delivery of data, when a packet is being sent fromA to B, A computes a checksum and places it in the TCP packet. Uponreceiving the packet, B computes the checksum and if they match it, itis correct. The next time B sends data to A, it acknowledges that ithas received correct data up to and including a given sequence number.This is the purpose of the ACK field. It allows host B to tell host Athat all of A's data represented by sequence numbers up to ACK areokay.Each host has a window size indicating the amount of unacknowledged itwill buffer. When host A has sent host B's maximum amount of data, it_must_ wait until some of that data has been acknowledged beforesending any new data. It may however resend data that has not yetbeen acknowledged. In fact this is the mechanism by which TCP decidesto retransmit. If you haven't seen ACKs of any new data for a setamount of time, you should probably resend.III. tcp_stream preprocessorSo, there are two ways we could handle data buffering on the plugin.We could either make the data available as soon as we see it, althoughthis does not insure that the data was correctly received by thedestination. Or, we could buffer all data we see but only make itavailable to users when we see an ACK of that data. I chose the latercourse, which _should_ mean that the only data that can get out of mybuffers is that which is seen by the destination host. So, new datafrom A -> B is only made available by an ACK packet from B -> A. Thiscan cause a few headaches as will be explained later.Now that we are getting ordered data into our buffers, the plugin willread data out of the buffer and generate a new _correct_ packet basedon one of two conditions: a) The last data ACKed contains a return character (0x0d or 0x0a). Since the plugin searches from the end to the begining of the queue, the first return character seen (the last ACKed) will generate a packet of all the data in the buffer up to that point. b) The plugin has 'maxbytes' ACKed in its buffer. In this case, the packet will contain the first maxbytes of data in the buffer.IV. Usage preprocessor stream: <arg set 1>, <arg set 2>, ...Arguments: one or more of the following separated by commastimeout <timeout value>ports <port 1> ... <port N>maxbytes <maxbytes><timeout> - the max time in seconds for which a stream will be kept alive if we haven't seen a packet for it<port x> - a server port to monitor. we don't want to monitor all tcp streams (do we?)<maxbytes> - maximum bytes in our reconstructed packetsexample: preprocessor stream: timeout 5, ports 21 23 80 8080, maxbytes 16384V. Author info, etc.The tcp_stream preprocessor was written by Christopher E. Cramer<cec@ee.duke.edu>. Please direct any comments, suggestions, bugreports or fixes to him. I would like to thank Marty, and everyoneelse who has been working on Snort for producing such a fine program.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -