Archive for April, 2010

24
Apr

Shitty Week (4/18 – 4/24)

Four days of proxies on the front page!

We are living through hard times, boys and girls!  So hard that even the Dinkster himself had to rely on a PHP proxy to do his forum haunting (thank you Baron Munchausen!).

It’s been a rough week on other fronts as well.  I got caught up in McAfee’s mess back at the Salt Mine.  Not only am I the local Network Nazi, but I also manage McAfee’s crappy AV for the entire enterprise.  Luckily that day (Wednesday) I was telecommuting via RDP back-tunneling (over obfuscated-openssh on Cygwin) so I was not in the thick of things.

I was “in the cloud”, as it were.

I was also wise enough never to have installed Service Pack 3 on my Salt Mine PC, so I was one of the lucky ones.  For a variety of reasons, I never trusted it.  I was almost ready to apply it once IE 7.0 came out, but then I heard there was no roll-back to IE 6 on machines with SP3, so I passed.  I have it on all the XP machines here on DinkNet, but I use different AV.

And that was an odd thing.

I have Microsoft Security Essentials (MSE) on my main box and that morning it died.  Very mysteriously.  The little green system tray icon was just plain gone and when I went to restart it from Control Panel, Services the system told me it could not be found.

This was before the news came out that the whole thing was due to a turd dropped on the world by McAfee, so I was quietly sweating bullets.  Had some bug followed me home?  Or crawled through my other covert tunnel, OpenVPN?  I switched boxes while I re-installed MSE on that system.  Then I rebooted it and performed a full scan.  Nothing.

And “nothing” doesn’t mean shit these days, with fast-mutating bugz like Zeus floating around the Interwebs.  The virus definitions you get today are for crap that has been around for months.

While all this is going on I get a call from my sprog, Inky Dink, and it turns out he’s having AV problems too!  And I know damn well he doesn’t run McAfee because I personally installed MSE on his system!

What the motherfucking fuck was going on here?

But it turned out Inky had been victimized by one of those scareware AV programs.  I pointed him to malwarebytes.org and he took care of it himself later that evening.

Again, all this time we had no idea it was a McAfee problem.  What was I to think?  AV software was dying everywhere as far as I could tell from my small corner of the Universe.  Was it cyberwar?  Was the the “Digital Pearl Harbor” the trade press has been crying about for the last four months?  Was Google’s January hack the warning shot?

No.  It was ludicrous.  It had to be a series of coincidences, so I kept my mouth shut during the Salt Mine phone conference.

Other people were not so cautious.  They started spreading all sorts of FUD.  All it takes is one jerk to read one unsubstantiated claim on one Internet forum and as soon as that happens he’s sending e-mail out to everyone and his brother and the next thing you know you’re in full chickens-with-their-heads-cut-off mode.

Luckily even though that particular jerk (our very own local security wannabee) made an idiot of himself that day and cooler heads prevailed.  The only thing he damaged was his own credibility.

By about 10:30AM that morning the news finally came out and we went into Full Damage Control Mode.  When the dust cleared, about 25% of our systems were down.

McAfee later stated it only affected one half of one percent of their customers.  Do tell.  Maybe they based that number on the phone calls they got that day (“All lines are busy, please hold!”).  Maybe they thought it was just rubberneckers that took their site offline.

And WTF happened?

This event was curious in that the update that caused this mess arrived early that day.  Normally, and I admit I haven’t checked in some time, we get that update between 11:30AM and 2:30PM EST.  The timestamp on the files said they came in at 4:37AM.  Why?  Did their QA department in Bangalore (or Shanghai or whatever) take off early that day?

If McAfee’s Legal Department gets their way – and there is no doubt in my mind it will get its way – we may never know what happened.

17
Apr

PoTTY Now Available For Download

I’m putting a fork in this sucker here and now.  All four utilities (PoTTY, oSFTP, oSCP, and PLoNK) are available as standalone 32-bit Windows binaries at the PoTTY Download Page at my eponymous main site.

And the source is there if you want to play around with it.  Everything except OpenSSL, which you’ll have to get for yourself here.  You will need VCE 2008 and the Microsoft Platform SDK for Windows Server 2003 R2 to get ‘er done.

What?  You say you have VCE 2010 and the SDK for Server 2008?  Well… I don’t! If you get the code to compile on VCE 2010, let me know.  I’ll upgrade.

You say you want a 64-bit version?  Tough luck.  You’re stuck with 32 bits unless you want to roll your own.  A Mac OS X version?  Good luck with that, too!  A Linux version?  Hmmm… it might work, but I always wondered why anyone would bother with the Linux version of PuTTY.  I have it.  But I seldom use it.  I’m sure there are good reasons, but I haven’t thought of any!

