Solved

How to avoid hard-coded passwords?

Posted on 2001-07-22
38
1,113 Views
Last Modified: 2013-11-15
Hi Security gurus!

I'm in need to develop a project with the following rules:

1) A encrypted file must be sent to a PC, and only can be decrypted in that PC.

2) Although the decryption process is started by another user, there must be NO passwords informed by humans (please, don't ask me why ;-))

- My project is generate RSA key pairs for each PC in the network based on HD serial number or Net card;
- The encryption software is going to generate a encryption key and encrypt the file with Blowfish;
- The software is going to encrypt the Blowfish key using RSA public key of the destination machine;
- The encrypted Blowfish key will be sent in a separated ASCII file together with the encrypted file as a certificate.

Now the problem: To decrypt the file I will take HD serial number and get the machine private key. I know this private key must be saved protected with a strong passphrase, but how ??? My first thought was a strong hard-coded password, but it would prevent myself to let source code to be audited as a good security software must be.

What is your serious opinion about hard-coded passwords ?
Is there any reasonable way to avoid them?

Many thanks in advance,
Itamar

0
Comment
Question by:itamar
  • 20
  • 5
  • 4
  • +7
38 Comments
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6309059
First off, I don't understand why you'd throw the MAC address or HD # into the mix when generating the keys.  You need the generators to be as random as possible, or the keys may be breakable.

Meanwhile, as for the passphrase bit...

If humans are involved, just have the humans know the passphrases.  If humans are not involved, then all is lost unless the OS can protect the private key files.

Finally, instead of developing all this stuff from scratch, you might consider using something like Gnu Privacy Guard (free implementation of PGP from GNU).
0
 
LVL 4

Author Comment

by:itamar
ID: 6309533
Hi Chris,

the HD / MAC will represent the keys owner.
The destination is not a person but a machine.
One piece of software must get private key of ONE machine and use it to decrypt.

In fact, I will use Delphi Encrypt Compendium and TSM components to start with.

Thanks,
Itamar
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6309694
MAC as private key?
MACs are not uniqe at all (even if some people claim to be), most OS allow to set the MAC.
0
 
LVL 4

Author Comment

by:itamar
ID: 6310307
I didn't say MAC as a private key.
I said MAC or HD serial number as the destination.
It is to be used like an email address of someone, just an identifier, a login string, a social security number.
The purpose is just to make a list of destination where a file can be sent.
0
 
LVL 2

Expert Comment

by:Hagen040798
ID: 6310437
Hi

A Question: can anyone access each PC ?

Normaly the HD-Serial or MAC are bad things, because if an attacker known how You build the Key from these public readable numbers, he have cracked it.
So I think both numbers should be only involve the real Key computation, as Example in an Hash-MAC computation.

You assumed follow "Protocol" direction:
Server->Client, Server sends a encrypted file.

That's a One-Way protocol, and in fact no solution exists. Suppose each Client PC contains some special hardware, Dongle, SmartCard etc. and an attacker known to readout these things, he have cracked it, because You want all without additional Keys.

You must change the underlaying Protocol:
1.) Client->Server, Client begins a secret Key-Exchange with additional known and registered Serial-Numbers, eg. HD,MAC
2.) Server->Client, Server verify Client and follow the Secret-Keyexchange protocoll and encrypt the needed File.

Above it's a minimal two way protocol. I suggest to use a three way protocol, it's common assumed as stronger.

Look for Diffie Hellman.

Hagen


0
 
LVL 2

Expert Comment

by:Hagen040798
ID: 6310466
Hi

A nice and strong protocol where the SRP for You.
SRP stands for "Secure Remote Password"
look at http://www-cs-students.stanford.edu/~tjw/srp/

provide You can't do a two/three way protocol.

The hard point on You question are that we must suppose that anyone can read out all needed stuff from Client-PC.
So the Server must store some additional datas, such as Salt's and hidden Transactions Numbers to identify and authenticate each Client secure. I mean there exists no solution in an full public accessable Client-PC.

Yes, a tricky question. Let me more think about :)

Hagen
0
 
LVL 4

Author Comment

by:itamar
ID: 6312985
0
 
LVL 4

Author Comment

by:itamar
ID: 6315824
Hi Hagen,

I've looked into your link.
Good site.
I even have found a Delphi library that supports SRP.
But, putting my problem in other point of view, I could say:
If, just if, I had some secure way to hidden a strong passphrase in an executable I could just encrypt the machine private key anywhere, registry for example.
The usage of PKI would be trivial because the file received would be encrypted based on machine's public key.

