Presentation is loading. Please wait.

Presentation is loading. Please wait.

Security Management in Web Applications. We all know this page...

Similar presentations


Presentation on theme: "Security Management in Web Applications. We all know this page..."— Presentation transcript:

1 Security Management in Web Applications

2 We all know this page...

3 Would we want all to what’s behind this for us? Any ideas on how access can be restricted?

4 Problem Want to restrict access to certain Web pages Must answer the following questions –Which pages should be restricted? –Who should access restricted pages? –How should users be authenticated? –Should data be encrypted? We consider authentication methods that ensure that the right people can access the pages

5 Authentication Methods: Strategies Programmatic Security: –Site designer programs the logic needed for restricting access. –very flexible –requires a lot of coding Declarative Security: –“Declare” who may access what –Use built-in HTTP mechanisms to control access (Basic or Digest access authentication scheme) –not flexible –requires little coding We will focus on Basic and Digest authentication

6 What must be declared? Realms: A realm is a set of documents, along with a realm name. –Sets of documents that should have the same access rights are declared within a single realm User/Passwords: For each realm, the sets of users and passwords that may access the realm are defined Manner to define the above is web-server specific

7 Underlying Idea When user requests a resource within a realm (i.e., a restricted resource), he must also send along his user name and password If user name and password are not sent, the web server requests these before returning the resource Exact protocol differs whether Basic or Digest authentication is used

8 server client (c)Response GET /cgi-bin/checkout?cart=17854 HTTP/1.1 Authorization: Basic YnJpYW4tdG90dHk6T3ch Basic authentication protocol server client (a)Query GET /cgi-bin/checkout?cart=17854 HTTP/1.1 clientserver (d)Success HTTP/1.1 200 OK … client server (b)Challenge HTTP/1.1 401 Unauthorized WWW-Authenticate: Basic realm= “ Shopping Cart ” Shopping Cart Username: Password:

9 HTTP Basic Mechanism When the server gets a request to a protected resource, it checks whether that request has the HTTP header Authorization: Basic username:password If the name and password are accepted by the server (i.e., are those of a user that has the privilege to get the page), then the requested page is returned

10 HTTP Basic Mechanism If the request does not have the authorization header or the name and password are not accepted, then the server replies with a status code of 401 unauthorized The 401 response will have the header WWW-Authenticate: Basic realm="realm-name" That is, "in order to get this resource, you will have to authenticate using the basic method" –Tells the user to supply authentication for pages in realm-name Browser will automatically open a dialog for the user to enter his username and password

11 Browser Cooperation Throughout the session, the browser stores the username and password and automatically sends the authorization header in either one of the following cases: –The requested resource is under the directory of the originally authenticated resource –The browser received 401 from the Web server and the WWW-Authenticate header has the same realm as the previous protected resource

12 Sending the User Name and Password Under Basic authentication, the user name and password are sent as a pair username:password written in the Authentication header The username, password pair are written in Base64. This is not encryption

13 Declarative Security: BASIC Realm B Realm A /a/A.html /a/B.jsp /b/C.css /b/D.xml E.xsl GET E.xsl OK + Content F.xml

14 Declarative Security: BASIC Realm B Realm A /a/A.html /a/B.jsp /b/C.css /b/D.xml E.xsl GET /a/B.jsp 401 + Basic realm="A" F.xml

15 Declarative Security: BASIC Realm B Realm A /a/A.html /a/B.jsp /b/C.css /b/D.xml E.xsl GET /a/B.jsp + user:pass OK + Content F.xml

16 Declarative Security: BASIC Realm B Realm A /a/A.html /a/B.jsp /b/C.css /b/D.xml E.xsl GET /a/A.html + user:pass OK + Content F.xml

17 Problems with Basic authentication What problems are there with this type of authentication? What type of attack can succeed with this scheme?

18 Digest Access Scheme The most serious security flaw in the basic scheme is that the name and password are sent unencrypted, and hence everyone on the network path can read it If an attacker snoops a request with basic authentication, she can access to the whole protection space of the resource The digest access authentication scheme solves many of the flaws of the basic schemes, such as the one above

19 Digest Operation Like the basic, the digest scheme requires that authentication data is sent with each request for a protected resource However, passwords are not sent in clear text The idea is to use a one-way hash, such as MD5 A one-way hash H is a mapping of strings that has the following properties: –It is "easy" to compute H(x), given the input x –It is "hard" to compute x, given the mapping H(x)

20 Digest Operation (cont) In the digest scheme, instead of sending the password x in clear text, the client sends H(y) –y is the concatenation of the user name, the password, and some additional values (discussed later on) A server that gets digested authentication data repeats the same encryption process and compares its output with the given H(y) –How come server can compute H(y)?

21 Using Digests for password-obscured authentication server client Internet (a)Request Please give me the internal sales forecast. server client Internet (c)Authorization Please give me the internal sales forecast. My username is “ bri ” My digested password is “ A3F5 ” OK.The digest you sent me matches the digest of my internal password, so here is the document. server Internet client (d)Success digest( “ 0w! ” )=A3F5 ˇ This is a match! server client (b)Challenge You requested a secret financial document.Please tell me your username and password digests. Internet Ask user for username and password digest( “ 0w! ” )=A3F5

22 Message Digest #5 (MD5) One popular digest function, MD5, converts any arbitrary sequence of bytes, of any length, into a 128-bit digest. –128 bits = 2 128, or about –1,000,000,000,000,000,000,000,000,000,000,00 0,000,000 = 10 39 possible distinct condensations. Given the result of an MD5 function, do you think you can guess the argument?

