Archive for May, 2010

30
May

Secret No More

I have released my Secret Sauce recipe.

I really got tired sitting on it for so long and the manufacturer didn’t seem interested in talking to me, but I’ve been using it 24×7 ever since I found the damned thing last October.  For a long time I considered keeping it as a private hack, because it works so well and it’s so easy to hack into other tools.

The last time I did this, they patched it within thirty days.  This time around they treated me like a potted plant, and there may have been a good reason for that.  I’m not entirely certain it’s 100% their problem.  It could be a Microsoft issue.  If so, they’re screwed to a flat board until Microsoft decides to do something about it or a viable work-around is found.

Anyway, the days are numbered for this one.  It’s not going to work forever.  But I’ll keep hacking away at it.

The third time’s the charm.

29
May

Secret Sauce FAIL/

That didn’t take long.

What I found was the basic difference between PoTTY & stunnel was that when PoTTY opened a obfuscated-openssh link, the link stayed open.  As long as the link was open, the SWG did not log it.  As soon as the link was closed, it did get logged.

Which still bugs the fuck out of me because connections from PuTTY, PoTTY’s daddy, are logged as soon as they’re made.

A real head-scratcher, but I haven’t looked at PuTTY’s connection at the wire level yet.

Still, the delayed-logging is something of a feature.  You can leave the link open for days and it will not show up in the logs until you drop it.

There is one positive outcome to this: the Secret Sauce can now be revealed.

The time has come!

29
May

Reading The Docs… Again…

With a red face.

It turns out the author did roll the proxy support into stunnel.  It was a new feature as of version 4.15 way back in November 2005.

Mea culpa once again.

On the SWG front it appears that even our nameless manufacturer’s tech support people can’t get SSL inspection to run out of the box.  It’s been somewhat frustrating dealing with them but I won’t get into that.

Meanwhile I’m testing this thing without SSL inspection.  The secret sauce I cooked into my own private (HACKED) version of PoTTY works fine.  It slips through this thing like a hot, invisible knife through warm, rancid butter.  But so far, the secret sauce works only with PoTTY and I’m beating my brains out trying to determine why.

I cooked it into stunnel and all it does is FAIL.  I pulled up Wireshark and looked into the differences in how they connect, found them, and then hacked stunnel around to connect exactly like PoTTY connects.

Still: FAIL

The difference, if you’re interested, is that PoTTY sends its headers all at once to the proxy right after the three-way handshake, whereas stunnel sends them one-by-one.  That wasn’t too terribly difficult to hack around, although in the process I broke proxy authentication.  That’s not an issue in this environment.  In fact, it’s never been an issue, which makes me think the secret sauce may not work in an environment that requires authentication… but that’s a side issue right now.

There are a few avenues left, one of which, if it works, will simply prove this device is brain-dead in its silly assumptions about what SSL is.

Stay tuned.

24
May

Tunneling a tunnel

I haven’t had a lot to say the past month because I’ve been a very busy boy.  As they say, I have a lot on my plate.

Unfortunately it is a plate full of shit.  A variety of turds, but all shit nonetheless.

One of those turds is an evaluation of a “Secure Web Gateway” (SWG) from a manufacturer who will remain nameless.

One of the functions of this SWG is Data Loss Prevention (DLP).  This box wants to know everything about anything that’s coming and going through the corporate firewall.  Web pages, email, ftp sessions, you name it.

It accomplishes this by being very snoopy, to the point of sniffing SSL traffic as it passes in and out of the box.

And you thought SSL was secure, didn’t you?

Not when it goes through an Evil Proxy!

Especially not a proxy that spins faux SSL certificates on the fly, which is exactly what this thing does.

Nothing is safe.  Credit cards numbers?  BAH!  It eats them for breakfast.  Those torrid emails you send to your significant other from your Yahoo account?  BLAM!  Laid bare for all to see.  Nothing evades its steely, unimpassioned gaze.

You are 169% PWN3D if you’re unlucky enough to be stuck behind one of these suckers.

Do you scoff?  Think you can get away with SSH tunnels?  Think again.  SSH is not SSL. Never has been, never will be.  SSL wants certificates.  SSH wants session keys.  Your SSH tunnel will simply choke trying to get through.  I know.  I’ve tried.

So what is a L337 H@><0R to do?

Well, there is a half-solution out there.  It’s called stunnel and it allows you to SSL-ify programs that don’t normally do SSL.  It’s been around for ages.  Since the turn of the century!  Very mature. Very robust.

But there’s bad news.

THERE’S NO FUCKING PROXY SUPPORT!!!!!  TEN FUCKING YEARS THIS GODDAMN THING HAS BEEN AROUND AND THERE’S NO FUCKING PROXY SUPPORT!!!!

Testing this SGW last week, I ran across the same exact problem with OpenSSL’s s_client tool.  S_client allows you to peek into the SSL handshake between a server and a client to see what’s going on.  BUT IT DOESN’T FUCKING SUPPORT PROXIES EITHER!

Jesus FUCKING Christ what is it with these people???  Proxies have been around a damn site longer than SSL.  Where is the love?

I was lucky enough to run across a patch to an EIGHT YEAR OLD version of OpenSSL that adds proxy support.  It was never accepted by the OpenSSL geeks.  WHY IS THAT?  WHAT IS THE PROBLEM? In spite of its advanced age, it worked perfectly during my testing.

And, luckily enough, I found a patch for a five year old version of stunnel.  I haven’t tested it yet, but at least it compiles (although Cygwin barfs all over it at link time).

So what is the point?

Like I said, SSH is not SSL.  The SWG expects a browser-like connection on the inside and a Web server-like connection on the outside.  SSH through a (normal) proxy is a simple HTTP “CONNECT”, a straight-through pipe with no muss or fuss.  You need to make the SWG think you have a browser/server handshake going on before it will make the pipe.  Once the pipe is there it will decrypt everything going through it in order to look for naughty bits.

At the point the pipe starts flowing, you just shove your own encrypted tunnel through it.  It can hack away at that traffic all it wants, it’s not going to find any naughty bits.  And if your encrypted tunnel terminates at an obfuscated-openssh server, you are doubly protected since it will never see the initial SSH key exchange (it may not even be looking for it but… You Never Know).

But… and this is a BIG BUT… if the SWG is built right – and I’m 99% certain it’s not, given the dismal track record of this particular vendor - it should be able to tell that the data going through it is encrypted and kill the session (which seems – to me – like the Right Thing To Do if you’re truly concerned about Data Loss Prevention).  Worst case it will either eat up CPU cycles or outright crash and burn. Best case, it will pass the traffic without making a peep or logging anything at all.

Whatever the outcome, it will be reported here!

04
May

Attention Proxy Site Spammers

You can get free advertising just about anywhere, so take it there.

If you have something to say that’s another thing completely, but you keep posting the same old tired bullshit every time.

Give it a rest.