Presentation is loading. Please wait.

Presentation is loading. Please wait.

T-110.5140 Network Application Frameworks and XML XML Security Basics 30.3.2009 Sasu Tarkoma Based on slides by Pekka Nikander.

Similar presentations


Presentation on theme: "T-110.5140 Network Application Frameworks and XML XML Security Basics 30.3.2009 Sasu Tarkoma Based on slides by Pekka Nikander."— Presentation transcript:

1 T-110.5140 Network Application Frameworks and XML XML Security Basics 30.3.2009 Sasu Tarkoma Based on slides by Pekka Nikander

2 Contents n High-level view to WS security n WS Application level security n Standardization landscape n Basic XML security n Summary n Topics are continued in the next lecture

3 Need for XML security n XML document can be encrypted using SSL or IPSec u this cannot handle the different parts of the document u documents may be routed hop-by-hop u different entities must process different parts of the document n SSL/TLS/IPSec provide message integrity and privacy only when the message is in transit n We also need to encrypt and authenticate the document in arbitrary sequences and to involve multiple parties

4 High-level view to WS security n Security is as strong as the weakest link n The options for an attacker are: u Attack the Web Service directly F Using ”unexpected” XML u Attack the Web Services platform u Attack a WS security tool u Attack the underlying operating system or network connection n Let’s have examples from different security functions’ point of view and highlight key specifications

5 Authentication I n End-users authenticate (their identity is verified) using username/password, SecurID or such, or biometrics u End-users do not send SOAP messages n Authentication mechanisms u SSL/TSL (end-to-end) u IKE & IPSec (end-to-end) u Digital certificates and signatures in SOAP messages (between security contexts) n Core specification: XML Signature n WS-Security u SOAP with security tokens F A security token represents a set of claims. F Self-generated or issued by a trusted party u Relies on XML Signature & Encryption

6 Authentication II n SAML (Security Assertion Markup Language) u A XML-based framework (schemas) for the exchange of authentication and authorization information u Mainly for integration, up to relying parties to decide to what authentication authority to trust u Assertions can convey information about authentication acts performed by subjects, attributes of subjects, and authorization decisions about whether subjects are allowed to access certain resources u Authentication statements merely describe acts of authentication that happened previously n SAML & WS-Security allow a SOAP message to include information about the end-user’s authentication status

7 Authorization n Once the sender or end-user is authenticated, are they allowed to access the resource which they are requesting? n XACML (XML Access Control Markup Language) defines how to represent access control rules in XML n WS-Policy defines web service policies (algorithms, tokens, privacy requirements, encodings,..) between senders and receivers u Also other policies, declarative & conditional assertions n SAML (Security Assertion Markup Language) n Existing tools for authorization to websites u Distinguish resources as URLs u A single URL can contain many Web Services

8 Integrity n Has this message been tampered with? u Checksums, digital signatures u PKCS#7 signature F Predates XML, ASN.1 binary format F How to sign only parts of a document (of a tree)? u XML Signature n Has the system been tampered with? u Intrusion detection u Tamper control

9 Confidentiality n Can the message be read while in transit? u Transport (or below) level security: HTTPS, IPSEC u Message-level security: XML Encryption, WS- Security n Can the message be read while it is stored? u XML Database security u Access control n Is the data private? u Gated access to private data u Audit trails of access

10 Audit n Are transactions stored? u Does the storage alter the format? (e.g. splitting an XML message into elements in order to store it into a database) n Is reporting available? n Who can run / access the reports?

11 Availability n Preventing denial-of-service attacks u Blocking unwanted message ”storms” n Use of load-balancers u For XML communication platforms u For XML Gateways / Firewalls n Design of underlying protocols

12 Administration n Ease of setting up security policies n Ability to inherit from a pre-existing policy n Ability to ”push” security policy to multiple Web Services, and Web Services platforms n Possibility of exporting a policy, and importing it into a different system u Plain text, SQL, XACML n XKMS (XML Key Management) u PKI for XML-based security