23 MD5 digest examples InputMD5 digest “Hi” C1A5298F939E87E8F962A5 EDFC206918 “bri:0w!” BEAAA0E34EBDB072F8627 C038AB211F8 “3.1415926535897” 475B977E19ECEE70835BC 6DF46F4F6DE “http://www.http-guide.com/index.htm” C617C0C7D1D05F66F595E 22A4B0EAAA5 “We hold these Truths to be self-evident, that all Men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are life, Liberty and the Pursuit of Happiness-That to secure these Rights, Governments are instituted among Men, deriving their just Powers from the Consent of the Governed, that whenever any Form of Government becomes destructive of these Ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its Foundation on such Principles, and organizing its Powers in such Form, as to them shall seem most likely to effect their Safety and Happiness.” 66C4EF58DA7CB956BD042 33FBB64E0A4

24 Problems, so far What problems do you see with this authentication method so far? Does it really improve the BASIC method?

25 Digest: More Details In order to avoid a “replay” attack, each time that the client requests a resource –the Server generates a new “nonce” value –Server sends the nonce value as a challenge to the Client –Client computes MD5(user:password:nonce) and sends to Server (actually, there are some more arguments too) –Server verifies correctness Why does this prevent replay attack? –Note: Server must keep track of nonces used in the past

26 Problems, so far Can someone now impersonate the client? Can someone discover the client’s password? Can someone impersonate the server?

27 Digest: Even More Details In order to make sure that the server is not compromised –the Client sends with his request a “client nonce value” –The Server returns the resource, along with MD5(user:password:cnonce:resource-content) –Client verifies correctness

28 The Digest Authentication Handshake Server (1)Server generates nonce (5)Server verifies digest [generate rspauth digest] [generate next nonce] Client WWW-Authenticate (challenge) (2)Server sends realm, nonce, algorithms (3)Choose algorithm from set [generate response digest] [generate client-nonce] (7)Client verifies rspauth digest Authorization (response) (4)Client sends response digest [send algorithm] [send client-nonce] Authentication-Info (info) (6)Server sends next nonce [send client rspauth digest]

29 Problems, so far Can someone impersonate client? Can someone impersonate server? Can someone see the client’s private data?

30 Reference http://www.ietf.org/rfc/rfc2617.txt RFC 2617,”HTTP Authentication: Basic and Digest Access Authentication”

31 SSL Connections, HTTPS SSL = Secure Socket Layer

32 Security on the Internet The Internet is used to transmit sensitive data from clients to servers and vice-versa –User passwords –Credit card numbers –Private client data on remote servers (e.g., Banks) However, data packets are read by several computers on the way from the client to the server (and vice-versa) –Routers, proxies, etc.

33 Security on the Internet (cont) For secure communication, the following should be provided: –Only the server can read the client requests –Only the client can read the server's responses –Only the client can send requests on behalf of itself –Only the server can send responses on behalf of itself In short, no one should be able to interfere in the interaction, either by reading the transferred data or by impersonating one of the sides

34 SSL Connections The SSL (Secure Socket Layer) protocol is used to manage security of message transmission on the Internet Data encryption and decryption is based on symmetric and asymmetric keys The HTTPS (HTTP over SSL) protocol is actually the HTTP protocol above SSL transportation

35 HTTP versus HTTPS HTTP Stateless protocol Non secure connection Non Secure Sockets HTTPS Session-based protocol Secure connection Secure Sockets

36 TCP/IP SSL SSL in the Network Layers HTTP Email Protocols

37 Stages of SSL protocol SSL handshake, server and client: –authenticate each other –negotiate encryption keys and algorithms to be used to establish a joint secret key –Negotiate joint secret key to be used Data exchange –Data is sent between client and server, encrypted with joint private key

38 Symmetric and Asymmetric Keys Data can be encrypted and decrypted using keys, which are simply large numbers Symmetric keys: the same key is used for both encoding and decoding of the message Asymmetric keys: one key is used to encode the message, and another is used to decode it –Key used to encode = public key –Key used to decode = private key It is considered practically impossible to decode a message without knowing the decoding key

39 Secure Connection: A Naive Approach Consider the following protocol: –Server and Client send their public keys to each other –Data is encrypted using the public key of the receiver What is wrong with this protocol? –Encryption methods (public keys) are known to everyone - everyone can impersonate the participants –A participant cannot tell whether its received key was indeed sent by the other participant

40 The SSL Handshake Server hello + SSL settings Client SSL Settings + Certificate Is this a good certificate? 1. Client gets the Server's certificate

41 The SSL Handshake Server Client 2. Client creates a master secret and shares it with the server

42 The SSL Handshake Server Client 3. Client and server create symmetric session keys from the master secret

43 The SSL Handshake Server Client Data is transferred using the session keys (Http Response) (Http Request)

44 SSL Certificates To assure that the replier to the first request is the server, the server sends a certificate The certificate contains both the server's name and its public key The certificate is issued by a Certificate Authority (CA), which is known to the client in advance –For example: VeriSign, Thawte, RSA Secure Server, etc. CA signs the certificate using a digital signature, which the client can verify

45 Issuer's Name Public Key Serial Number Validity Period Server's Name The Server's Certificate Issuer's Digital Signature

46 An Example: The Certificate of bankleumi.co.il

47 Authentication via SSL If the server needs to assure the client's identity, the first interaction after the SSL handshake will typically be a client authentication Client authentication is done using the regular (e.g., HTTP) authentication mechanisms Why not using a certificate?


Download ppt "Security Management in Web Applications. We all know this page..."

Similar presentations


Ads by Google