So the question could be, how to "securely" hidden a key in a executable? Executable shrinkers for example, are an acceptable solution for medium security environment (e.g. business documents)?

Thanks to discuss it with me!

Itamar
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6316782
> .. how to "securely" hidden a key in a executable

Simple: don't write the key as string constant (or read it from somewhere), but compute it like

char key[256];
key[4]='e';
key[6]='\0';
key[2]='c';
key[5]='t';
key[1]='e';
key[3]='r';
key[0]='s';

don't write these assignments right behind each other, but use other commands inbeetween. Even with a debugger it would be hard to reconstruct the key in a stripped executable. You also may use some function instead of using the characters directly.
0
 
LVL 4

Author Comment

by:itamar
ID: 6320456
Hi ahoffmann,

this is the kind of directions I'm looking for.
I think that using chr(nn) function and others that can "generate" a character can make things harder.

Please, if you have more comments it would be appreciated.

How about executable compressors used in conjunction with your sugestion?

This kind of approach would be acceptable for a security manager of a big company?

Thanks,
Itamar
0
 
LVL 2

Expert Comment

by:Hagen040798
ID: 6321135
Hi Itamar

1. for each exe compressors You can find a decompressor, search for ASUnprotect etc.

2. If You can life with the fact that any time these BIG company have a BIG security problem, because Your Client Application was easily brocken, an Intruder steals top secret papers after kills the HD and finaly the BIG Company lost all Clients, Yes then You can use such solutions :)

AHoffmann's suggestion is allways easy to break, because an Attacker "think in other ways". he search not for plan readable Password or search for any Password, such peoples are not realy Hackers. An Attacker search the right and most efficient point to spy out all things. A good point are always the Initialisation() procedure of a Cipher. It's easy to prove that an attacker can find out the binary used Key and when this KEY is hardcoded he have in fact brocken the comletely System.

No, Itamar after discusion with other Crypto-peoples we say there exists NO strong safe solution, except with additional Hardware or addtional Userdefined key.

Provable You want a Registration System ?
Please explain exactlier.

Hagen

0
 
LVL 2

Expert Comment

by:Hagen040798
ID: 6321153
After reading, this BIG Company gave You exactly this Problem ?
Could this a "Security-Knownledge-Test" for You ?
0
 
LVL 4

Author Comment

by:itamar
ID: 6322688
0
 
LVL 4

Author Comment

by:itamar
ID: 6322692
0
 
LVL 4

Author Comment

by:itamar
ID: 6322736
0
 
LVL 4

Author Comment

by:itamar
ID: 6322738
In fact this BIG company asked for a project of transfering signed, encrtypted and decrypted documents using biometric device.
The biometrics itself is not the problem.
This is the part I know...

The problem is that using biometric authentication eliminates the usage of passphrases so how can I protect user private key, but using hard-coded password?
(to be continued...)
0
 
LVL 4

Author Comment

by:itamar
ID: 6322752
0
 
LVL 4

Author Comment

by:itamar
ID: 6322753
I ommited biometric explanation because the example I used (decrypting a file with no human interference) can show the main problem: hard-coded passwords.

Before start developing I will have to make a presentation of the proposed solution, describing the whole process, what algorithms will be used (RSA for PKI, Twofish for encrypt/decrypt, MD5-RSA for signature, and so on)
(to be continued...)
0
 
LVL 4

Author Comment

by:itamar
ID: 6322757
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 4

Author Comment

by:itamar
ID: 6322760
0
 
LVL 4

Author Comment

by:itamar
ID: 6322764
0
 
LVL 4

Author Comment

by:itamar
ID: 6323052
0
 
LVL 4

Author Comment

by:itamar
ID: 6323094
0
 

Expert Comment

by:RSmith
ID: 6325353
Itmar,
I work for a company that can solve your problem;
BioNetrix (www.bionetrix.com). We specialize in AMI (Authentication Management Infrastructure). We compliment PKI, SSO, etc. and can use many Biometric or non-biometric devices.  Please check out the web page, call the number, ask for Jay, and tell him I sent you (Read Smith).  He'll put you in touch with me and we'll work it out for you..
Good luck!
0
 
LVL 3

Expert Comment

by:FlamingSword
ID: 6509958
> What is your serious opinion about hard-coded passwords ?

May Not be enduring, or pass audit

> Is there any reasonable way to avoid them?

Compute. Use algorithm at each end. Source code/machine never has password, it only exists on the wire.

Keep it dynamic, incorporate timestamp. Use timestamp to help certify - if the package is too early or too late, do not bother to accept or decrypt. Log and warn.

