Open SteamRiC opened 6 years ago
Also one example with bad escaping:
iex> :hackney_multipart.encode_form([{:file, "1\"2.txt"}]) |> elem(0) |> IO.puts
-----------------------------cmvkvxjlirmydmjx
content-length: 0
content-type: text/plain
content-disposition: form-data; name="file"; filename="1"2.txt"
-----------------------------cmvkvxjlirmydmjx--
filename="1"2.txt"
doesn't look correct
mmm shouldn't trailing new line should rather stripped instead of escaped? For line in the middle yes that should be encoded, but trailing new lines?
Facing the same issue. Any follow up on this?
It can be potentially dangerous as it allows injection through header value.
[
{<<"Custom-Header1">>, <<"Value\nEvilHeader: evilvalue">>}
],
Line break should be followed by space or tab character. Any counter indication to parse & add space if missing?
Example code using hackney
1.12.1
:When inspecting the requests in Wireshark, I got the following results:
With
{<<"Custom-Header">>, <<"Value">>}
(without\n
at the end)With
{<<"Custom-Header">>, <<"Value\n">>}