Even though it adds two new options, PoTTY won’t hose your existing PuTTY profiles.  You can still use any version (within reason) of PuTTY with your PoTTY profiles, but of course obfuscation will not be available with PuTTY.

If you like it (don’t forget you need an obfuscated-openssh server as well), tell your friends!

If you don’t like it, tell your enemies.

17
Apr

PoTTY Statically Linked!

NAILED IT!

I dicked around with compiler options on OpenSSL and finally got the sucker to statically link.  Unfortunately, there were five name collisions between PuTTY and OpenSSL:

  • sk_new
  • SHA256_Init
  • SHA256_Final
  • SHA512_Init
  • SHA512_Final

I took the easy (stupid) way out and just prepended “potty_” to these names in the original PuTTY source code so the linker would stop bitchin’ at me.  The Right And Proper thing to do would have been to use #ifdef’s but I was in too much of a hurry to check if the code was actually compatible.

Of course, PoTTY swelled in size.  The dynamically-linked version was only  694KB.  It ballooned up to 1,258KB after getting statically linked with OpenSSL.  That was, of course, with all Microsoft compiler “optimizations” turned off, since apparently they do nothing but make your programs crash and burn (although that may have something to do with PuTTY’s crazy coroutines).

It may also be a teensy weensy bit slower than the dynamically linked version, but I can live with that since it only affects the initial key exchange.

So, there’s nothing stopping me from making the standalone executables available.  The source is another thing entirely, but I have plans for that as well.  The INSTALL doc would be a killer in itself, unless all it said was “Good luck!  You’ll need it!”

12
Apr

The Baron is BACK, Bitches!

Back in 2008, when I first published The List, I decided I needed some publicity so I joined a few Yahoo Groups dealing with proxies.  It turned out to be a horrible mistake.  Most proxy groups at Yahoo at the time were either full of junk or SPAM.  Or both.

Not so for proxitown, run by Baron Munchausen (get it?  From “Munchausen Syndrome by Proxy” and the eponymous movie.  How clever!) of Proxy.org fame.  The Baron himself is the lone spammer at proxitown and if you subscribe to this group you get daily updates of available Web (PHP/CGI etc.) proxies.

In theory.

I say that because the Baron stopped sending “daily updates” from proxitown a long time ago.

I stayed with the group because… well, I forgot about it since I wasn’t getting any emails… and also because I have a professional interest in Web proxies (as opposed to “open proxies”, which is my… obsession! ).

I block Web proxies by plugging them into Websense in my role as Chief Network Nazi back at the Salt Mine.

This activity is somewhat antiquated as the newer generation of “Active Web Gateways” are updated in real time – or so the advertising goes.  The version of Websense that I’m stuck with (6.x - the Chief Slave Driver is too cheap to upgrade)  only updates once a day.  Don’t get me wrong – Websense is very good at blocking Web proxies (I’m sure they subscribe to proxitown, too), but there’s always a window of opportunity for any new proxy created after their last database update.

It’s my job to close that window.

In the past, the Baron’s lists were pretty stale and Websense always had the domain names in their database, so there wasn’t much for me to do.  But this time around the Baron has some pretty fresh stuff.  In the last e-mail I checked, three out of the twelve proxies listed were unknown to Websense.  That’s 25%!

Score one for the Baron!

12
Apr

Obfuscated Updates for 04/12/10

You may notice the “PoTTY” link above. There’s nothing there yet. That is/was a test for the “Visit Web site” button on the PoTTY “About” box. Right now I’m mulling over where to put the files. I think they’ll end up on www.mrhinkydink.com (not the BlogSpot redirect), if only for “branding” purposes.

Today I obfuscated PLINK and PSFTP (I did PSCP over the weekend), but I haven’t tested them yet, so the entire PoTTY Suite is almost ready to rock’n'roll.  As far as the source code goes, I could zip the entire directory structure up as is, but I need to do something about my idiosyncratic, highly non-standard search paths so you can just import it into VCE 2008 with minimum hassle.  I agree VC6 would be a better format, but I don’t have VC6.

I have had a few hiccups using my own obfuscated-openssh server (Debian 4.0r0).  I have four instances of ObfuscatedPort in sshd_config, but only two of the ports are working.  This is probably something unique to this system (i.e., something I screwed up) since I also have it installed and running on four ports on my CentOS laptop (long story – it’s the only distro that works on a SONY Vaio PCG-K27) with zero problems.

The simple Cyqwin fix continues to shine.  Right now I have Cygwin oossh running in a loop back at my office in the Salt Mine, back-tunneling RDP.  There have been a few connection drops due to proxy issues – it goes out through a very busy proxy – but it reconnects fine.

