1

How can I spoof my public IPv4 address to another without using proxys? I don't need any response, the TCP handshake needn't be completed! I just want to send a SYN packet with spoofed (specific) source address! My problem is, that every packet I craft can just have a spoofed private IP and my router would simply drop the packet (or at least the ISP would) and I don't know how it could reach a webserver outside of my network at home. Are there any possiblities to make the ISP to forward it? If I forgot important information, let me know.

thx

1

1 Answer 1

4

If you're a Python programmer you can use the Scapy interactive packet manipulation program to create your own packets and send them. You can also use it as a library within your own Python program.

From within the interactive program here's how you can create an IP packet, change the source address, and send it. Scapy will use any default routes you have setup.

>>> pkt = IP(src="1.2.3.4", dst="5.6.7.8")
>>> pkt.show()
###[ IP ]###
  version= 4
  ihl= None
  tos= 0x0
  len= None
  id= 1
  flags= 
  frag= 0
  ttl= 64
  proto= ip
  chksum= None
  src= 1.2.3.4
  dst= 5.6.7.8
  \options\
>>> pkt.send()

The fun thing about Scapy is that it creates the all lower layer headers for you if you don't specify them with default values. So in the above example the Ethernet header is created for you already. So you probably want to manipulate the TCP layer, so the following code will build upon the above example.

>>> ip_layer = IP(src="1.2.3.4", dst="5.6.7.8")
>>> tcp_layer = TCP()
>>> pkt = ip_layer/tcp_layer
>>> pkt.show()
###[ IP ]###
  version= 4
  ihl= None
  tos= 0x0
  len= None
  id= 1
  flags= 
  frag= 0
  ttl= 64
  proto= tcp
  chksum= None
  src= 1.2.3.4
  dst= 5.6.7.8
  \options\
###[ TCP ]###
     sport= ftp_data
     dport= http
     seq= 0
     ack= 0
     dataofs= None
     reserved= 0
     flags= S
     window= 8192
     chksum= None
     urgptr= 0
     options= {}

As long as your routes are set up correctly to get to your destination you should be able to send the packet. Scapy will also be able to capture response and what not too if you needed. The documentation gives good simple examples, but does kind of lack in more advanced examples. The API isn't well documented but there is a doxygen version up here.

2
  • thank you! I will try this and leave a comment if it helped me :)
    – h4x0r
    Jul 30, 2014 at 13:16
  • I updated my answer to include stacking layers.
    – RoraΖ
    Jul 30, 2014 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .