LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-06-2008, 05:07 AM   #1
eddchr
LQ Newbie
 
Registered: Oct 2008
Posts: 9

Rep: Reputation: 0
Question Hijacking/stealing packets


According to a document at linuxjournal (see below) it should be possible to receive packets at a very low level.

Quote:
"In recent versions of the Linux kernel (post-2.0 releases) a new protocol family has been introduced, named PF_PACKET. This family allows an application to send and receive packets dealing directly with the network card driver, thus avoiding the usual protocol stack-handling (e.g., IP/TCP or IP/UDP processing). That is, any packet sent through the socket will be directly passed to the Ethernet interface, and any packet received through the interface will be directly passed to the application." http://www.linuxjournal.com/article/4659
Our question is now if it could be possible to hijack the packets that matches our filter. The packets should NOT be processed further by the stack in Linux.

Possible?
 
Old 10-06-2008, 08:23 AM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,285
Blog Entries: 1

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by eddchr View Post
Our question is now, is it possible to hijack the packets that matches our filter. The packets should NOT be processed further by the stack in Linux.
Yes, it is possible.
 
Old 10-06-2008, 02:04 PM   #3
eddchr
LQ Newbie
 
Registered: Oct 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by David1357 View Post
Yes, it is possible.
Great! Any hint/idea on how to do this, without modifying the kernel?
 
Old 10-06-2008, 02:44 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,285
Blog Entries: 1

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by eddchr View Post
Great! Any hint/idea on how to do this, without modifying the kernel?
You really need to get a copy of "Understanding Linux Network Internals". It will explain what you need to do.

Your other option is to look at the code for tcpdump or wireshark, and the corresponding code in the Linux network stack.
 
Old 10-06-2008, 03:13 PM   #5
eddchr
LQ Newbie
 
Registered: Oct 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by David1357 View Post
You really need to get a copy of "Understanding Linux Network Internals". It will explain what you need to do.

Your other option is to look at the code for tcpdump or wireshark, and the corresponding code in the Linux network stack.
Ok, does that mean that tcpdump/wireshark has such functionality ?

Either way, we'll look in to that tomorrow. Thank you for the sources!
 
Old 10-08-2008, 01:32 AM   #6
Hok
LQ Newbie
 
Registered: Oct 2008
Posts: 7

Rep: Reputation: 0
Quote:
Our question is now if it could be possible to hijack the packets that matches our filter. The packets should NOT be processed further by the stack in Linux.
I think the key issue there is the last bit, not being processed further by the stack. You can use PF_PACKET to read inbound packets as they fly by, and inject packets for output, (see the pcap(3) man page), but as far as I know there is no mechanism within that protocol to halt further processing of inbound packets. You're getting a copy of the data, rather than the one and only instance.

If you want complete control, I think what you'll need to look at instead is the iptables NFQUEUE target. This causes matching packets to be sent to a userspace daemon, which can then do whatever it wants and send back a DROP. Alternatively, I think if you have no daemon registered, the packet will just vanish into the void, but you should test that.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
be aware of ip stealing bujecas Linux - Networking 4 07-11-2007 12:48 PM
hijacking with Hunt jgomes Linux - Security 1 06-03-2005 05:46 PM
Hijacking jgomes Linux - Software 1 06-01-2005 12:24 PM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
Browser Hijacking frkstein Linux - General 1 04-18-2003 06:58 PM


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

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration