Slashdot Log In
How Skype Punches Holes in Firewalls
Posted by
CmdrTaco
on Fri Dec 15, 2006 02:49 PM
from the i-thought-it-used-a-hammer dept.
from the i-thought-it-used-a-hammer dept.
An anonymous reader writes "Ever wondered, how P2P software like Skype directly exchanges data — despite the fact, that both machines are sitting behind a firewall that only permits outgoing traffic? Read about the hole punching techniques, that make a firewall admin's nightmares come true."
This discussion has been archived.
No new comments can be posted.
How Skype Punches Holes in Firewalls
|
Log In/Create an Account
| Top
| 215 comments
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Great article (Score:5, Interesting)
Re:Great article (Score:5, Informative)
(http://storyinmemo.com/)
TCP over UDP (Score:4, Informative)
(http://www.dnull.com/~sokol | Last Journal: Saturday December 04 2004, @12:44PM)
You can then route TCP over it (grab packets from
Re:Great article (Score:5, Interesting)
Re:Great article (Score:5, Interesting)
Re:Great article (Score:5, Insightful)
(http://www.xenoveritas.org/ | Last Journal: Monday September 24, @04:04PM)
The core BitTorrent protocol uses TCP, so the UDP technique the article describes won't work. (As far as I know, there's no corresponding technique for doing something similar with TCP.)
There's been a bit of work on various UDP protocol replacements for BitTorrent, but nothing that's really gained any cohesion that I'm aware of. So, when it comes to BitTorrent, no, there really isn't much work on making such a technique work.
There might be other P2P platforms that do attempt to do something like the technique described in the article, but the official BitTorrent protocol uses TCP and therefore can't use the technique.
Old news and incomplete as well (Score:5, Insightful)
AFAIK Skype uses a fallback system when the technique described doesn't work (where UDP traffic is blocked). In those cases it uses a well connected peer (yes, that could be your Skype client) to relay the voice data to the other party. Your PC becomes a Supernode without your knowledge and consent. Well, not really, coz this is in the Skype EULA:
4.1 Permission to utilise your computer. In order to receive the benefits provided by the Skype Software, you hereby grant permission for the Skype Software to utilise the processor and bandwidth of your computer for the limited purpose of facilitating the communication between Skype Software users.
http://computerworld.co.nz/news.nsf/news/7AB67323
What was it again? All your base belong to us?
X.
Re: Punching Holes in BT (Score:5, Informative)
(http://burlingtonnights.com/)
If you're setting up port forwarding in your router, the application isn't "punching holes" you're just opening up your firewall at the router...
Nothing new here (Score:5, Insightful)
(http://a2tech.us/)
Re:Nothing new here (Score:5, Informative)
Re:Nothing new here (Score:4, Informative)
(http://slashdot.org/ | Last Journal: Monday November 03 2003, @03:59PM)
So it's not new, but it's still pretty clever.
DS (Score:3, Funny)
Re:DS (Score:5, Funny)
(Last Journal: Saturday October 14 2006, @08:12AM)
And if you could disguise it to look like a cash register, your customers would have no idea you weren't ringing up their Happy Meal.
Re:DS (Score:5, Informative)
(http://wiitimer.com/)
See here [kotaku.com]
Oh come on. (Score:2, Informative)
(Last Journal: Tuesday December 19 2006, @05:12PM)
If you're using a NAT with IPTables, it's trivial to tell it to drop packets on any port regardless of whether they're established or UDP or whatever. The article represents this like it's some kind of l33t hacker tool to break down a firewall from the outside, rather than the same problem you'd have if you downloaded a trojan, or some internet-connecting spyware.
Very misleading.
you have no clue (Score:4, Insightful)
And how are you going to receive replies if you tell it to drop the response packets?
The trick that this article points out is that UDP is connectionless, so even a stateful firewall will not know whether a packet is a valid reply or not. The only way to prevent this is to block UDP entirely.
Re:you have no clue (Score:4, Informative)
(Last Journal: Tuesday December 19 2006, @05:12PM)
The state table entry for a UDP packet, however, contains the source IP:port and the destination IP:port, and uses that information to "track" the exchange. So unless you just allow all UDP through the firewall, the state table keeps track of how often the destination ip responds, and if it doesn't respond within the timeout set in ip_conntrack_proto_udp.c at compile time, the system will terminate that connection, and require a "new" connection to be set up between those addresses. It also won't allow the destination port to be changed without a second "NEW" packet originating from the new destination port.
I agree it's not an "attack" as such. My original point was that it wasn't an exploit at all, in the sense that you are not able to break any existing rule using this method. If you allow UDP out, and UDP:Established in, then how can you complain that you end up accepting a bunch of UDP packets?
UDP *is* Connectionless; Apps might not be (Score:5, Informative)
(Last Journal: Wednesday March 02 2005, @11:08PM)
The Applications may or may not create Layer 7 connections or maintain state. Most UDP applications do one of three things
Some applications that look like this are really hybrids - they've gone to a lot of work to make sure they work fine in a stateless UDP environment, where packets might get lost or duplicated, and remote partners might go on and off line, such as remote file-system apps where the Layer 7 acknowledgement that Block 12345 has been written to disk is what the application needed to know anyway. Being stateless lets the app not have to keep track of which remote sites are currently reachable, and lets a server scale to handle lots of sporadic accesses. And sometimes the client app maintains state even if the server doesn't - the client knows it has 242344 more bytes to send to the server, but the server responds to each packet idempotently when it comes in and doesn't worry about the past or future.
Firewalls used to be manually configured for some protocols - you'd allow a UDP connection from 1.1.1.1:1414 to 2.2.2.2:2828 - and also support protocols statelessly - you'd allow ping responses, or TCP SYN/ACKs, but didn't explicitly track which responses were really from which connections. This was usually good enough for TCP, but fairly crude for UDP, since the Layer 4 protocol doesn't tell you state. Stateful inspection techniques let the firewall keep track of each exchange between two sites - you'll accept ping responses from 2.2.2.2 to 1.1.1.1 because you know 1.1.1.1 just sent a ping to 2.2.2.2, and you'll accept TCP packets from 2.2.2.2:443 to 1.1.1.1:12345 because you know 1.1.1.1:12345 did a TCP SYN to that 2.2.2.2:443 and haven't seen a TCP FIN or timed out the connection. They're simulating state, even for protocols that don't have connections or state at Layer 4, because applications usually have one or a series of packet exchanges even if they don't have state at Layer 7 (or only have state at one end.)
Re:you have no clue (Score:5, Informative)
(http://erikmartin.com/)
UDP is connectionless. NAT routers invent imaginary connections based upon the outgoing packets they see, and then close the imaginary connections after inactivity. It's not part of the protocol. It's a model that the router uses to block all packets except the ones that were presumably requested.
Confusing title (Score:5, Insightful)
Why is this so bad? (Score:2)
(http://www.saynotocrack.com/ | Last Journal: Friday February 09 2007, @03:02AM)
Slashdot, always bringing you the hottest news (Score:2)
(http://wod.home.dyndns.org/)
Ever wondered (Score:5, Funny)
(Last Journal: Tuesday August 07, @01:18PM)
Re:Ever wondered (Score:5, Funny)
(http://slashdot.org/)
udp huh? (Score:2)
(Last Journal: Wednesday May 16, @12:43PM)
Punching holes? (Score:1)
punching holes... (Score:2)
(http://blog.peoplesdns.com/)
I sort of miss the dialpad.com days.
Skype is a Big Tymer (Score:1)
A Good Paper (Score:5, Informative)
Steps, too many. (Score:1)
The answer... (Score:5, Informative)
(http://www.howtobeinvisible.com/ | Last Journal: Thursday October 04, @07:42AM)
Want to REALLY torque off the Skype guys? Let it thru, just add random packet delays to each UDP packet that goes out and comes in. A few ms each should do it. Their call quality will go to hell. Things like mail, web surfing, and other non-realtime protocols won't even notice the difference.
Charles
Re:The answer... (Score:5, Informative)
(http://zone-mr.net/)
I'm pretty sure a few ms would be absorbed by the jitter buffer. Heck, 20ms jitter is often a normal occurance on long-distance WAN links.
Doh - STUN (Score:2, Insightful)
http://en.wikipedia.org/wiki/STUN [wikipedia.org]
Alternatives Anyone? (Score:2)
STUN? (Score:2, Interesting)
(http://www.theblackforge.net/)
I've also heard that what Skype does is somehow better than STUN, though it's hard to see how. Can anybody confirm/deny/explain that?
Re:STUN? (Score:4, Informative)
(http://www.tjansen.de)
* STUN also supports "symetric" firewalls/NATs, I think that's not mentioned in the article. But no one uses them at home anyway, and I doubt that they are widespread elsewhere.
* SIP can use STUN (it's not required, but pretty common now).
* What the article does not mention: Skype can also mis-use HTTP proxys with HTTPS support to get through the firewall. That's the configuration that most companies have, and I hoped to get a bit more information about that in the article. But basically it will work similar to the common HTTPS tunnels (google for them if you don't know them), just Skype-specific instead of allowing arbitrary TCP connections.
Not exactly new (Score:4, Interesting)
Oh man, this shit is a pain in the ass. I had to look into the over the summer. This is the same technique that Apple's iChat uses for audio and video calls. Many many p2p applications use this technique to get through firewalls and NAT routers. The problem is that it doesn't always work when both computers are behind their own NAT router.
Let's say Bob (as in the example in the article) is behind a NAT, his local ip he got from his router via DHCP is 192.168.1.2, and the public IP of his router is 2.2.2.2. He wants to use UDP port 2828 on his computer to transmit his voice data to Alice. So he sends out the first packed to 1.1.1.1:1414, as in the example. Now because of his NAT it looks like the data is coming from 2.2.2.2 and some arbitrary port (the router can't always use the same source port as the NATed computer because some other computer on the local network might already be using that port to connect to the outside world) lets say his router uses 3939.
Now Bobs router says, "Okay, I'll let through any UDP packets sent from 1.1.1.1:1414 to 2.2.2.2:3939 and I'll pass them on to 192.168.1.2:2828". As in the example, Alice's router will just drop this packet because there is no pre-existing connection from Alice's computer using this info. Then when Alice tries to send a packet to 2.2.2.2:2828 Bob's router drops it because his router isn't expecting traffic to this port. His router is expecting packets to go to port 3939. And Bob has no way of telling Alice which port she should actually be sending packets to since he doesn't even know which port his router decided to use on the public side to send out his packets.
You can get around this if only one computer is behind a NAT, or if you open up a persistent connection through your router to your computer. Anyway, I believe UPnP is supposed to help with this somehow, but I got so sick of it that I switched jobs.
Re:Not exactly new (Score:5, Informative)
Let's say Bob (as in the example in the article) is behind a NAT, his local ip he got from his router via DHCP is 192.168.1.2, and the public IP of his router is 2.2.2.2. He wants to use UDP port 2828 on his computer to transmit his voice data to Alice. So he sends out the first packed to 1.1.1.1:1414, as in the example. Now because of his NAT it looks like the data is coming from 2.2.2.2 and some arbitrary port (the router can't always use the same source port as the NATed computer because some other computer on the local network might already be using that port to connect to the outside world) lets say his router uses 3939.
Now Bobs router says, "Okay, I'll let through any UDP packets sent from 1.1.1.1:1414 to 2.2.2.2:3939 and I'll pass them on to 192.168.1.2:2828". As in the example, Alice's router will just drop this packet because there is no pre-existing connection from Alice's computer using this info. Then when Alice tries to send a packet to 2.2.2.2:2828 Bob's router drops it because his router isn't expecting traffic to this port. His router is expecting packets to go to port 3939. And Bob has no way of telling Alice which port she should actually be sending packets to since he doesn't even know which port his router decided to use on the public side to send out his packets.
Alice's computer should not be sending to 2828. It should be sending to the source port seen in the packets sent to the centralized server used for the rendezvous operation. Bob doesn't tell Alice anything. Bob sends a message to the central computer, which in turn, tells Alice something. The central computer DOES know what port Bob's router used because it can look at the source port on the UDP packet.
When a breakdown occurs (rare, but possible), it is not because of the difference between 2828 and 3939. It occurs because the router picked a -different- source port to use when sending packets to Alice than it did when sending packets to the central server. If the router does not consistently map port 2828 to 3939, but instead adds a secondary mapping from 2828 to 5050 when communicating with Alice's machine, the connection may fail. However, in order for a complete failure to occur (as opposed to simply requiring two or more packets to be sent and a little extra negotiation), one of the following must be true:
A. Both routers must be broken in this way. If this is the case, neither side can get a packet through to the other side.
B. One router must be broken in this way and the other router must alter the source port (reverse port masquerading) of inbound traffic.
If neither of these is true and Alice's machine is the one with the broken router, her router will use a different source port when communicating with Bob's machine that corresponds with the different destination port to which Bob's response must be sent. As long as Bob's router does not munge this, Bob's computer now knows how to send a message back to Alice, and a bidirectional communications channel should exist at that point.
I'm not saying that any of these services/protocols handle that extra bit of negotiation, of course, just that the problem isn't unsolvable unless both routers have a critical defect in their behavior.
Slow news day? (Score:1)
Easy to defend against on an Enterprise network (Score:1)
Otherwise known as STUN (Score:2, Informative)
How Skype & Co. get round firewalls (Score:2, Funny)
How long does NAt allow a reply to UDP packet? (Score:2)
Not hole punching. (Score:2, Informative)
It is a way to get two computers that are already allowed to talk to whoever they want on the internet to talk to each other despite both having firewalls that don't allow incoming connections. It does not cause violation of firewall policy or break firewall rules in any way, it just gets over an unfortunate incompatability in this world of NAT.
The issue only arises because both parties are firewalled.
The short version: Using a 3rd server that both parties can connect to cleanly, the behavior of UDP is analyzed to see if source ports are static or predictable. If they are, it's trivial to have both hosts send packets to each other causing both firewalls to permit reply traffic, at which point direct communication between hosts over udp is possible.
This is easily overcome by randomizing source UDP ports at the nat layer.
You can do this with TCP too... (Score:5, Interesting)
Perl code (Score:3, Interesting)
http://samy.pl/chownat/ [samy.pl]
Misleading explanation of a easily solved non-prob (Score:2)
Should take about five lines of code to fix, in any firewall that really want to.
am I missing something here? (Score:2)
NAT Traversal, not firewalls (Score:2)
(http://www.drones.com/)
As others point out, the technique has been used for many years.
It's not even a real solution. The article says:
Really, always? Why do you know this? Because you tested it with your one client and the particular version of the one OS you use?
That's the problem with this technique: it might work for some or even most NAT implementations but it cannot always work. Because NAT means that the source address and port of all outgoing packets is re-written. The NAT box is not required to follow any pattern in how it assigns the source port numbers for NAT'ed packets; in fact a good NAT box should not allow the ports it uses to be guessed. Of course the OpenBSD packet filter chooses outbound port numbers in a random (cryptographically strong if you have the appropriate hardware) manner, and this technique will not work if one of the packet filters is OpenBSD. (I don't know much about the other packet filters.)
Sure, for a freebie like Skype, who cares if if the thing only works "most" of the time? But this is not a solution, it's just relying on undocumented behaviour of some NAT implementations.
Not at all new (Score:2)
I already published this technique in 6/3/2002 (Score:2)
(http://www.dnull.com/~sokol | Last Journal: Saturday December 04 2004, @12:44PM)
We had it in our one of our livecam video streaming product in 1997
Why let UDP out anyway? (Score:1)
Is there a risk? (Score:2)
(http://www.houghi.org/)
Isn't Skype a proof of concept?
How come so few sip/voip apps get this right? (Score:2)
I've submitted bug reports to ekiga (nothing done there so far) and tried to get devs interested with asterisk but no go. So what's linphone doing right that every other voip client on linux doing wrong? I'd really like to know to point it out to the other devs.
Chicken or Egg? (Score:1)
(http://www.cybernexus.net/)
If the latter, the only useful thing to come from botnets is this slick trick. Of course, as useful as teaching the telemarketers to use wardialers.
-Rick
This only applies to well behaved firewalls (Score:1)
Seems perfectly reasonable (Score:2)
NAT behavior is not consistent (Score:3, Informative)
(http://www.cs.berkeley.edu/~lazzaro/)
Is this correct? (Score:1)
(http://rohva.blogspot.com/)
Microsoft's Teredo. (Score:1)
News? (Score:4, Informative)
(http://www.adkap.com/ | Last Journal: Thursday August 10 2006, @04:10PM)
This sentence, which occurs in the last paragraph of TFA, should be further noted. The technique described here has been around for as long as NAT routers have been around (a very long time). Its fairly common knowledge/practice in network security circles. In fact, this was taught in my network security course last year. I think it was on the final as well... except we had to defeat a NAT router using TCP packets which is a slightly more tricky task.
On a tangent:
NAT routers are not really proper firewalls, though they have the side effect of keeping most attackers out. This is beacuse NAT was designed and implemented primarily for allowing multiple computers to utilize a single global address. They technically break the OSI stack by reaching past the link layer... and provide a bit less security than using vanilla iptables without modules. A more interesting exercise would be to describe the steps to defeat a firewall with stateful packet inspection.
Similar technologies (Score:2)
Security Now (Score:2)
(http://studyinjapan.blogspot.com/)
Wonderful (Score:2)
(http://rankandfile.homelinux.net/ | Last Journal: Friday January 23 2004, @02:58PM)
security or straight jacket? (Score:2)
(http://www.jillesvangurp.com/)
From a security point of view it is not so bad, however. The approach requires software inside the firewall to initiate a connection. Firewalls can be configured to prevent this if needed but in many cases the firewall is just there to prevent uninvited guests rather than to limit end user freedom (and initiating a request from the inside implies invited guest). The only difference is that now you can initiate connections to a computer that is also firewalled.
what security? (Score:1)
1. For this type of "incoming" connection to be created, the target machine has to first bounce a packet off its own NAT. So this isn't much different from creating a new outgoing connection since it can't be entirely remote initiated.
2. Since you are already allowing outgoing connections to untrusted hosts you are at already risk, as any connection can be exploited once it is open.
So in the scenario described there wasn't much security in the first place. To consider yourself realsonably firewalled you need to block both incoming and outgoing connections and keep a close eye on any "allowed" services. (ie, use a web proxy)
Port Scanning (Score:1, Interesting)
So according to this article, Skype reverts to port scanning my computer in some cases depending on how my firewall behaves.
At least under some legislations, port scanning alone is enough to be considered an illegal attack on my information systems. Why does this not apply to Skype?
Woop Dee Dee (Score:1)
ports 80 & 443 (Score:2)
(http://www.uberconcept.com/)
I was seriously pissed off when I discovered this, not just because I'd spent an hour or so tracking down why the IIS demo laptop had stopped working (so shoot me for working with windows).