1 / 43

Core Web Service Security Patterns

This article discusses authentication patterns and message protection patterns for implementing security in web services. It compares direct authentication vs. brokered authentication methods and covers important concepts such as authentication, authorization, and credentials.

hjohn
Download Presentation

Core Web Service Security Patterns

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Core Web Service Security Patterns Sharif University of Technology( SUT ) Department of Computer Engineering ( CE ) By: Hassan Fatemi ( 84702287 ) Fatemi@ce.sharif.edu Fall 2005

  2. Outline • Authentication Patterns • Message Protection Patterns • Implementing Transport and Message Layer Security

  3. Authentication Patterns

  4. Direct Authentication vs. Brokered Authentication

  5. Important Concepts • Authentication the process of identifying an individualusing the credentials of that individual • Authorizationthe process of determining whether an authenticated clientis allowed to access a resource or perform a task within a specific security domain • Credentials A set of claims used to prove the identity of a client • Identification represents the use of an identifier that allows a system to recognize a particular subject and distinguish it from other users of the system

  6. AuthorizationMethods DeclarativeDeclarative role-based authorization can be added to application code at design time. Required access for a particular method or class is declared as an attribute in code • Role-based Authorization Imperative imperative role-based authorization is written into the application code to make authorization decisions at run time.

  7. Resource-based Authorization Resource-based authorization is performed declaratively on a resource , depending on the type of the resource and the mechanism used to perform authorization Access Control List ( ACL ) URL Authorization • Policy declaratively enforce security on SOAP request and response messages through policy assertions

  8. Direct Authentication ContextA client needs to access a Web service. The Web service requires the client to present credentials for authentication so that additional controls such as authorization and auditing can be implemented. • Problem How does the Web service verify the credentials that are presented by the client? • Conditions and reasons that force using this solution • The credentials that the client presents to the Web service are based on shared secrets, such as passwords • The Web service can validate credentials from the client against an identity store. • The Web service is relatively simple, and does not require support for capabilities such as single-sign on (SSO) or support for non-repudiation. • The client and the Web service trust one another to manage credentials securely.

  9. Solution Use direct authentication where the Web service acts as an authentication service to validate credentials from the client Participants Direct authentication involves the following participants: • Client • Service • Identity store Process

  10. Benefits • It represents an uncomplicated model for authenticating clients without the need for an authentication broker • If the shared secret between a requester and service is compromised, only the relationship between those two parties is compromised and not the entire model. Liabilities • Direct authentication does not provide single sign on capabilities. • The decentralized nature of direct authentication requires that the trust relationship be managed between each point in the communication.

  11. Liabilities cont. • If a client calls a Web service frequently, the use of direct authentication can increase latency, because the Web service typically authenticates against a remote identity store. • Data ownership and synchronization issues can occur if each of several services has its own identity store to authenticate the same client. This is because the client’s credentials may need to be duplicated across multiple identity stores.

  12. Brokered Authentication • Context A client needs to access a Web service. The Web service requires the application to present credentials for authentication so that additional controls such as authorization and auditing can be implemented. • Problem How does the Web service verify the credentials that are presented by the client? • Conditions and reasons that force using this solution • The client accesses additional services, which results in the need for a single sign on (SSO) solution. • The client and the Web service do not trust each other directly. • The Web service and the identity store do not trust each other directly. The client and Web service share a standard access control infrastructure.

  13. Participants Solution Use brokered authentication where the Web service validates the credentials presented by the client, without the need for a direct relationship between the two parties. An authentication broker that both parties trust independently issues a security token to the client. The client can then present credentials, including the security token, to the Web service. Brokered authentication involves the following participants: • Client • Service • Authentication broker • Identity store

  14. Process

  15. Benefits • The authentication broker manages trust centrally. This eliminate the need for each client and service to independently manage their own trust relationships. • Adding a new user is more easier than direct authentication because its credentials is maintained in one central point. • Two parties do not require prior knowledge of one another. • Trust relationships can be established between different authentication brokers.

  16. Single point of failure. Any compromise of an authentication broker results in the integrity of the trust that is provided by the broker also being compromised. Liabilities Common types of authentication brokers • X.509 PKI • Kerberos protocol • Web Service Security Token Service ( STS )

  17. Message Protection Patterns Message protection can be divided into three main categories: • Data integrity • Data origin authentication • Data confidentiality

  18. Data Confidentiality • Context There is a risk that an attacker can gain access to sensitive data , either by eavesdropping on the network or accessing a repository. • Problem How does you protect data within a message from being disclosed to unintended parties?

  19. Conditions and reasons that force using this solution • Disclosure of sensitive data can result in loss or damage , such as identity theft , lawsuits , loss of business , or regulatory fines. • Sensitive data may pass across the network. • Sensitive data may be persisted for short periods of time , such as in a message queue , or over longer periods of time in a database or file. • Solution Use encryption to protect sensitive data that is contained in a message.

  20. Participants Direct authentication involves the following participants: • Sender • Recipient Process You can apply data confidentiality in two steps: • Encryption the data. • Decryption the data.

  21. Two types of cryptography: • Symmetric cryptography. Both the sender and recipient share a key to perform both encryption and decryption.

  22. Two Symmetric Algorithms: • Rijndael ( AES ) • Triple DES ( 3DES ) Symmetric cryptography is completely simple in nature because the secret key that is used for both encryption and decryption is shared between the sender and the recipient. However , before communication can occur , the sender and the recipient must exchange a shared secret key. In some cases ( such as SSL ) , asymmetric cryptography can e used to ensure that the initial key exchange occurs over a secure channel.

  23. Asymmetric( public key ) cryptography. The sender encrypts data with one key , and the recipient uses a different key to decrypt ciphertext.

  24. The most common asymmetric algorithm is: • RSA asymmetric algorithms provide: • Encryption • Digital signature • Nonrepudiation • Key management process in symmetric algorithms Asymmetric encryption requires more processing resources than symmetric encryption. For this reason it is usually used to asymmetrically encrypting the shared key in symmetric algorithms.

  25. Data Origin Authentication • Context There is a risk that an attacker may manipulate data , modify or even substitute it , to change the apparent source of the request message. • Problem How does you prevent an attacker from manipulating messages in transit between a client and a web service?

  26. Conditions and reasons that force using this solution • An altered message can cause the message recipient to behave in an unintended and undesired way. • An attacker could pose as a legitimate sender and send falsified messages. • The organization may need to trace particular actions to a specific client or service. • Solution Use data origin authentication , which enables the recipient to verify that messages have not been tampered with in transit( data integrity ) and they originate from the expected sender( authenticity ).

  27. Symmetricsignature A symmetric signature is created by using a shared secret to sign and verify the message. It is commonly known as a Message Authentication Code( MAC ) The most common type of MAC is a Hashed Message Authentication Code( HMAC ) protocol that uses a shared secret and a hashing algorithm ( such as MD5 , SHA-1 , or SHA-256 ) to create the signature.

  28. AsymmetricSignature( Digital Signature )

  29. Implementing Transport and Message Layer Security

  30. Transport Layer vs. Message Layer Security

  31. Advantages of Message Layer Security over Transport Layer Security • Increase flexibility encrypt part of the message instead of the entire message • Support for auditing • Support for multiple protocols( SMTP , FTP , TCP )

  32. Implementing message layer security with X.509 certificates • Process • the service initializes and sends a message with X.509 certificate information 1. the client retrieves the service’s X.509 certificate. 2. the client retrieves its own certificate and private key. 3. the client attaches its X.509 certificate to a message. 4. the client signs the message using its private key. 5. the client encrypts the message using the services public key. 6. the client sends the message to the service.

  33. The service authenticates a client using the X.509 certificate and signature 1. The service validates the client’s certificate. 2. The service verifies the certificate trust chain. 3. The service checks the certificate revocation status. 4. The service decrypts message. 5. The service verifies the signature. 6. The service initializes and sends a response to the client.

  34. Implementing transport layer security using X.509 certificates and HTTPS • Process • Implement transport layer security using SSL. • Configure the web service virtual directory to use SSL and require client certificates. • Benefits • It provide brokered authentication, data confidentiality, and data origin authentication capabilities in one solution . • It uses SSL , which is a well established protocol that is easy to configure and implement on the windows platform. • Liabilities • Configure SSL between several points ,because it is a point to point security protocol, may cause unacceptable application response times. • All points in the communication must be sufficiently trusted to establish SSL.

  35. References • For more information about authorization on the .NET Framework, see • “Authentication and Authorization” in Building Secure ASP.NET Applications: • Authentication, Authorization, and Secure Communication on MSDN: • http://msdn.microsoft.com/practices/Topics/security/default.aspx?pull=/library/en-us • /dnnetsec/html/SecNetch03.asp. • For more information about Web services security, see OASIS Standards and • Other Approved Work (including WS-Security) on the OASIS Web site: • http://www.oasis-open.org/. • For more information about the Kerberos protocol specifications, see RFC 1510: • The Kerberos Network Authentication Service (V5): • http://www.faqs.org/rfcs/rfc1510.html. • For more information about Kerberos authentication in Windows Server 2003, • see “Kerberos Authentication Technical Reference” on Microsoft TechNet: • http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef • /b748fb3f-dbf0-4b01-9b22-be14a8b4ae10.mspx. • For a general overview of PKI technologies, see “PKI Technologies” on Microsoft • TechNet: http://www.microsoft.com/technet/prodtechnol/windowsserver2003/library/TechRef • /6d5d9ef3-75ca-46c1-acf6-57dc7e9a6adf.mspx. • For more information about WS-Trust, see Web Services Trust Language (WS-Trust) • on MSDN: http://msdn.microsoft.com/library/en-us/dnglobspec/html/WS-trust.pdf.

  36. For more information about ADFS, see “Introduction to ADFS” on Microsoft TechNet: • http://technet2.microsoft.com/WindowsServer/en/Library/c67c9b41-1017-420d-a50e • -092696f40c171033.mspx. • For more information about Security Assertion Markup Language (SAML), go to • the OASIS Web site: http://www.oasis-open.org/specs/index.php#samlv1.1. • For more information about WS-SecureConversation, see Web Services • Secure Conversation Language (WS-SecureConversation) on MSDN: • http://msdn.microsoft.com/library/en-us/dnglobspec/html/WS-secureconversation.pdf. • For more information about SAML token profile 1.0, see Web Security Services: • SAML Token Profile on the Oasis Web site: • http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0.pdf. • For more information about threat modeling, see “Threat Modeling Web • Applications” on MSDN: http://msdn.microsoft.com/practices/Topics/security • /default.aspx?pull=/library/en-us/dnpag2/html/tmwa.asp. • For more information about WS-Security version 1.0, see the OASIS Standards • and Other Approved Work (including WS-Security) on the OASIS Web site: • http://www.oasis-open.org/specs/index.php#wssv1.0. • For more information about threats and countermeasures, see Chapter 2, • “Threats and Countermeasures,” of Improving Web Application Security: Threats and • Countermeasures on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library • /en-us/dnnetsec/html/THCMCh02.asp.

  37. For more information about HMAC, see RFC 2104 —HMAC: Keyed Hashing for • Message Authentication: http://www.ietf.org/rfc/rfc2104.txt?number=2104. • For more information about WS-Security version 1.0, see the OASIS Standards • and Other Approved Work (including WS-Security) on the OASIS Web site: • http://www.oasis-open.org/specs/index.php#wssv1.0. • For more information about threats and countermeasures, see the following: • ● Security Challenges, Threats and Countermeasures Version 1.0 on the WS-I Web site: • http://www.ws-i.org/Profiles/BasicSecurity/SecurityChallenges-1.0.pdf. • ● Chapter 2, “Threats and Countermeasures,” of Improving Web Application Security: • Threats and Countermeasures on MSDN: http://msdn.microsoft.com/library • /default.asp?url=/library/en-us/dnnetsec/html/THCMCh02.asp.

More Related