If you use a proxy with Cygwin oossh (or any ssh client), be sure to set the ServerAliveInterval to something less than a minute.  In my case, the Microsoft ISA proxy back at the office drops all TCP connections after two minutes of inactivity, so you have to keep that pipe flowing if you want to stay connected.  Be it SOCKS or HTTP, it doesn’t matter.  You get two minutes.  Shit or get off the pot.

This is usually not an issue if you can get out through a firewall hole, but YMMV.

I don’t recommend using oossh through a proxy, but sometimes you have no choice.  I have a choice, but I use a proxy because I have this… obsession with proxies.

Did I ever mention that?

11
Apr

RTFM Revisited

The RDP Back-tunneling issue was nailed by Cygwin’s version of OpenSSH, 5.4p1.  Since obfuscated-openssh is based on 5.2p1, it did not work.  So yesterday I spent hours and hours trying to brute-force Bruce Leidl’s patch into 5.4p1.

After I spent two hours editing the files (I have confessed to knowing nothing about patch/diif files in the past), I wasted the rest of the day testing.  I actually did get it to run, but the client was barfing on perfectly good host keys.

At 1AM this morning, beaten and bleary-eyed, I decided it was a good time to read the docs.  This is what I found in 5.4p1′s ChangeLog:

Due to constraints in Windows Sockets in terms of socket inheritance, reduce the default SO_RCVBUF/SO_SNDBUF buffer size in Cygwin to 65535. Patch from Corinna Vinschen.

WTF?  So I chased this variable down and found it in clientloop.c as SSH_IOBUFSZ in 5.4p1 in the declaration of a buffer inside these two functions:

  • client_process_net_input
  • client_process_input

That sounded about right.  After all, in the RDP back-tunneling problem the client is having problems processing input from the net, right?  WTF, worth a shot.

So I looked at the same code in obfuscated-openssh.  SSH_IOBUFSZ was not there at all and the buffers were hard-coded at 8192 bytes.

Remember, the ChangeLog said reduce the buffer size to 65535 bytes!

I changed the size, recompiled, and did a quick RDP back-tunneling test.

NAILED IT!

And it’s not a “spotty” fix like the rest of them have been over the years.  It works every fucking time.

And it’s a genuine Cygwin fix!  It’s not an OpenSSH fix at all!  If you Google “Corinna Vinschen” (with or without the quotes, I don’t care) you will find she (he?) works on the Cygwin Project at Red Hat.

There is no cause to rejoice since, being a core WINDOWS PROBLEM, it could get blown away next Patch Tuesday.  Or the Patch Tuesday after that.  Or the one after that, ad nauseum.

Being a core Windows problem (technically known as a “clusterfuck”), there must be something similar in PuTTY that can be jerked around to make its issue with RDP back-tunneling go away. I’m looking but the coding style is so different I haven’t found anything glaringly obvious.

I’m not sure what to do with “obfuscated-openssh-5.4p1″.  At this point I’m sick of it, but it was a decent learning experience, even if the only thing I didn’t learn was to read the docs in the first place.

10
Apr

RDP Back-Tunneling NAILED

WTF!

All this time I’ve been using PuTTY (great program, BTW.  Ever heard of it?) to make the tunnel.

Cygwin ssh worked just fine, which means that Cygwin obfuscated-openssh should work just fine.

Well, I’ll be dipped in shit!

The thing is, I know I’ve tried this with Cygwin before, with the same, exact Black Screen ‘O’ FAIL results.

I did upgrade to v1.7 within the last couple of weeks, though.  Hmmm…

Maybe it’s time to take back all those nasty things I said about Cygwin.

10
Apr

RDP Back-Tunneling Experiment

So it occurred to me… what if I back-tunneled to a secondary NIC on the Windows PC?

That would absolutely get away from the local address<>local address conundrum, or so I thought.

Here at HinkyNet, besides innumerable XP VMs, I have a couple of physical XP boxes to work with and a few Linux boxes to tunnel through.  All I needed was an XP box with two NICs.

I didn’t have that, but I do have a couple of 10/100 USB NICs.  So I dug up my old CAT5 crimping tool and researched how to make an ethernet loopback plug, so I could assign an address to it.

Then, I ssh’d from the XP box with the USB NIC to a Debian box, forwarding port 3389 to the USB NIC.

I logged on to the second XP box and tried to RDP into the first XP box through the ssh tunnel.

Same result: Black Screen Of FAIL

Damn, I was pretty sure that was going to work.

Then I left Wireshark running on the destination XP box, watching the traffic to the USB adapter and tried it again.  After it crashed, I looked at the capture.

NOTHING!

Not a single packet going to port 3389.  Netstat verified terminal services was in fact listening on all adapters (0.0.0.0:3389).

Meanwhile, my RDP back-tunnel over OpenVPN via Linux VM has been up for 12 hours.

There has to be a way!

10
Apr

PoTTY Suite?

