The standard-library Version module parses numeric version components with no limit on their length. If an application supplies untrusted user input to Version.parse, Version.match? and similar, an attacker who controls a version string can force Elixir to build a multi-megabyte arbitrary-precision integer for a long time.
This bug was introduced in Elixir v1.5.0+.
Impact
This is an unauthenticated, single-request denial-of-service (CPU and memory exhaustion). Any application that passes attacker-influenced strings to Version.parse/1, parse!/1, match?/3, compare/2, or parse_requirement/1 is affected. For example, services that validate or compare client-supplied version strings, dependency-manifest fields, or package metadata.
Solution
Elixir v1.20.1 and onwards will restrict any number in the version to 14 bytes, which is enough to encode timestamps. Longer version numbers will fail to parse. Any service that passes untrusted input to Version is recommended to also validate input versions according to their own constraints. For example, one may impose that no version string itself is no longer than 64 bytes.
The standard-library
Versionmodule parses numeric version components with no limit on their length. If an application supplies untrusted user input toVersion.parse,Version.match?and similar, an attacker who controls a version string can force Elixir to build a multi-megabyte arbitrary-precision integer for a long time.This bug was introduced in Elixir v1.5.0+.
Impact
This is an unauthenticated, single-request denial-of-service (CPU and memory exhaustion). Any application that passes attacker-influenced strings to
Version.parse/1,parse!/1,match?/3,compare/2, orparse_requirement/1is affected. For example, services that validate or compare client-supplied version strings, dependency-manifest fields, or package metadata.Solution
Elixir v1.20.1 and onwards will restrict any number in the version to 14 bytes, which is enough to encode timestamps. Longer version numbers will fail to parse. Any service that passes untrusted input to
Versionis recommended to also validate input versions according to their own constraints. For example, one may impose that no version string itself is no longer than 64 bytes.