13 Non-repudiation n Preventing users (and services) from denying a transaction occurred n Requires a combination of the security requirements which we have seen so far u Proof of sender F Signature F Logging u Proof of receipt F Signature F Acknowledgement & logging n Notoriously difficult to implement

14 Lecture outline n High-level view to WS Security u WS Application-level security n Standardization landscape n Basic XML security n Summary

15 Web Application Security n Application layer security has existed long before SOAP n Application layer security for Web servers involves securing both the Web server itself, and Web applications which use the Web server as their platform n Focus on attacks on Web applications rather than the platforms on which the Web applications run u Remember various CGI application attacks n These attacks are specific to individual Web applications n When bound to HTTP, SOAP itself can be seen as a Web application – albeit a more formalized one

16 Example – SQL Injection SOAP Book Lookup Message Firewall 1234567810 VB.NET code: Set myRecordset = myConnection.execute(”SELECT * FROM myBooksTable WHERE ISBN=”’” & ISBN_Element_Text & ”’”) Becomes SELECT * FROM myBooksTable WHERE ISBN = ’1234567810’ IIS SOAP stack ASP.NETSQL server Windows Server 2003 SQL

17 Attack: SQL Injection SOAP Book Lookup Message Firewall ’; exec master..xp_cmdshell ’net user Joe pass /ADD’;-- VB.NET code: Set myRecordset = myConnection.execute(”SELECT * FROM myBooksTable WHERE ISBN=”’” & ISBN_Element_Text & ”’”) Becomes SELECT * FROM myBooksTable WHERE ISBN = ’’; exec master..xp_cmdshell ’net user Joe pass /ADD ’;— IIS SOAP stack ASP.NETSQL server Windows Server 2003 SQL

18 Solution SOAP Book Lookup Message Firewall IIS SOAP stack ASP.NETSQL server Windows Server 2003 SQL Ensure the format of incoming SOAP parameters Validate this Schema against the data isolated by the following XPath expression: /Body/BookLookup:searchByISBN/BookLookup:ISBN 1234567810 passes ’exec master..xp_cmdshell ’net user Joe pass /ADD’-- fails

19 XML Schema Solution <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace = "https://www.books.com/Lookup" xmlns="https://www.books.com/Lookup" elementFormDefault="qualified">

20 Content Inspection of XML n Integrity u Check integrity of data using XML Signature, WS- Security n Schema Validation u Verify request structure against XML Schema n Content Validation u Check content matches criteria specified in an XPath expression n Schemas can be used to specify part of the content (for example ISBN) but they have limits u XPath is more expressive u Schema validation may always be applied to Body of SOAP msgs (rpc/literal vs. document/literal)

21 Application-layer Security n Identity-based security u Authentication and authorization information shared across security domains n Content-based security u Protecting against buffer overflow and CGI-like attacks u Must have knowledge about the applications to which these messages are directed n Accountability or non-repudation u Need message level security u Maintain integrity, archived audit trails n The standards and specifications mentioned earlier address these issues

22 Lecture outline n High-level view to WS Security u WS Application-level security n Standardization landscape n Basic XML security n Summary

23 Standardization landscape n Who are specifying the basic standards? n Who are specifying the higher level standards? n Who is implementing the standards?

24 Who are specifying the standards? n Joint IETF/W3C u XML Signature (www.w3.org/Signature)www.w3.org/Signature n W3C u XML Encryption (www.w3.org/Encryption/2001)www.w3.org/Encryption/2001 u XML Key Management (XKMS) (www.w3.org/2001/XKMS)www.w3.org/2001/XKMS n OASIS u WS-Security F SOAP Message Security specification etc. u SAML: Security Assertion Markup Language u XACML: Extensible Access Control Markup language u Electronic Business XML (ebXML) (with UN/CEFACT) n Web Services Interoperability Organization (WS-I) u Basic security

25 Standardization Groups XML Encryption XML Signature XKMS XrML WS-Security Provisioning Biometrics XACML SAML W3COASIS Security Assertion Markup language XML Common Biometric Format (XCBF) Extensible Rights Markup Language eXtensible Access Control Markup Language (XACML) XML Key Management Specification

