Squall Leohart
Squall Leohart

Reputation: 677

Twisted python: UDP Multicast Interface and Group

I have 2 questions regarding the security of twisted's UDP Multicast.

class UDPProtocol(twisted.internet.protocol.DatagramProtocol):
        def startProtocol(self):
                self.transport.joinGroup('224.0.0.1')
        def datagramReceived(self, data, (host, port)):
            if host == '192.126.1.65':
                print "UDPWebscriptProtocol: received %r from %s:%d" % (data, host, port)   

And this is how I listen:

reactor.listenMulticast(10222, UDPProtocol(), listenMultiple = True, interface = '224.0.0.1')

Notice the specification of interface in listenMulticast.

  1. What is the difference between specifying the interface in listenMulticast vs. joining a group in the Protocol?
  2. In the protocol, I check to see if the host interface has the right IP (in this case, a private interface that has an rfc 1918 address). Can someone possibly spoof this ip and broadcast to my group? Or it's only possible to spoof IP and not interface?

In general, how secure is this code?

Upvotes: 2

Views: 579

Answers (1)

user207421
user207421

Reputation: 310866

  1. The listen interface is the one you listen at. Joining the group tells the kernel and all routers that you want to receive this group, so e.g. your router will pass messages from that group instead of dropping them as it would by default.

  2. I don't understand. Do you mean you check the source IP address of incoming datagrams? I don't see how you can check somebody else's host interface. If the allowed source addresses are private the only possible spoofing comes from inside that private subnet.

Upvotes: 1

Related Questions