Nonce, a randomly generated token

Nonce is a randomly generated, cryptographic token used to prevent replay attacks. Although Nonce can be inserted anywhere in the SOAP message, it is typically inserted in the <UsernameToken> element.

Without nonce, when a user name token is passed from one machine to another machine using a non-secure transport, such as HTTP, the token might be intercepted and used in a replay attack. The same password might be reused when the username token is transmitted between the client and the server, which leaves it vulnerable to attack. The user name token can be stolen even if you use XML digital signature and XML encryption.

To help eliminate these replay attacks, the <wsse:Nonce> and <wsu:Created> elements are generated within the <wsse:UsernameToken> element and used to validate the message. The server checks the freshness of the message by verifying that the difference between the nonce creation time, which is specified by the <wsu:Created> element, and the current time falls within a specified time period. Also, the server checks a cache of used nonces to verify that the username token in the received Simple Object Access Protocol (SOAP) message has not been processed within the specified time period. These two features are used to lessen the chance that a user name token is used for a replay attack.

To add nonce for the username token, you can specify it in the token generator for the username token. When the token generator for the username token is specified, you can select the Add nonce option if you want to include nonce in the username token.

 

Related concepts

Distributed nonce caching