The Apache Commons PMC has received the security report referenced
below. After analysis, we classified it as a BUG: a real defect, already
fixed, but without security impact. 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/9lqwz67gl9dklvxj5olsxyobwz0j44mv
  Reporter: Yu Bao from PayPal Cybersecurity Team
  Disposition: BUG -- not a vulnerability; no CVE; fixed 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 ==

`RFC1522Codec.decodeText`, used by `QCodec` and `BCodec` to decode
RFC 1522 encoded-words such as `=?charset?encoding?text?=`, did not
check whether the search for the separator after the charset returned
-1. On the 3-character input `=?=`, which starts with `=?` and ends with
`?=`, it called `substring(2, -1)` and threw a
`StringIndexOutOfBoundsException` instead of the documented
`DecoderException`. Neither `QCodec.decode(String)` nor
`BCodec.decode(String)` caught it. The reporter argued that an
application decoding untrusted MIME headers and catching only
`DecoderException` would fail on such a header, and proposed checking
the result of every `indexOf` call before using it.


== PMC assessment ==

This is NOT a vulnerability, but the code was wrong and has been fixed.
An unexpected runtime exception on malformed input has no security
impact by itself: it consumes no excessive resources and produces no
wrong output. The failure is limited to the call that received the
malformed input, and an application that decodes untrusted input must
be prepared for runtime exceptions anyway:

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


== Fix ==

Since Commons Codec 1.23.0, `RFC1522Codec.decodeText` throws a
`DecoderException` when the charset separator is missing.


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