Web Security Qiang Yang Simon Fraser University Thanks
Web Security Qiang Yang Simon Fraser University Thanks: Francis Lau (HKU) 2/20/2021 topic 1
Overview n n Basics of Security Web Server Security Secure Applications using Java Servlets Certificates, PKI and SSL 2/20/2021 topic 2
Security Concepts: Authentication n Verifying the identities of the parties involved n Typical: user name and password Authentication applies to both client and server n Client: want to know it is talking to the true server, not an imposter n Server: want to know the client is a true client, not an imposter Problems with user names and password method? 2/20/2021 topic 3
Confidentiality n Confidentiality: n Only the parties involved can understand the communication n Example: ensure no one else can intercept the transmission of credit-card numbers n Relies heavily on cryptography n But, need to key controls 2/20/2021 topic 4
Integrity n Content of communication is not altered during transmission n The alteration can be intentional or unintentional n Need a mechanism to check if any character has been changed n This can be accomplished again through cryptography 2/20/2021 topic 5
HTTP Authentication n Basic Authentication in HTTP: user name and password Transmission Loophole: use Base 64 encoding in the HTTP header Built into most web servers n Apache: in httpd. conf file 2/20/2021 <Directory “D: Secured Web Directory"> Auth. Type Basic Auth. Name CMPT 470. com # This user file should be put under. . . /Apache/ directory Auth. User. File passwordfile. txt require valid-user </Directory> topic 6
Form-based Custom Authentication n Use an HTML Form to implement a custom authentication method <Form Action=“/Servlet/Login. Handler” Method=Post> <p> <Input type = text name = “user” value = “” size = 15> <p> <Input type = password name = “password” value = “” size = 15> </form> n Then, the servlet Login. Handler can access the user/password parameter and maintain session control for the current session n First, it checks the user name and password n Then, it sets a new session for the user n Finally, it redirects the user to the target URL 2/20/2021 topic 7
Servlet Based Authentication Loginform. html Login_servlet Yes, valid user: go to applications No! Invalid user Login fails 2/20/2021 User accounts database topic 8
Potential Problems n n Access control via password - susceptible to eavesdropping – confidentiality not guaranteed n Wiretapping is especially easy in a LAN environment n Potential Confidentiality and Integrity problems not solved Need encryption based methods for n Confidentiality n Integrity n Advanced level of authenticity n You are what you say you are 2/20/2021 topic 9
Private Key Algorithm n n n The original message is called the plaintext (or cleartext), and the scrambled message ciphertext A key (a large number) is needed to scramble a message A private key algorithm (also called symmetric key algorithm) uses a private key that is known (only) to the sender and the receiver: E = encrypt(K, M) where M is the plaintext, E is the encrypted message, and K is the private key 2/20/2021 topic 10
Private Key Algorithm (cont’d) n Decryption is the inverse of encryption: M = decrypt(K, encrypt(K, M)) n n The disadvantage of private key algorithms is that the key must be kept secret by both parties to avoid compromising security n However, need to transmit keys over the Internet n Someone may intercept the key in transmission! Private key algorithms include the Data Encryption Standard (DES) (used by Kerberos), IDEA (used by PGP). 2/20/2021 topic 11
Public Key System n n n Also known as asymmetric key system which assigns a user a pair of keys, one public one private Encrypt with one key – Decrypt with another The encryption process is as follows M = decrypt(priv. K, encrypt(pub. K, M)) where priv. K and pub. K are the receipient’s private key and public key, respectively n Thus, a sender encrypts the message using the receiver's public key which is publicly known; the receiver uses his/her private key to decrypt the message n Solves the confidentiality problem: communication encrypted 2/20/2021 topic 12
Digital Signature n n Question: If cmpt 470. com sends out a message, how do we know the message didn’t come from an imposter? A public key system can be used to implement digital signature (i. e. , to authenticate the sender), in the following manner: let priv. K be a private key of cmpt 470. com – only known to the real cmpt 470. com, then when receiving M, M = decrypt(pub. K, encrypt(priv. K, M)) n The recipient can be certain of the authenticity of the sender because the latter is supposed to be the only person in possession of the private key 2/20/2021 topic 13
Public Key System (cont’d) n Two levels of encryption can be used to guarantee that a message is both authentic and private: E = encrypt(pub. K 2, encrypt(priv. K 1, M)) M = decrypt(pub. K 1, decrypt(priv. K 2, E)) n Public key algorithms include RSA, and Diffie. Hellman, Verisign. com 2/20/2021 topic 14
Digital Certificates n Final Authentication Problem: n How do we know cmpt 470. com is for real? n Answer: need a trusted authority to do the background work, and certify the public key of cmpt 470. com n Example: verisign. com n Verisign calls the digital certificates the Verisign Server ID’s n Vendors can obtain/purchase Server ID and signed Public Key from Verisign. com 2/20/2021 topic 15
Excerpted from Verisign. com whitepaper 2/20/2021 topic 16
Secure Socket Layer: SSL n n n The above scenario has been implemented into many web servers To initiate, the client accesses a secure site by using the HTTPS (HTTP + SSL) protocol, as shown above n SSL 2. 0 only has server authentication n SSL 3. 0 also has client authentication Secure web servers listen on port 443 by default. 2/20/2021 topic 17
SSL n n n SSL is used to encrypt the data between browser and server n De facto standard for secure communication on the Web n SSL support built into both NS and IE Requires a web server to install a digital certificate n Obtained through versisign, com, netscape, etc Data encryption and decryption is completely transparent to servlet developers n No additional Java coding required n All needs done is for Web server to support SSL! 2/20/2021 topic 18
- Slides: 18