CVE-2016-15059: Net::IDN::Punycode versions before 2.301 for Perl allow a heap buffer overflow via unchecked writes past the output buffer in encode_punycode
Net::IDN::Punycode versions before 2.301 for Perl allow a heap buffer overflow via unchecked writes past the output buffer in encodepunycode.
The XS backend builds the encoded label in the string buffer of the scalar it returns, sized from the input length. The loop that emits the digits of each code point checks for room before every write, but the write of the last digit of each round and the write of the terminating NUL do not, so an input whose encoded form fills the buffer writes past its end.
Only the XS backend is affected.
Encoding an attacker-supplied string corrupts the heap.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Net-IDN-Encodeto a version that resolves this vulnerability.Fixed in 2.301
Event History
Frequently Asked Questions
Which deployments are affected?
Only the XS backend is affected. The issue applies to Net::IDN::Punycode versions before 2.301 for Perl when they encode input through encode_punycode.
What must an attacker control to trigger the overflow?
An attacker needs to supply a string that is passed to encode_punycode and whose encoded form fills the output buffer. Processing that input can cause heap corruption.
How can I determine whether my application is exposed?
Check whether the application uses a Net::IDN::Punycode version earlier than 2.301 and whether it uses the XS backend. Then identify paths where untrusted strings are passed to encode_punycode.