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/0l8gt0lb1hpqk4yt2386tctm5zcflyff
  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 ==

`BeiderMorseEncoder` and `PhoneticEngine` split their input on
whitespace only and impose no limit on the length of a token. While
`maxPhonemes` (default 20) bounds the number of candidate phonemes, the
text of each phoneme grows with the input, and
`PhoneticEngine.applyFinalRules` re-scans and re-expands it, so the
cost is super-linear in the length of a single token. With the default
configuration (`GENERIC`, `APPROX`, concatenation on), the reporter
measured about 8.6 seconds of CPU and a 2.5 MB result for one
32,000-character token. The reporter proposed an input-length limit.


== PMC assessment ==

This is NOT a vulnerability. Commons Codec does not claim to safely
process arbitrary malicious input: 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

Beider-Morse is a phonetic algorithm for personal names, which are
short. The cost only becomes significant for tokens that are orders of
magnitude longer than any real name, which the application chose to
accept.


== Hardening ==

We nevertheless agree that an encoder meant for names should enforce a
sensible bound itself. Commons Codec 1.23.0:

  - speeds up `PhoneticEngine.encode(String, LanguageSet)`,
  - adds `PhoneticEngine.Builder.setMaxInputLength(int)`, with a
    default of 666 characters, the length of one of the longest
    personal names on record.

The same limit also addresses the related recursion issue in the
handling of the `d'` prefix, summarized separately on this list.


== 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