Steppenwolf takes on the Sify Broadband Encryption Algorithm...

  • Thread starter Thread starter liet-kynes
  • Start date Start date
  • Replies Replies 15
  • Views Views 9,125

liet-kynes

Newbie
Messages
9
Location
NA
ISP
The Moo Incorporated
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)
 
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.
 
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...
 
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...
 
Ah, then I'd be Michelangelo!

And rumour has it he painted it all on his back, good to know you're weren't bed-ridden.
 


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"
 
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.
 
I connected my cable and I'm still connected to the hub. Yay!

There was a power cut (still is) immediately after that and now it's "unplugged", can't do anything. Had forgotten the Sify experience, so glad I'm on BSNL now 🙂

I hope I remember my IP address - if my IP is 192.168.32.70 (or 70.32), what gateway address do I use?

Brian.
 
infernalproteus,I am also in pune is using following gateway. Depending upon which part of pune u are in, the gateway will vary.10.30.148.1 (ip address is also 10.30.148.X)
 
Right, I had totally forgotten - it was 10.30.32.70 🙂

I was able to create a prototype in Java which does exactly what Liet's sistine does and it seems to be working. This is a pure Java implementation - I was fortunate enough to find a usable blowfish class in Java (thanks to the GNU cryto libraries).
Unfortunately I do not have an account so I see an "expired / inactive account" error message, but the fact that it has gotten to that stage itself is good enough.

Liet, I must say your reference code was excellent, all I really had to do was port it, and I realize there was much more involved than just figuring out the encryption. Guys, if you get another version of any other client, it's thanks to this dude. Awesome stuff; makes me feel like I've cheated... 🙂

Now, to complete work on the Java version (I do intend to release a java version this time) and the C version, I need a Sify account. Anybody willing to share auth details with me? If not, I'll buy an account later this week and continue working on it then.

Brian.
 
Send me an email on cranil7 at yahoo.com We will speak and then i can give account details. Mine is unlimited usage account!!!!
 
Thats cool tool, I wrote in one in Tkinter/python ages back for sake of GUI and still using it.
 

Top