8000 Fix ReDoS vulnerability in multipart parser · rack/rack@ee25ab9 · GitHub
[go: up one dir, main page]

Skip to content

Commit ee25ab9

Browse files
committed
Fix ReDoS vulnerability in multipart parser
This commit fixes a ReDoS vulnerability when parsing the Content-Disposition field in multipart attachments Thanks to @ooooooo_q for the patch! [CVE-2022-44571]
1 parent 19e49f0 commit ee25ab9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rack/multipart.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module Multipart
1818
VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/
1919
BROKEN = /^#{CONDISP}.*;\s*filename=(#{VALUE})/i
2020
MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni
21-
MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:.*;\s*name=(#{VALUE})/ni
21+
MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:[^:]*;\s*name=(#{VALUE})/ni
2222
MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni
2323
# Updated definitions from RFC 2231
2424
ATTRIBUTE_CHAR = %r{[^ \x00-\x1f\x7f)(><@,;:\\"/\[\]?='*%]}

0 commit comments

Comments
 (0)
0