26 Standardization Groups XML Encryption XML Signature XKMS XrML WS-Security Provisioning Biometrics XACML SAML W3COASIS XML SignatureXML Encryption Kerberos profile XrML profile X.509 profile XCBF profile Username profile SAML profile WS-Secure Conversation WS-FederationWS-Authoriz. WS-Security Policy WS-TrustWS-Privacy WS-Security (framework)

27 Who are specifying the higher level standards? n Liberty Alliance (OMA) u Identity-based specifications (single sign-on, identity federation) u Specifications build on SAML, SOAP, WAP, and XML. n Microsoft (Passport,..) n Object Management Group (OMG) n European Telecommunications Standards Institute (www.etsi.org)www.etsi.org n Organization for the Advancement of Structured Information Standards (OASIS) (www.oasis- open.org)www.oasis- open.org

28 Who are implementing the standards? n A lot of companies / initiatives n Microsoft, Sun, NEC, Fuijtsu, RSA, IBM, Entrust, HP, DSTC, IAIK, Baltimore, Apache

29 Lecture outline n High-level view to WS Security u WS Application-level security n Standardization landscape n Basic XML security n Summary

30 Basic XML Security n XML Digital Signatures (XMLDSIG) n XML Encryption n XML Canonicalization

31 Digital Signatures Message Digest Message Digest Message Private keyPublic key Asymmetric Key Pair SIGNVERIFY Signature Pass/Fail Need to know the message, digest, and algorithm (f.e. SHA1)

32 XML Digital Signatures n Digests calculated and a created n (Transforms)?(DigestMethod)(DigestValue) n Then a element created from, keying information, signature algorithm, and value u The signature is actually calculated over the SignedInfo subset of this information n NOTE: This means that the actual signature algorithm is ALWAYS applied to XML

33 XML Digital Signatures (cont.) ( ( )? )+ ( )? ( )*

34 detached signature of the content of the HTML4 in XML specification [s01] [s02] [s03] [s04] [s05] [s06] [s07] [s08] [s09] [s10] j6lwx3rvEPO0vKtMup4NbeVu8nk= [s11] [s12] [s13] MC0CFFrVLtRlk=... [s14] [s15a] [s15b] [s15c]............ [s15d] [s15e] [s16] Canonicalization method: whitespaces etc. Applied to SignedInfo Signature algorithm: DSA (encryption), SHA-1 (digest) Reference to HTML 4 XML spec (detached) This gets signed! Mandatory processes: validation of the signature over SignedInfo and validation of each Reference digest within SignedInfo. This is the output of canonic. + digest + encrypt. For SignedInfo Digest value calculated over the identified data after transformations KeyInfo indicates the key to be used to validate the signature

35 XML Digital Signatures (cont.) n The data being signed can be inside the, within an element (enveloping), or n external to the in the same document or elsewhere (detached), or n surrounding the (enveloped), or n any combination of these.

36 Enveloping Signature Signature SignedInfo Reference Object Signed Data SignedInfo refers to object (sig is parent), object digested & thus in SignatureValue. Can be useful for SOAP messages

37 Detached Signatures XML Document Signed Data Signature SignedInfo Reference Signed Data Signed data can be anywhere in the Local document Or in some other location. Note that this SignedInfo refers to multiple docs.

38 Enveloped Signature Signed Document Signature SignedInfo Reference The sig is in the signed document as a child. For example: insert data to SOAP msgs

39 XML Signatures (cont.) n To verify an XML digital signature u Verify the digests in each Reference, and u Verify the signature value over the SignedInfo with the appropriate key and given signature algorithm n Note that transformations are symmetric for creation / verification! (different from transformations for encryption)

40 What about ? n A way to specify a sequence of algorithmic processing steps to apply u to the results retrieved from a URI to u Produce the data to be signed, verified, or decrypted. u Can include compression, encoding, subset extraction, etc. For example using XPath u Not needed in simple cases, but essential in complex cases

41 Next week n Continue on service security n Conclusions


Download ppt "T-110.5140 Network Application Frameworks and XML XML Security Basics 30.3.2009 Sasu Tarkoma Based on slides by Pekka Nikander."

Similar presentations


Ads by Google