Allow updates to the password generator to be included within the encrypted file(s) transmitted.
0
 
LVL 4

Author Comment

by:itamar
ID: 6510069
Hi FlamingSword,

a good comment at least!

Please, could you explain how to implement Compute Password. Which kind of algorithm could I use for this approach?

Simple example: I have a INI file with some secret configuration my application use. I would like to keep this file encrypted with no hard-coded passwords.

Many thanks for your comment,

Itamar

0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6510115
The INI file example doesn't quite fit.  Files are encrypted with keys, not passwords.  FlamingSword is talking about passwords for application/system access.

There is no solution to the INI file problem.  Just ask the RIAA about copy protection.
0
 
LVL 4

Expert Comment

by:anzen
ID: 6641600

Why don't You use the user "token" as a key, all You need is use some APIs to retrieve the current user "ID number" and then use it as a key to encrypt/decrypt data, this way ONLY the destination recipient will have access to the "messages", btw You could use this key together with some other info (such as MAC, HDSN, windows SN and so on)

If You need more details please let me know
0
 
LVL 4

Author Comment

by:itamar
ID: 6652748
Hi anzen,

thanks for your comment.

My problem is: the data is encrypted with a known algorithm right? If someone else knows that I'm using "ID number" as a key, they could easily make a decrypt program, aren't they?

Anyway, what is this user ID number? Which API must be called?

I'm really confused about how "secure" programs store encrypted data without human intervention. Everything is just a question of hidding which key was used? What if a developer tells the secret to someone?

Thanks again,
Itamar
0
 
LVL 4

Expert Comment

by:anzen
ID: 6652781

I used the term "ID Number" referring to the Windows UID tokens, that is under windows a user is not identified using the plain UserID but using a "token" which is a (long) number which in turn identifies the user, You could retrieve these UIDs using a handful of APIs and I think that doing a quick search on MSDN could help You.

About the encryption method, You could mix and match more than one method to avoid that someone knowing which algos You're using could reverse the encrypting, btw the sequence/kind of used algos should be kept somewhat "secret".

I implemented something similar some time ago, but I used "hardware dongles" (aka hardware keys) to encrypt/decrypt data so that ONLY the machine with a particular dongle could decrypt the data....
take a look at some vendor of these hw-keys to get more infos about using them as encrypting devices

Regards



0
 

Expert Comment

by:aparna-learner
ID: 6809829
hi itamar,
I too am having a similar problem as yours..in the context of intranet security. There is one link to personnel accounts that we want to make extra secure, so that only the concerned person can look at his accounts and only his accounts(not anybody else's). This thread is over 6 months old, so I don't know if anybody would be involved in taking it up again. In the meantime, have you been able to find a solution to your problem? I don't mind posting this as a different problem(in fact I will be shortly doing so), but since so much discussion has already gone into it, I thought I would not let it go completely waste, hence making this preliminary probe into finding out if this thread is still alive.
regards.
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6810500
Well, there are still people subscribed to the thread, but the issues remain the same.

In your case, it's much easier because humans are involved and you can use a 'what you know' (i.e., a pass phrase), 'what you have' (i.e., a security token), or 'what you are' (i.e., a biometric) authenticator to the keys.
0
 
LVL 4

Author Comment

by:itamar
ID: 6811795
Hi,

as chris said, the issues remains the same...

and it can be summarized by: how to efficiently hide keys in a executable?

Regards,
Itamar
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6813590
Answer:  You can't hide keys in an executable.  DeCSS should teach you that.

Since this is machine->machine communications, this really comes down to OS security.  Put the keys in a file and setup OS level security so that only the appropriate program(s)/people can read the file.  If the OS is compromised, all bets are off.
0
 
LVL 4

Author Comment

by:itamar
ID: 6817743
Chris,

what do you mean by "DeCSS should teach you that" ?What DeCSS means?

Any of Windows version (2K, NT, 98) has this kind of feature, i.e., associate a file with only one program?

Thanks,
Itamar
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6818111
DeCSS is the program that "unlocks" encrypted DVD's.

Windows NT/2K/XP has ACL's that let you specify that only certain users can access certain files, and you could have your program start as a service running as a special user, or some such.
0
 
LVL 5

Expert Comment

by:zenlion420
ID: 9706128
Hey people,

No comment has been added in roughly 1 year, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question
be PAQ'd and pts forfeited.
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Zenlion420
EE Page Editor
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 9755203
PAQed - no points refunded (of 100)

SpazMODic
EE Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now