Apache WSS4J fails to properly validate bounds for derived-key lengths and offsets provided by a user. This flaw allows the processing of crafted WS-Security messages to result in the use of cryptographically weak keys or cause excessive CPU and memory consumption.