Question

Can someone crack my Blowfish encryption method

Asked by: Wanting2LearnMan

I have a Windows Monile app which I will eventually sell.  I have used the blowfish algorithm to tie the program to the serial number of the program.  It goes like this.

1. Program starts up and reads the serial no of the PDA.  The serial no will be 40 characters long like so: F4E2A85A47A093E4E72EE54F37E03B853016BDA5.
2. My program puts this serial no through the blowfish algorithm (using a secret key) and the result must match a licence key that is located in a text file on the Mobile Device.
3.  If they both match then the program runs else it shuts down.

Now I am responsible for generating this licence key using the blowfish algorithm and using the same secret key as the Windows Mobile program uses.  So to produce the licence key I do the following:

1. Get the serial no from the PDA.
2. Run it through blowfish algorithm using same secret key as the Windows Mobile Program uses.
3. Store the output in a licence file and copy it to the PDA.

I want to ensure that my method is not flawed and that users will not be able to crack it.  If a user sends me the serial no of the pda and I send them back a licence file, could they look at the two and somehow work out a way to crack it.

For example, here is a typical serial no from a PDA device:
F4E2A85A47A093E4E72EE54F37E03B853016BDA5

and here is the resultant 'licence' file after it is blowfished:
FIfWymJzLxpXUnUaT9penuSpNsaBzMY7ivMHj168+hHqdE6qjnUwAjPIeW73oESj=

Can my 'secret key' be cracked from the above two bits of data?

Thanks for any help

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-04-10 at 10:23:15ID24312965
Topics

Encryption for Network Security

,

Windows MobileProgramming

,

Miscellaneous

Participating Experts
3
Points
500
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Encryption
    i am looking for a small snippet of code to encrypt text in a text box? just wondering if anyone has seen such code? (with password??)
  2. Encryption
    hi! pliz help me here.... 1) can u help me on using the public key encryption to show that encryption can be used NOT for security or protection? 2) how can i determine the minimum,average and maximum time it would take to crack a six-digit password if one can be checked...
  3. encryption algorithm
    I am looking for a low memory encryption algorithm to put on a 16 bit motorola processor. I am going to be downloading code to the processor and I want the bootloader to de-encrypt the code before saving it to the rom. I need an algorithm that will not take that much space. (...
  4. howto discover which algorithm is used to encrypt a file
    Dear Experts, I got a file which is encrypted with some sort of algortihm but i don't know with which algorithm. Is there any way you can discover which one is used? maybe by looking at it's patern or something like that? Greets Erik

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: arnoldPosted on 2009-04-10 at 11:08:11ID: 24117711

I think it can if your KEY consists on only encrypting the serial no of the PDA

Serial NO -> Blowfish processing -> key

Serial no -> + something + something else => one way encryption using random "salt" -> key

When your program runs it should have the something and something else that it adds to the PDA serial number than using the key as the salt to perform the one way encryption. The result must be the same as the key to work.

You should stay away from encrypt/decrypt mechanisms since you would run into a problem of always having to maintain the same secret with new version. Or you would need to handle the upgrade process.  I.e. take the existing key from the PDA decrypt it with the prior secrets, then reencrypt with the new version's secret.




 

by: kind4mePosted on 2009-04-10 at 11:22:39ID: 24117864

Assuming you are using the most basic level of blowfish (128 bit), even using advanced cryptoanalysis it would require a minimum of 521 samples to generate the subkey and s box of your key.  

It is possible to break, everything can be broken, but I seriously doubt anybody would take the time / effort and expense to crack it.

Since you have not posted your code, nor should you, I will say that more often than not it is the code that is worked backward to vailidate the key.  The exploitable part of your license scheme is here:
My program puts this serial no through the blowfish algorithm (using a secret key).  

That means that the secret key is located someplace in the software.   Make sure that file is well protected and hidden as are calls to it's location.  If I was to try and hack your software it would be on the verification aspect.  

If I am reading this correctly, every time the program starts it will take the serial and run it through the key.  I would bet that if someone was so inclined the software can be run inside an emulator and the data to the processor / memory logged to find the key.  Again, I don't think that will happen.  

Good luck.

 

by: DaveHowePosted on 2009-04-10 at 11:34:18ID: 24117974

agreed.

For any sensible hacker who wants to be able to write a keygen, the first step will be:

1) extract hash generation code from program, use to generate a hash and upload to device.

