Re: Application security question
- From: Lasse Reichstein Nielsen <lrn@xxxxxxxxxx>
- Date: Sat, 26 Jan 2008 23:45:39 +0100
Martin Gregorie <martin@xxxxxxxxxxxxxxxxxxx> writes:
I need to implement login security for a database system and would
appreciate some suggestions.
So, you want to implement security.
The first thing to do is to establish the threat model.
What are you protecting? From what? How bad is it if security is
compromised?
The database will be hosted on a Linux system, but the graphical query
and maintenance applications may be run anywhere - Linux, OS-X or
Windows. The applications access the database directly: there is no
middle tier server.
The database doesn't need to be particularly secure. Its intended to
operate over an office LAN: access over the Internet is extremely
unlikely. The intention is simply to keep visitors and unauthorized
staff members from querying or altering it.
So you are protecting the database from direct querying and altering
by local, semi-trusted, users.
The username and password of the database should be kept "secret".
Users should not need to know them to use the system.
Obviously, a determined competent user will be able to acquire the
login credentials for the database from the application.
You will need a policy forbidding this.
Alternatively, each user should be created as a user on the
database, with seperate credentials and capabilities.
I thought of simply using the database user name and password but this
seems pretty insecure: these tend to become common knowledge.
Use for what? For login into the application?
Ideally I'd use something like the standard *NIX login:
- user is prompted for name and password.
- password is encrypted.
- the name and encrypted password are used as keys to query a database
table.
- the query returns a row count (0 = login fails, 1 = login OK)
Why encrypt the password?
It sounds like you expect all users to login using the application,
but they can just as easily do queries and alterations directly
against the database using a standard database tool.
The reason passwords are encrypted in traditional Unix password files
is to avoid having them available in plaintext to other users.
That's a good reason, maybe also in your case, but if the client
encodes the password, not the server that checks it, then the
real password just becomes the encrypted string. I.e., you have
no advantage from encryption, except from people restricted to
using your application.
Name/password maintenance would be handled by a simple application
used by the admin to create/cancel users and the reset lost passwords
to a default. The user would set and change their own password and
would be forced to change the default on first login
I'd appreciate comments about the security of this scheme,
The security is pretty low, if you can talk about security at all. You
are trusting the client to do authentication, and the client is
entirely under the control of the user.
You have no trusted server-side to do the authentication, so you will
not have security against anybody determined and mildly competent.
On the other hand, it's an internal application, which means that
the users can be threatened with, e.g., being fired, if they do
something they are not allowed to. This is much better security
than any technical measure you have available here.
Add logging and log auditing, and users should be able to police
themselves.
but what I
really need to know is what standard or 3rd party classes are
available to implement it. I've looked through the standard classes
and Roedy's site but all I've found is the JPassportField, which is
exactly what I need for the GUI.
I'm currently still on Java 1.4. Some searching hints that the Crypt
class may be part of Java SE 5. Did I read this right? If so, it looks
like I'd best upgrade to Java 6 ASAP.
Cryptography is available, but it doesn't need to be strong (since all
it does is to make the key entered into the application not be the key
that is actually checked - anybody circumventing the application and
accessing the database directly will only need the encrypted
value).
Any one way method would do, as long as it's the same method used when
changing password and when checking.
Pick any cipher from javax.crypto
<URL:http://java.sun.com/j2se/1.4.2/docs/api/>
DES is one choice.
But XOR'ing the bytes of the password by a constant would probably
also suffice.
I'd rethink the need for this.
/L
--
Lasse Reichstein Nielsen - lrn@xxxxxxxxxx
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
.
- Follow-Ups:
- Re: Application security question
- From: Martin Gregorie
- Re: Application security question
- References:
- Application security question
- From: Martin Gregorie
- Application security question
- Prev by Date: Re: Java database
- Next by Date: junit testing a method that invokes an infinite loop
- Previous by thread: Application security question
- Next by thread: Re: Application security question
- Index(es):
Relevant Pages
|