Apache WSS4J replay checks bypassed by concurrent message copies
Releases before 4.0.3, 3.0.7 and 2.4.5 record replay state only after validation, so concurrent copies can both pass.
Race lets concurrent copies bypass Apache WSS4J replay cache
Apache WSS4J records a UsernameToken nonce, signed-message timestamp and signature, or SAML 2.0 OneTimeUse assertion ID only after it checks that the value is new. Concurrent copies of a valid message still in transit can all pass that check and be accepted, so the same authenticated request runs more than once. If the UsernameToken is not signature-bound, the copies may use different bodies. This affects deployments that configure a replay cache, which Apache CXF does by default.
What to do: Upgrade Apache WSS4J to 4.0.3, 3.0.7, or 2.4.5. Custom ReplayCache implementations should override addIfAbsent with an atomic store operation.
| Product | Affected | Fixed in |
|---|---|---|
| Apache WSS4J | — | 4.0.3, 3.0.7, 2.4.5 |
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
Apache WSS4J remembers the UsernameToken Nonce, the Timestamp and signature of a signed message, and the ID of a SAML 2.0 "OneTimeUse" assertion, so that a captured message cannot be accepted twice. It checked whether a value had already been seen, validated the message, and only then remembered the value, as two separate steps. If several copies of the same message were processed at the same time, they could all pass the check before any of them was remembered, and all be accepted. An attacker who obtained a valid message before the recipient first processed it could send several copies at once, so that the same authenticated request was executed more than once. Where a UsernameToken is not bound to the message by a signature, the copies could carry different message bodies. The attacker needs to obtain the message while it is still in transit; a message captured after it has been accepted cannot be replayed. Affects deployments with a replay cache configured, as Apache CXF has by default. The value is now checked and remembered in a single atomic step. Custom ReplayCache implementations should override the new ReplayCache.addIfAbsent method with an operation that is atomic in their underlying store. Users are recommended to upgrade to versions 4.0.3 or 3.0.7 or 2.4.5, which fix this issue.
Releases before 4.0.3, 3.0.7 and 2.4.5 record replay state only after validation, so concurrent copies can both pass.
Today 1.1K readers · 1.3K views · 176 reads · all time 202K views