You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/var/lib/gems/3.1.0/gems/protocol-http1-0.20.0/lib/protocol/http1/body/chunked.rb:48:in `read': undefined method `dump' for nil:NilClass (NoMethodError)
raise BadRequest, "Invalid chunk length: #{length.dump}"
^^^^^
from /var/lib/gems/3.1.0/gems/protocol-http-0.29.0/lib/protocol/http/body/readable.rb:80:in `each'
from /var/lib/gems/3.1.0/gems/protocol-http-0.29.0/lib/protocol/http/body/readable.rb:94:in `join'
from server.rb:11:in `block in handle_connection'
from server.rb:6:in `loop'
from server.rb:6:in `handle_connection'
from server.rb:28:in `block (2 levels) in <main>'
from server.rb:25:in `loop'
from server.rb:25:in `block in <main>'
from /usr/lib/ruby/3.1.0/socket.rb:209:in `listen'
from server.rb:24:in `<main>'
Suggested fix
Remove ${length.dump} from the error response. It's bad to put attacker-controlled data in HTTP responses if it can be avoided.
The text was updated successfully, but these errors were encountered:
The bug
When the chunked body parser attempts encounters an invalid chunk size, it attempts to raise an error using the
dump
method:(from
lib/protocol/http1/body/chunked.rb:47-49
)However, if the received chunk size is empty, then
length
isnil
, which doesn't have adump
method. This causes an unhandled NoMethodError.Steps to reproduce
Suggested fix
Remove
${length.dump}
from the error response. It's bad to put attacker-controlled data in HTTP responses if it can be avoided.The text was updated successfully, but these errors were encountered: