idna: punycode labels are decoded before the 63-octet length check, so a long xn-- label causes super-linear CPU use
benoitc idna
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| benoitc idna |
| No fix yet |
| benoitc idna |
| No fix yet |
Original description
Inefficient Algorithmic Complexity vulnerability in benoitc idna allows an attacker who controls a hostname passed to the library to exhaust CPU via an over-long xn-- label. idna:ulabel/1 in src/idna.erl hands every ASCII label that starts with xn-- to punycode:decode/1 without applying check_label_length/1, the 63-octet DNS label limit. punycode:decode/1 in src/punycode.erl builds its output with list appends in insert/4, so its cost grows super-linearly with the label length. A label of a few kilobytes keeps a scheduler busy for seconds to minutes before the label is rejected as invalid punycode.