I’ve been cleaning things up in the PoTTY code and I now have everything exactly where I want it to be. I made some silly decisions early on and introduced a bug that would re-enable obfuscation whenever you changed the properties of an active connection.

With that out of the way, I added the “-z” and “-Z” command line options and tried to compile PSCP (the PuTTY version of secure copy, a.k.a. scp).

And it WORKED!

Of course, it didn’t work right away.  I had to dick around once more with silly Microsoft compiler options.

Apparently, to Microsoft “Optimization” means ensuring your application crashes every time you run it, so you have to disable it (/Od).  And it wants to compile everything as C++ code, so you have to kill that, too (/TC).

PuTTY is so well made that now that the obfuscation extension is in place, the rest of the suite just plain works.  That means PSFTP and PLINK can be built with minimum hassle (Microsoft provides the hassle, as usual).

The remaining parts of PuTTY (PUTTYGEN, PUTTYTEL, and PAGEANT) don’t derive any benefits from obfuscation, so I’m not going to mess with them.

But I plan to release the source, in VCE 2008 format (mea culpa), so I suppose I should at least get them to build.

In all I think I’ve only strayed slightly from Simon Tatham’s programming philosophy.  I don’t think I will ever understand the whole “coroutine” thing enough to implement my own, but I think obfuscation doesn’t really need it.

I can only ask forgiveness for my greatest sin, my inability to statically link the OpenSSL libraries (mea maxima culpa).

I have a three-day mental health weekend ahead of me, so expect at least some PoTTY binaries by Monday.

08
Apr

RDP Back-Tunneling Weirdness

Inevitably, once you start tunneling ports with ssh you get the Bright Idea to use PuTTY or Cyqwin on a Windows box and forward RDP (usually TCP 3389) through a remote sshd server.  Then, you travel to the remote sshd and try to connect back to that port you forwarded.  If you got it right, you get a Windows login screen, type in your credentials and… you get a Black Screen Of Death.

There have been various solutions to this problem over the years but generally they all FAIL.

At one time Microsoft published a KnowledgeBase article on this very subject.  They even offered a patch (I had it once, but I have no idea where it went), but even that failed.  And, like a lot of KBase articles, that particular one quietly disappeared (they do that a lot).

It should work, but it doesn’t.  Over the years I have tried a number of variations on the RDP back-tunneling problem, all with same results.  OpenVPN?  Nope.  Same problem.  You usually end up using a third box to bounce the port off, which works just fine, if you have a third box.

Today, I stumbled onto a semi-solution that “sort of” works.

Bear with me, this is sort of convoluted.

I run Debian Linux on VMWare GSX server on a Windows XP box.  NAT’d, not bridged (port level securty doesn’t tolerate bridging).  OpenVPN runs on this VM, connecting to a remote Linux box.  Here is the XP desktop with the Linux VM…

Through the VPN, I can hit the XP box’s RDP port.  BUT the same problem shows up.

Most of the time.

Very rarely, it just works.  Sometimes you don’t get the Black Screen Of Death, but the session will freeze and die as soon as the desktop is half-rendered.  But when it works, it works.

Today I stumbled on to one of those sessions.  Solid as a rock.

I fired up a DOS window and ran netstat.  I found I had ~5000 TCP connections in a TIME_WAIT state.  They were all connected to the proxy server.  I knew immediately what this was.  It was another connect-back process I had been working on (long story, so let’s leave it at that).

This other process runs once every ten minutes and makes all those thousands of connections.  After a few experiments I found that I could always connect whenever this other process was running.

For some reason, all those thousands of TIME_WAIT connections were actually helping.  And all of those connections were consecutive ports.  In the middle of them all, there was the local address of the system (not localhost) talking to itself on port 3389, which was very strange to see.  I expected to see the bridged address of  the VM attached to 3389 on the local address.  In fact I have looked at this issue many times before with Wireshark and that’s exactly what you see (the VM address talking to the local address, never the local address talking to itself).

So, some sort of throttling effect was going on.

And what’s the point?  I don’t know.  I’m writing this down to document it for future reference.  But it has me thinking about doing a few experiments to finally get this working.

It Gets Weirder…

That was yesterday.  Today I tried it again and this time I had thousands of connections in CLOSE_WAIT status, from a completely different process.  And there, once again, in the middle of all that, was the local address talking to itself on port 3389.

Not the locahost address (127.0.0.1).  I can’t stress that enough.

This time I fired up WireShark and told it to look at TCP 3389.

Remember, I’m in an RDP session.  There should be packets flying in and out of 3389.

There was nothing.

So I told WireShark to look at the VMWare NAT adapter (remember, I’m connected via an OpenVPN link through a Linux VM on this same box).

NOTHING!

No traffic at all from or to 3389 on any adapter.

It’s like the connection doesn’t even exist.