Securing ebXML: Part 1, Message Exchangeby Blake Dournaee AbstractThis is the first of two articles about security for ebXML, with a focus on the message layer. For a general introduction to ebXML concepts with a look at the overall use case for a generic ebXML interaction based on functional phases, see An Introduction to ebXML. In this article, the emphasis will be on explaining the message-level security and security policy mechanisms for ebXML messaging (ebMS). This article begins with a summary review of message layer security benefits. The distinction between message layer security and transient socket-level security will be discussed briefly. The concepts presented in this summary are paramount to understanding the remainder of the discussion about ebMS message-layer security. Following the summary review is an in-depth examination of how security policy is described for the ebXML messaging layer through the use of the Collaboration Protocol Profile (CPP) and Collaboration Protocol Agreement (CPA). What is Message Layer Security?The majority of real-world ebXML messages have unique XML-based, message-level security requirements including digital signatures, non-repudiation, data privacy, and content-borne threat protection. These message-level mechanisms provide protection over and above transient application layer security such as SSL/TLS. Real-world ebXML deployments utilize both application-level security mechanisms and socket-level transport mechanisms. The message-level security standards employed by ebXML rely on expensive XML Security operations such as XML Signature and XML Encryption. While both standards employ expensive cryptographic processing, the time spent performing XML processing within these standards far overshadows the cryptographic operations due to an expensive mix of XML parsing, transformation, schema validation, and message canonicalization. This article suggests that significant performance and security benefits can be realized by decoupling the XML and cryptographic processing to a secure, hardened XML gateway appliance (XML firewall). Newcomers to the security space are often puzzled by the need for message layer security in light of the ubiquity of inexpensive and trusted transport-level mechanisms such as SSL/TLS or VPN technology. The term message layer security refers to persistent security properties applied to any sort of protocol-based message exchange, whether it is over HTTP, SMTP, FTP, or others. In the case of message layer security, the message unit, whether it is an XML document or binary attachment, is encrypted, signed, or both. For XML documents, the specific operation can be highly granular due to the structured nature of XML. Applying message-level security to payloads solves security problems that transport-level mechanisms are not well designed to handle, such as security property persistence. For example, in an SSL connection, the security properties are applied to the socket, and any data written to or read from that socket is encrypted and authenticated. When the socket is torn down, however, there is no way to tell whether a piece of data that came through that socket has had security properties applied to it. Furthermore, in multihop path scenarios, the data remains in the clear at any point where the SSL connection has been terminated. This is known as the SSL security "gap" as shown in Figure 1.
Message-level security mechanisms are used heavily in ebXML and other XML-based web services protocols. They help provide persistent non-repudiation, data privacy, and sender authentication for long-running transactions or transactions that span multiple domains in a multihop fashion. Other uses for message layer security include data at rest protection, where data is signed and encrypted before it is inserted in a database. CPP Security PolicyTo understand how a security policy is described by a CPP, it is necessary to examine the outer structure of a CPP instance. A CPP instance is defined by five direct child elements, shown in Listing 1. A simple BNF grammar is used to describe the cardinality of the elements. A plus (+) means one or more, a question mark (?) means zero or one, and an asterisk (*) means zero or more. No indicator means exactly one. Listing 1. The Collaboration Protocol Profile (CPP) XML Structure <CollaborationProtocolProfile> (<PartyInfo>) + (<SimplePart>) + (<Packaging>) + (<Signature>) ? (<Comment>) * </CollaborationProtocolProfile> Not all the elements shown in Listing 1 are of interest to us. The majority of the security policy information for ebMS message-level security is found within the The Listing 2. The <PartyInfo> (<PartyID>) + (<PartyRef>) + (<CollaborationRole>) + (<Certificate>) + (<SecurityDetails>) + (<DeliveryChannel>) + (<Transport>) + (<DocExchange>) + (<OverrideMshActionBinding>) * </PartyInfo> Three important subelements that help describe the security policy for an ebXML transaction include the Finally, the Listing 3. The <PartyInfo>
<DocExchange>
<ebXMLSenderBinding>
<SenderNonRepudiation>
<SenderDigitalEnvelope>
<NamespaceSupported>
The The The final element, Listing 4. Example Security Policy Elements <SenderNonRepudiation>
<NonRepudiationProtocol>
http://www.w3.org/2000/09/xmldsig#
</NonRepudiationProtocol>
<HashFunction>
http://www.w3.org/2000/09/xmldsig#sha1
</HashFunction>
<SignatureAlgorithm>
http://www.w3.org/2000/09/xmldsig#dsa-sha1
</SignatureAlgorithm>
<SigningCertificateRef certId="CompanyA_SigningCert"/>
</SenderNonRepudiation>
<SenderDigitalEnvelope>
<DigitalEnvelopeProtocol version="2.0">
S/MIME
</DigitalEnvelopeProtocol>
<EncryptionAlgorithm>
DES-CBC
</EncryptionAlgorithm>
<SenderDigitalEnvelope>
The examples shown in Listing 4 indicate that the sender supports XML Signature for message-level authentication using the DSA algorithm and SHA-1 hash function. For data privacy, the S/MIME v2.0 mechanism is used with a 56-bit DES key in CBC mode. At this point, it may seem as if all the necessary message-level security mechanisms have been specified, but there is still a question of how to apply these operations to the ebMS message. The ebMS specification uses a multipart MIME encapsulation. The driver for this includes scenarios in which different portions of the entire ebMS message are encrypted or signed. This is the job of the The To see how the
Figure 2 shows three MIME parts in the SOAP Message Package, a Header Container and two Payload Containers. When specifying message-level security policy, the Due to the recursive nature of MIME, one MIME part may be conceptually replaced by a new MIME part that has been signed or encrypted. To identify the parts of a message package, the CPP contains a collection of <SimplePart id="Part 1" mimetype="text/xml"/> <SimplePart id="Part 2" mimetype="application/xml"/> <SimplePart id="Part 3" mimetype="text/html"/> In the previous example, the MIME part of content-type text/xml is given an identifier of "Part 1," the MIME part of content-type application/xml is given an identifier of "Part 2," and the MIME part of content-type text/html is given an identifier of "Part 3." To specify that a particular MIME part should be encrypted, the
The tricky part regarding the Listing 5. The <Packaging>
<CompositeList>
<Encapsulation
<!-- Part 2 is the payload being encrypted -->
id="Part A" mimetype="application/pkcs7-mime"
mimeparameters="smime-type="enveloped-data"">
<Constituent idref="Part 2"/>
<Encapsulation>
<Composite tp:id="New Part"
mimetype="multipart/related"
mimeparameters="type="text/xml"
version="1.0"">
<!-- Part 1 is the SOAP envelope
The ebXML message is made up of the
SOAP envelope and the encrypted payload. -->
<Constituent idref="Part 1"/>
<Constituent idref="Part A"/>
</Composite>
</CompositeList>
</Packaging>
It is easier to understand the recursive "Russian doll" nature of the encapsulated portions if the example is read from bottom to top. The last
Figure 4 shows the newly generated parts in bold. Notice that the original message went from three MIME parts to two MIME parts but preserved the original structure by creating a new hierarchy of encapsulated parts. ebMS Message-Level SecurityThe general message structure for an ebMS message is based on SOAP v1.1 and SOAP with Attachments. The initial specification for ebMS 2.0 was completed in early April 2004; because of the timing it doesn't benefit from standard SOAP security mechanisms such as OASIS WS-Security and the OASIS WS-Security SOAP with Attachments Profile. Instead, it uses XML Signature for data integrity and sender authentication, and makes suggestions for different payload encryption techniques from a choice of XML Encryption, S/MIME, and PGP/MIME. XML Signature and ebMS The heart of an XML Signature is the In the case of ebMS, at least two It is extremely important to note that using an enveloped signature is a tremendous performance hit in terms of XML processing. The reason for this lies in the fact that the entire XML node set must be parsed against an expensive XPath expression and then canonicalized to ensure that syntactic changes are removed before verifying. This type of expensive XML processing is precisely the type of processing that can be easily offloaded to a dedicated hardware appliance that can perform XML Signature operations at wire speed. Listing 6 shows a sample signed ebMS message. Listing 6. A Sample Signed ebMS Instance <SOAP:Header>
<eb:MessageHeader eb:id="..." eb:version="2.0" SOAP:mustUnderstand="1">
</eb:MessageHeader>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
<XPath>
not(ancestor-or self::node()
[@SOAP:actor="urn:oasis:names:tc:ebxmlmsg:actor:nextMSH"]
| ancestor-or-self::node()[@SOAP:actor=
"http://schemas.xmlsoap.org/soap/actor/next"])
</XPath>
</Transform>
<Transform
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>...</DigestValue>
</Reference>
<Reference URI="cid://blahblahblah/">
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>...</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>...</SignatureValue>
<KeyInfo>...</KeyInfo>
</Signature>
</SOAP:Header>
<SOAP:Body>
<eb:Manifest eb:id="Mani01" eb:version="2.0">
<eb:Reference xlink:href="cid://blahblahblah/"
xlink:role="http://ebxml.org/gci/invoice">
<eb:Schema eb:version="2.0"
eb:location="http://ebxml.org/gci/busdocs/invoice.dtd"/>
</eb:Reference>
</eb:Manifest>
</SOAP:Body>
</SOAP:Envelope>
Perhaps the two most important parts of Listing 6 are the Payload Encryption and ebMSThe ebMS 2.0 specification takes a strong stance on payload encryption and defines XML Encryption to be the default encryption method for ebMS 2.0 messages. This strong stance is softened by the fact that when the ebMS 2.0 specification was released, XML Encryption was not yet at the full Recommendations status, and therefore other legacy mechanisms such as S/MIME and PGP/MIME have also been specified as alternatives. The advantage of XML Encryption over legacy mechanisms is its support of selective encryption for ebMS header elements. That is, with legacy mechanisms like S/MIME or PGP/MIME, it is easy to encrypt an entire MIME part but not possible to select a subdocument or specific child element to protect. This advantage coupled with the natural alignment of ebXML with XML-related standards makes XML Encryption the natural choice for most new B2B deployments. Additional Content-Borne ThreatsIn this article we discussed what will be termed "traditional" message layer security, focusing primarily on applied cryptography such as signatures and encryption. In particular, this type of message layer security has to deal more with trust enablement than with threat prevention. What may not be apparent here is that there are new XML-based threats, called XML Content Attacks, that are also part of the message layer security. An example of some of these content-based threats will be discussed in Part 2 of this series. Resources
Blake Dournaee is a senior architect at Sarvega, Inc, based in Oakbrook Terrace, IL. Return to dev2dev. |
Article Tools In This Series Related Technologies Related Articles Bookmark Article
|