Luxon Inefficient Regular Expression Complexity vulnerability
Affected releases · luxon
- 3.x3.0.0 – 3.2.0Fixed in 3.2.1
- 2.x2.0.0 – 2.5.1Fixed in 2.5.2
- 1.x1.0.0 – 1.28.0Fixed in 1.28.1
On 3.x, the newest line:
npm install luxon@3.2.1Affected
3.0.0 – 3.2.0
8 releases
Fixed
3.2.1 – 3.7.2
13 releases, latest
Affected
2.0.0 – 2.5.1
12 releases
Fixed
2.5.2
1 release
Affected
1.0.0 – 1.28.0
67 releases
Fixed
1.28.1
1 release
Is your project affected?
Paste your package.json, or type the range you declare for luxon. It is read in your browser and sent nowhere.
What happens
Impact
Luxon's `DateTime.fromRFC2822() has quadratic (N^2) complexity on some specific inputs. This causes a noticeable slowdown for inputs with lengths above 10k characters. Users providing untrusted data to this method are therefore vulnerable to (Re)DoS attacks.
This is the same bug as Moment's github.com/moment/moment/security/advisories/GH…
Workarounds
Limit the length of the input.
References
There is an excellent writeup of the same issue in Moment: #6015
Details
DateTime.fromRFC2822("(".repeat(500000)) takes a couple minutes to complete.