Docsity

Notes on Security, Security Issues and Encryption | CS 580, Study notes of Computer Science

Toggle sidebar
bg1
12/5/02 Doc 25 Security slide # 1
CS 580 Client-Server Programming
Fall Semester, 2002
Doc 25 Security
Contents
Security.........................................................................................2
General Security Issues .............................................................8
One-Way Hash Functions ........................................................11
Encryption ................................................................................17
References
NIH Security Web Site
http://www.alw.nih.gov/Security/security.html
Applied Cryptography Second Edition, Bruce Schneier, John
Wiley & Sons, 1996
Red Team versus the Agents, Scientific American, December
2000, pp. 20, 24.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Notes on Security, Security Issues and Encryption | CS 580 and more Study notes Computer Science in PDF only on Docsity!

CS 580 Client-Server Programming Fall Semester, 2002 Doc 25 Security Contents Security......................................................................................... 2 General Security Issues ............................................................. 8 One-Way Hash Functions ........................................................ 11 Encryption ................................................................................ 17 References NIH Security Web Site http://www.alw.nih.gov/Security/security.html Applied Cryptography Second Edition, Bruce Schneier, John Wiley & Sons, 1996 Red Team versus the Agents, Scientific American, December 2000, pp. 20, 24.

Security Some common issues

  • Authentication Client (server) should be able to ascertain the origin of the message Intruder should not be able to masquerade as someone else
  • Integrity Messages should not be modified in transit
  • Nonrepudiation Sender should not be able to falsely deny sending a message later
  • Confidentiality Intruders should not be able to learn sensitive data from a message
  • Restricted Access Users should be able to perform requests that they are authorized to perform

Security through Obscurity Security relies on encryption/authentication methods are not obvious. Some examples:

  • Reverse the byte order of a message
  • Swap bytes in some "secret" way
  • Add garbage to data
  • Use some "secret" algorithm

Security in the Wrong Place Always think about what you're trying to accomplish with a security system. Examples: Client performs authentication locally

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

  • sendmail "WIZARD" Wizard command gave full root privileges to the user The default distribution had this command enabled The "Internet worm" used this to attack machines throughout the Internet.
  • Sandia National Labs Security Agents Software Agent software based on Lisp Agents could perform any Lisp string Agents could request other agents to perform tasks Intruders could masquerade as an agent

General Security Issues Points to keep in mind when dealing with security:

  • The security system is only as strong as its weakest link
  • A flawed security system is worse than no security at all
  • US government considers encryption algorithms munitions
  • Several security systems together are better than only one
  • Security by obscurity really doesn't work Some existing tools to look at:
  • PGP (Pretty Good Privacy)
  • RCA
  • Kerberos
  • SSL (Secure Socket Layer)

Authentication methods: Basic Username and password Protocols we have seen that use this:

  • POP
  • HTTP Problems POP clients check for new mail periodically Each check requires sending name/password HTTP requests are made every time a page is requested. Username and password get embedding in html pages The more frequent the authentication information is sent over a network, the higher the chance that it will be sniffed.

One-Way Hash Functions Let M be a message (sequence of bytes) A one-way hash function f() such that:

  • f maps arrays of bytes to arrays of bytes
  • f(M) is always the same length
  • Given an M it is easy to compute f(M)
  • Given f(M) it is hard to compute M
  • Given M it is hard to find N such that f(M) = f(N) Common One-way Hash Functions MD5 - Message Digest 5 SHA - Secure Hash Algorithm

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 MD5 & SHA in Smalltalk Load the MD5 & SHA parcels 'Hi mom' asByteArray md5Value 151963197781583193299119603806589129963 'Hi mom' asByteArray shaValue 559954799469170145248016473141621118947215272720

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:

  • Shared key encryption One key both encrypts and decrypts
  • Public/Private key encryption One key encrypts, another decrypts

RSA

Public Key Key contains n & e where n = pq, p & q are primes e relatively prime to (p-1)(q-1) p & q must be kept secret Private Key d is e

  • mod ((p-1)(q-1)) that is (de) mod ((p-1)*(q-1)) = 1 Encrypting Let m be a message such that m < n Let c be the encrypted message c = m e mod n If m >= n then break into block smaller than n and encrypt each block Decrypting m = c d mod n

Example Example is from page 467-8 of Schneier Alice’s Keys Let p = 47. q = 71. Then n = p*q = 3337 e = 79. Then d = 79

  • mod 3220 = 1019 So Alice’s public key is n = 3337 e = 79 Alice’s private key is d = 1019