of course, in the real world, first step would be:

1) locate bit of code that downloads file from device and checks its equal to mac, remove, hardcode return code to "true" and then distribute replacement exe on torrent site.

 

by: Wanting2LearnManPosted on 2009-04-10 at 12:17:26ID: 24118398

Thanks guys,
[QUOTE]That means that the secret key is located someplace in the software.   Make sure that file is well protected and hidden as are calls to it's location.  If I was to try and hack your software it would be on the verification aspect.   [/QUOTE]
I have this secret key hardcoded in my program, is this a potential security problem for me?

also this concerns me: [QUOTE]locate bit of code that downloads file from device and checks its equal to mac, remove, hardcode return code to "true" and then distribute replacement exe on torrent site.[/QUOTE]. Is this easy to do?

You see someone wants to be the 'sole' distributor or my app in a certain country so it would be worth their while to do something like this as they would now have the program for free.

Thanks


 

by: Wanting2LearnManPosted on 2009-04-10 at 12:18:02ID: 24118405

the [QUOTES] didnt work sorry...

 

by: kind4mePosted on 2009-04-10 at 12:32:55ID: 24118554

There are numorous ways to exploit software.  You will not be able to make your software hack proof.  It doesn't exist, ask Microsoft.  The way I had sujested went along the lines of the encryption, I was thinking how to get around that.  The best way would be for me to run your software on an emulation that mimics the platform and log all read / writes that go to the processor and memory.  I would than parse the logs for the license key or the PDA serial and look for random letters / numbers near it and try those as the secrect key.  I would keep inputing the serial and changing the key from the code I get from the logs until I see the correct output.  I guess this would take me between 1 and 40 hours depending on how lucky I was.

What DaveHowe suggested, and a more likely situation for hacking would be to find out what file was marked true after the key was authenticated on start up.  Once you know what line of code reads something like
If key equals pda serial after encryption then run program, if not than close.
Then remove that line or have it read for all values equal true.  (please ignore the moronic nature of my "code", it was just to explain my point).  

There are at least 2 other methods for hacking the software that come to mind as well.  The bottom line is that if you want even a single person to use it, it will be hackable.

For a good example of what DaveHowe is talking about you can see how Adobe Dreamweaver was hacked. It calls home after you put in the license to authenticate, so when apply the hack you need to disconnect your internet connection, then replace a file with the hacked file so that the osftware thinks it phones home and got an OK.

 

by: Wanting2LearnManPosted on 2009-04-10 at 12:45:05ID: 24118637

OK thanks, so I have now accepted that it is impossible to hack proof my code.  What I do want to do now is to make it a headache for anyone to try it.

Ok this may be a dumb suggestion but the line of code which goes:
"If key equals pda serial after encryption then run program, if not than close."

What if I put this line lots and lots of places throughout my code? say about 100 places. Would this take 100 times longer to crack?

 

by: DaveHowePosted on 2009-04-10 at 13:45:34ID: 24119039

no, because the hacker doesn't actually see your source code, he steps though it at the machine-code level and watches what it does; when it gets to the point of comparing the value of the calculated data to the data file, they can just invert that result (so that it will only fail if it *does* get the right code) then put any old code in the file.

 

by: Wanting2LearnManPosted on 2009-04-10 at 13:58:03ID: 24119117

Oh I see now what you mean. Hmmmmmmmm.

Thanks

 

by: Wanting2LearnManPosted on 2009-04-10 at 15:22:58ID: 24119860

One thought,
If I had several functions which I used to check the serial against the licence which all basically did the same thing but were different functions with different names.

Would this cause the hacker to do more work?  This way there would not be one single point of checking?

Thanks

 

by: arnoldPosted on 2009-04-10 at 15:43:11ID: 24119990



