Detecting SSH tunnels

Hey drop us a line about the show. Feel free to ask questions, provide feedback and criticism, or just ramble on about anything your little heart desires.

Moderators: snarkout, Patrick, dann

Post Reply
User avatar
jturning
Posts: 221
Joined: Wed Sep 13, 2006 1:11 pm
Location: Rancho Cordova

Detecting SSH tunnels

Post by jturning » Mon Jun 30, 2008 11:47 am

Research is progressing on "Detection of Encrypted Tunnels across Network Boundaries". This affects those of us using SSH tunnels at work to bypass employer tracking among other applications. I also recently read an article where they conducted a poll of workers, and many were employing different methods of tunneling out from their corporate computers for IM and safe browsing, though SSH wasn't mentioned specifically as one of the methods. I would imagine corporations would love to have this type of technology to plug the holes in their firewalls/proxies beyond just the ISP network throttling application.

http://coderrr.wordpress.com/2008/06/28 ... h-tunnels/
Italian researchers have published a paper on the Detection of Encrypted Tunnels across Network Boundaries. I came across it in a google search because I’ve been thinking of writing a program which does something similar. It doesn’t seem like anyone else has picked up on this research yet so I thought I should mention it. Here is a link to the actual paper: pdf or scribd.

They claim their technique can differentiate between “normal” ssh or scp sessions and ssh sessions which are being used to tunnel traffic (through ssh’s port forwarding mechanism). This is accomplished through a naive Bayes classifier, which they first trained with “normal” ssh sessions. The two variables used to classify a session are the size of the packets and the difference in arrival time of two consecutive packets. With just these, they can classify with 99% accuracy whether an ssh session is a tunnel. They were also able to classify the actual protocol (P2P, POP, SMTP, HTTP) of the tunneled connection with close to 90% accuracy.

Although their research is quite interesting there are a few things which limit its practicality. They can only detect tunnels going through ssh servers which they control. This is because their detection mechanism can only handle a single authentication type whereas an ssh server can (and usually does) allow multiple (e.g. public-key or password). This requires admins of the server to limit the allowed authentication options to a single consistent choice. They also require the ssh server _and_ client to disable compression. Their technique will also falsely classify a second login attempt (after a failed login) as a tunnel and drop the connection. In their words: “However, this should not be a major problem: simply, if the user is entitled to connect, they will try again.”

So it seems the use of a tool like this would be limited to an extremely controlled environment where users are limited to a white-list set of network protocols (so that they can’t use a different tunneling mechanism, stunnel for example) and only allowed to ssh to servers under the control of the censoring party. In which case you would wonder why the admin wouldn’t just set the ssh servers’ AllowTcpForwarding option to false.

It sounds like this is just preliminary work so maybe their future research will solve all these problems. If perfected this technology could be used by ISPs to block or throttle even encrypted P2P traffic.

I’d also like to note that it would probably be easy to create a tunneling mechanism which thwarts their detection attempts. Knowing that they use packet size and inter packet intervals you could easily manipulate these to match whatever protocol type you wanted.

While looking around one of the researchers web pages (Franceso Gringoli) I found a pretty cool Linux/OSX utility called sshgate. It allows you to transparently tunnel all your connections over ssh. This is great for programs which do not give you the option to use a socks server and which do not play nice with socksification. I haven’t tested it out so I’m not sure if it actually works.
Image

User avatar
snarkout
Site Admin
Posts: 1342
Joined: Tue Aug 16, 2005 9:35 pm

Re: Detecting SSH tunnels

Post by snarkout » Tue Jul 01, 2008 9:07 am

Google NBAR or deep packet inspection. This isn't new at all, it's just pointing out that port-based firewalling is old hat these days.
Shared pain is lessened, shared joy is increased; thus do we refute entropy.
--Spider Robinson

User avatar
snarkout
Site Admin
Posts: 1342
Joined: Tue Aug 16, 2005 9:35 pm

Re: Detecting SSH tunnels

Post by snarkout » Tue Jul 01, 2008 9:11 am

Sorry - that was in reference to grepping for traffic types going out the wrong ports. Obviously moving SSH across 80 is an issue still.
Shared pain is lessened, shared joy is increased; thus do we refute entropy.
--Spider Robinson

weex
Posts: 44
Joined: Fri Feb 29, 2008 3:30 am

Re: Detecting SSH tunnels

Post by weex » Tue Jul 01, 2008 12:49 pm

Can't find it now but isn't there a switch in some versions of ssh that sends a constant amount of data to obscure traffic analysis efforts like this? Maybe it was in sshd because I didn't see it on the openssh client on hardy.

User avatar
jturning
Posts: 221
Joined: Wed Sep 13, 2006 1:11 pm
Location: Rancho Cordova

Re: Detecting SSH tunnels

Post by jturning » Wed Jul 02, 2008 12:11 am

This was just early research, and to determine traffic they needed to control the server side configuration. So for now it's just a taste of what's coming. But it's a piece of the puzzle for us keeping our freedom in the coming future. Between governments tracking us, ISPs and search corporations wanting to track us to make more advertising money, and all other forms of privacy invasion, we're going to have to fight for freedom beyond just the software we run in this rapidly evolving world.

Right now it looks like we might be losing based on how the FISA legislation granting telecom immunity worked itself through the House with the Senate vote coming after the break. This would keep the courts from getting to the bottom of the government spying program and determining legality. The Executive Branch and Republicans know it's not legal and that's why they're working so hard for this legislation to get through.

The battle for our freedom in this country is under way.

Bugz
Image

Post Reply