Very clever..
so tell me you wouldn't..by any chance also happen to be the alter-ego of some one else that recently joined here..now would you ;)
..understandable when you are willing to share info..that's in the grey area.
Sistine | Cross-platform Sify Authentication Daemon
[ Works with Sify 3.12 Encryption Algorithm ]
by Liet-Kynes
"Information Wants To Be Free. Information also wants to be expensive. ... That tension will not go away."
- 'The Media Lab: Inventing the Future at MIT', originally by Stewart Brand, in the first Hacker's conference, 1984.
A quick history of its creation.
==================================
I came over to my house for vacation and found that the old internet connection wasn't working. So, I decided to sign up for Sify's Broadband connection. Unfortunately, what I got was an intermittent connection with a bloated dialer. Nowhere during the setup did I agree that it was OK for them to pop up the Indian Idol website, or on a whim pop up bharatmatrimony.com (ugh). One of the statements in the dialer's post-installation doc was along the lines of “to keep your connection active...we will automatically log you out”. Surely this is Orwellian Doublespeak at its best! Ah, but then we need a resistance...
So, I decided to spend a day reverse engineering the dialer from hell. As I expected, it was moronic and not much of a challenge to decipher. Guess that's what you get from "coders" at Satyam, who call themselves CS/Engineers, but have the brain the size of a quark.
On the encryption algorithm and the internals.
===============================================
I won't digress here since I've explained the inner workings in detail in the code. In a nutshell, it generates a connection string that contains amongst other things your userid, encrypted password, MAC address, a dead poodle, and so on. This string itself is encrypted. The encryption algorithm is a moronically modified version of blowfish, with the only differences being minor changes to the S-boxes and the P-array. (Gee, I'll just switch these numbers. No one will ever figure it out). The crypto-geeks amongst you will recall that the original P-array and S-box is composed of hex digits of Pi. Do a diff with my code to see the changes.
Instructions on use.
=====================
The daemon consists of two components:
1. The Main Python script that generates the key, handles the server comm, and xml parsing and so on
2. A C proggy that performs the modified blowfish encryption. It's called by the python script
The C code is perfectly platform independent, so all you need to do is compile it using gcc/mingw and you're good to go.
Since the python script expects it to be present as "modBlowfish" in the current working directory, I suggest "gcc blowfish.c modBlowfish.c -o modBlowfish".
Customizing the python script
It's pretty self explanatory. Open it up in your favorite editor and modify the username and password variables to your own.
Spoofing your MAC address
Sify has this irritating habit of allowing only listed MACs. However, it's easy to circumvent this. By default, sistine parses the output of ipconfig (ifconfig for posix) to get the MAC address. To override this, scroll down to the line marked "Spoof MAC" in the script, uncomment the line, and replace it with a MAC address that you know is registered with Sify. Voila.
Extending Sistine
======================
I had only a few days at my home, so I didn't get time to polish up the code. It was quickly whacked out in python and C in a day or two. For me, the code was over after I figured out the encryption algo and created a quick auth daemon. However, any 7yr old can extend the script. Want keep alive? Query the isActive url, or ping it out. Add command line support. I'll leave it to your imagination.
Final words...
================
I no longer have access to a Sify connection (I was home for only a couple of days, which was sufficient to develop a distaste for Sify...) Any further modifications, I leave them up to you. I hereby release Sistine into public domain. Go crazy.
Download
===========
sistine.tar.gz (updated: a slightly more cleaner version)
Last edited by liet-kynes; August 28th, 2007 at 07:58 AM.
Very clever..
so tell me you wouldn't..by any chance also happen to be the alter-ego of some one else that recently joined here..now would you ;)
..understandable when you are willing to share info..that's in the grey area.
Last edited by blr_p; August 27th, 2007 at 09:40 PM.
Nay... I was looking for a place to post my code, so I googled around and this forum seemed like a good enough place. Besides, if I had stuck to my original plan of using the fsf-india mailing list, the code would be on its way to oblivion...
Haha, wonderful post.
Why the name Sistine though?
“Of course it is happening inside your head, Harry, but why on earth should that mean that it is not real?”
Sify...Sissy...er... oh hey, the Sistine chapel! Ah, then I'd be Michelangelo! No reason really (and certainly no religious reason - I'm agnostic). Pure randomness. Just call me a dadaist...
Liet,
This really is good stuff. I tried a year or two ago but didn't get far; I did not have an active Sify connection at the time but I doubt it would have helped me much. I'm curious, how did you figure this out - did you RE the code or did you just try the modified BF algo, in which case how did you figure out the input string? In any case, good work.
I'm considering modifying my console client SuperSify to work with this - which means I'll probably have to buy a nice redundant Sify account but it'll be worth it if it works - has anybody else managed to use this successfully?
Brian.
I reverse engineered it, mostly using OllyDbg, occasionally switching to IDA for its excellent analysis modes. It was fairly easy to follow the algorithm in memory. Following the deadlisting was sufficient for most of the methods they used (the timestamp algo, anatomy of the keys, MD5 hashes). As for the blowfish algo, two things gave it away:
First: I followed the code and observed it setting up the bf s-boxes and p-arrays in memory
Second: Once you go through the reference code, you'll recognize the algorithm in assembly. Especially note the calls to bf's F-function.
So, I tried out reference code from Schneier's page against the one called by the dialer, and saw that the initial calls to F return identical values, but then they deviated. So, I was sure that they messed with the s/p. A quick comparison of the stack revealed a few minor changes. I made those changes to the ref code, and voila - everything matched.
Here are some other tech bits I remember...
- The crosier method in BBAppDll.dll (or something like that... I forget) always returns a constant string. Really quite moronic. I've mentioned this in the python script.
- The CTranslate::Translate method in BBAppDll.dll is the blowfish encryption routine.
I had some interesting breakpoints in Olly on my home computer, but sadly they exist no more. Trust no one, I guess.
Let me know if you have any questions...
On a lighter note, maybe this is how I figured it out:
Schneier on Security: Blowfish on "24"
Last edited by liet-kynes; September 7th, 2007 at 07:14 AM. Reason: Automerged Doublepost
Thanks for all the info and detail, much appreciated. I had never heard of OllyDbg and always wanted to try IDA but never got around to doing it.
I've suddenly been getting a ton of posts about my client SuperSify not working, so it seems that Sify has suddenly gone on a "new protocol" drive across the country.
I'm going to take a good look at the code later today and try to put it into SuperSify - I just hope the Sify cable I have lying unused in my house for over a year is still connected to the local hub!
Brian.
P.S Anybody tried this out yet? If I'm unable to get back on the Sify network, I might need someone to help test this.
three cheers to supersify ;D
2GB Online Storage Free! | Star Sports Formula-1 Appeal | Become a fan of India Broadband on Facebook | India Broadband Forum might soon switch to this forum software