I think you seem to miss the point.
Does it really matter how many doors with different locks you put in?  Those who are intent on entering will break down every door and pick every lock if what is behind the last door is worth something to them.
I.e. make a crappy application with the worst validation scheme and no one will care enough to even try to break the validation scheme.
Make a good/great application with the most sophisticated validation scheme, someone will put in the time.

Additionally why not include as part of your application detection for the hardware type you are running on to make sure you are not in a VM?
Check the CPU you are running on. i.e. if you are on a PDA of a specific type, check whether the process is an ARM.
After a while all your application will be doing is confirming the platform it is on rather than performing the work you're designing it to do.

 

by: Wanting2LearnManPosted on 2009-04-10 at 15:56:58ID: 24120056

Good point. Thanks for that.

So now I need to confirm what platform it is running on.  Will I ask this in a seperate post?

 

by: kind4mePosted on 2009-04-10 at 19:02:15ID: 24120621

I am not sure if arnold was being a little sarcastic on his last comment about verifiing the hardware.  If he was I agree with him (if not then I apoligize).  What I think he was saying is you can spend hundreds of man hours putting inplace things to prevent people from hacking your software and then you will have code that is 90% dedicated to stopping illegal copies and 10% doing whatever the app was meant to do.

If I may be very very blunt, your app is most likely not going to break records for sales.  It will most likely not make you more then you spend / have spent on creating hosting and promoting it.  If it is the best thing ever enough people will buy it.  Additionally the next app you come out with will sell like crazy too.  I hope I am wrong, but with the now millions (yes millions) of apps that have been produced by non-corporate non high buget people that have seen great success is very very slim.  

If you are really that concerned about someone else stealing it, then why don't you just release it for free and ask for donations?   That business model has seen a fair amount of success for both websites and software.  If the app is really that great people will pay for it, I know I have.  Or release a free version with limited features, or offer support to paying people etc.

And to expand once again on Dave's point, I have seen programmers pad data so that when the authentication comes in, it writes random data all over the program in addition to the license key.  Once again anybody who cares can just go over all the areas but it is more of a pain in the butt.

Hope this helps

 

by: DaveHowePosted on 2009-04-11 at 02:09:56ID: 24121315

As a rule of thumb - for each programmer-manweek you spend adding DRM to a program, you will add one *hour* to the time it takes a 0-day cracker to break the code if they choose to do so, and around 10% to the support load for the program due to issues with it not correctly decoding legitimate users. You could also lose around 10% of your potential customers for each operation an end user has to perform, 20% if they have to perform an offline step (such as phoning you with a keycode) unless all your competitors are doing the same.

Note that a strong DRM solution for a program is considered a *challenge* by 0-day hackers.

about the only approach that works reliably is hideously expensive - you need to abstract some vital function or other into hardware, and supply the hardware as a dongle; this means the hackers must not only code around the dongle calls, but must duplicate the dongle code's functionality in software so that the program will fulfil its function - much harder than just hacking out your DRM. The other downside is that you will lock yourself out of some markets - lotus found this out the hard way, after the US Government removed them from the authorized supplier list (due to their "keydisk" drm) and microsoft got the spreadsheet contracts instead...

 

by: arnoldPosted on 2009-04-11 at 09:01:30ID: 24122489

While a little sarcastic, I was trying to illustrate that once you start thinking of how to prevent someone from circumventing your validation mechanisms you put in place, all you remain doing is working on the mechanisms.
Because someone can always think of a more restrictive mechanism given in response to your question we have no consideration for the burden/load/complexity such a mechanism will be to the application.
I.e. for every operation the application would need to perform a task, it may have to run through the validation process such that the validation process will take 30% of the time while the actual task 70%.  If you take an average 8 hour day and the user uses your application, the tasks that would have taken 2 hours to complete with the added validation overhead now take 3+ hours.
While your application with the added overhead might be an improvement over the current amount of time used to perform the task, the overhead leaves room to someone else to step in and they only need a ten or fifteen percent improvement. With such an overhead in your application, the developer of the alternative does not have to improve or event meet the logic of your application, but only reduce the validation burden.



20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...