csecurityippacket-snifferspacket-injection

Inject a packet to terminate a TCP connection


I have to write a program that sniffs network packets (part1-the simple part).
And I have to update the program (part2) so that it will be able to terminate connections.
The specific requirements are:

Construct raw packets by specifying data link layer and network layer information including appropriate source and destination MAC and IP addresses. These packets are intended to terminate the connection. To do so, you should used SOCK_RAW as the socket type to be able to set the header information by yourself.

Can anybody give me some ideas on the second part?
Should I hijack the session, apply a DoS attack on one of the users?

All I need is some tips of how to terminate the connection. I am using the C programming language, and this is a course assignment for the security course.


Solution

  • Depends on what you mean by terminate connections. You might mean providing an end-point for a TCP circuit or UDP stream.

    Or you could mean sending an acceptable RST in the middle of a TCP stream to indicate the end of the stream. To achieve this you have to know the sequence number expected by the other side amongst other things.

    Either way it is obvious you haven't been paying attention in class. The entire point of the assignment, it seems, is to show you understand the raw layout of IP packets and possibly TCP/UDP. I suggest you purchase a textbook on the subject (no doubt recommended by your lecturer) and/or take a read of Wikipedia.