Nothing Special   »   [go: up one dir, main page]

Skip to content

Commit

Permalink
Fix ReDoS vulnerability in multipart parser
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
tenderlove committed Jan 17, 2023
1 parent 19e49f0 commit ee25ab9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/multipart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Multipart
VALUE = /"(?:\\"|[^"])*"|#{TOKEN}/
BROKEN = /^#{CONDISP}.*;\s*filename=(#{VALUE})/i
MULTIPART_CONTENT_TYPE = /Content-Type: (.*)#{EOL}/ni
MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:.*;\s*name=(#{VALUE})/ni
MULTIPART_CONTENT_DISPOSITION = /Content-Disposition:[^:]*;\s*name=(#{VALUE})/ni
MULTIPART_CONTENT_ID = /Content-ID:\s*([^#{EOL}]*)/ni
# Updated definitions from RFC 2231
ATTRIBUTE_CHAR = %r{[^ \x00-\x1f\x7f)(><@,;:\\"/\[\]?='*%]}
Expand Down

0 comments on commit ee25ab9

Please sign in to comment.