The Apache Commons PMC has received the security report referenced
below. After analysis, we classified it as HARDENING: not a
vulnerability, but a defense-in-depth improvement that is already
released. In the interest of transparency and so that the community and
other researchers can benefit from the analysis, we are disclosing a
summary of it.

  Report reference (Apache Commons PMC / security archive):
    https://lists.apache.org/thread/v2j4d8z28woyw0jdfd5h8mp74s2qtf0z
  Reporter: Yu Bao from PayPal Cybersecurity Team
  Disposition: HARDENING -- not a vulnerability; no CVE; hardened in
Commons Codec 1.23.0
  TLP:CLEAR (this message may be redistributed without restriction)

The reporter was informed of this classification and of our intent to
publish this summary.


== Summary of the report ==

With the `GENERIC` name type, the default of `BeiderMorseEncoder`,
`PhoneticEngine.encode` handles an input starting with `d'` by encoding
both the remainder and `d` followed by the remainder, recursively and
without a depth bound. An input made of repeated `d'` pairs therefore
recurses once per pair, with quadratic CPU cost. The reporter observed
a `StackOverflowError` with about 4,000 pairs on the default stack size
and with about 800 pairs (1.6 KB) with `-Xss256k`, and pointed out that
an `Error` escapes the usual `catch (Exception)` handlers. The reporter
proposed handling the prefix iteratively or limiting the input length.


== PMC assessment ==

This is NOT a vulnerability, for the same reason as the related
Beider-Morse input-length report, summarized separately on this list.
Commons Codec does not claim to safely process arbitrary malicious
input, and applications that pass untrusted data to a codec are
responsible for bounding its size first:

  https://commons.apache.org/threat-model-0.1.0.html

Personal names contain at most a handful of `d'` particles; the
recursion depth only becomes a problem for inputs hundreds of times
longer than any real name.


== Hardening ==

The input-length limit introduced in Commons Codec 1.23.0,
`PhoneticEngine.Builder.setMaxInputLength(int)` with a default of 666
characters, also addresses this report: it keeps the recursion depth
far below what is needed to overflow the stack.

Applications that raise the limit, or that run with small thread
stacks, should still bound the length of untrusted names before
encoding them.


== References ==

  Threat model:
    https://commons.apache.org/threat-model-0.1.0.html
  Security policy:
    https://commons.apache.org/security.html
  Commons Codec release notes:
    https://commons.apache.org/proper/commons-codec/changes.html

Questions and follow-up are welcome on this list.

On behalf of the Apache Commons PMC,
Piotr P. Karwasz

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to