CS 580 Client-Server Programming Fall Semester, 2000 Security |
||
---|---|---|
© 2000, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 27-Nov-00 |
Security
Some common issues
Some Bad Ideas
Security through Obscurity
Security relies on encryption/authentication methods are not obvious.
Some examples:
Security in the Wrong Place
Always think about what you're trying to accomplish with a security system.
Examples:
Authentication without Checking
A server that has an authentication and authorization should precede actions that require authentication.
Example:
Back doors
Programmers have the tendency to add debug code to their servers to make testing easier.
This debug code may circumvent any security features of the server.
Example
General Security Issues
Points to keep in mind when dealing with security:
Network Authentication
Network packets can travel through many routers and computers.
The added risks
Authentication methods: Basic
Username and password
Protocols we have seen that use this:
One-Way Hash Functions
Let M be a message (sequence of bytes)
A one-way hash function f() such that:
One-Way Hash and Logins
Let f() be a one-way hash function
Client has password and userName
Client with IP XXX connects to server
Client sends userName and f(password + XXX)
Server knows the client's IP address XXX from the connection
Server computes f(password + XXX) to validate password
Sniffer can only see f(password + XXX)
f(password + XXX) only works from the machine with IP XXX
Using MD5 & SHA in Java
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class SampleCode { public static void main(String args[]) throws NoSuchAlgorithmException { MessageDigest sha = MessageDigest.getInstance("SHA"); sha.update("Hi mom".getBytes()); byte[] shaHash = sha.digest(); System.out.println(new String(shaHash)); MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update("Hi mom".getBytes()); byte[] md5Hash = md5.digest(); System.out.println(new String(md5Hash)); } }
Using security tokens, tickets, or cookies
Applications using stateless protocols (http) need to authenticate every request
Server gives a security token to a client
The token identifies the client to the server
The client only authenticates once and thereafter uses the cookie
The authentication may involve "expensive" encryption
Some requirements for security tokens:
Practical security token issues
How can a server identify a client with a token?
Rely on a piece of information that is hard to change: IP address of the client
The server must correlate the token with the address when the client uses it.
How can this be done?
A random string which identifies the client
A one-way scrambled string with client information
Encryption
After a client has been authenticated, the traffic on a network can still be sniffed.
A solution is encryption of all traffic.
This can be done at any layer of the protocol stack
Two basic types of encryption:
Public/Private Key Encryption
A public key is something that is well known, i.e. published.
A client can send authentication information by encrypting the info with the server's public key.
The server will then use its own private key to decrypt the information.
Advantages:
Digital Signatures
The same encryption method can be used to authenticate a message:
A client encrypts information with its own private key.
The server will lookup the client's public key and decrypt the information.
Advantages:
The information can only be decrypted with the client's public key.
If the public key distribution center can be trusted, the information is guaranteed to come from the client.
A combination of the previous two methods allows for mutual authentication.
Copyright ©, All rights reserved.
2000 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.
Previous    visitors since 27-Nov-00    Next