Closed izhan closed 9 years ago
Turns out it was an issue with the encoding. The string we receive from next_outgoing
is encoded in UTF-8 — however, calling pack on that string within MsgBody converts it to a string using ASCII-8BIT encoding. The length of the string increases as a result.
Example:
"µ".length
=> 1
"µ".force_encoding("ASCII-8BIT")
=> 2
Where do you suppose we should handle this? @outgoing_data within session.rb is already array of UTF-8 characters....perhaps we should convert any queued data to ASCII-8BIT strings immediately?
I merged your pull request, thanks!
Does that solve this issue?
On Fri, Apr 24, 2015 at 10:57 PM, Irvin Zhan notifications@github.com wrote:
Turns out it was an issue with the encoding. The string we receive from next_outgoing is encoded in UTF-8 — however, calling pack on that string within MsgBody converts it to a string using ASCII-8BIT encoding. The length of the string increases as a result.
Example:
"µ".length => 1 "µ".force_encoding("ASCII-8BIT") => 2
Where do you suppose we should handle this? @outgoing_data within session.rb is already array of UTF-8 characters....perhaps we should convert any queued data to ASCII-8BIT strings immediately?
— Reply to this email directly or view it on GitHub https://github.com/iagox86/dnscat2/issues/43#issuecomment-96135252.
Solved that particular issue, yup!
For certain input, a response packet whose size is greater than
max_length
is created, throwing an error insession_manager.rb
.Note the "undefined method length" error message is fixed in an existing PR (https://github.com/iagox86/dnscat2/pull/41).
To replicate: 1) download the binary file located here: https://drive.google.com/file/d/0B8q-4HfjZWI7Znl5aHJjbkdRcnM/view?usp=sharing 2) copy it to your clipboard — for instance, use
cat dummyfile8 | pbcopy
if you are using a Mac 3) start up the server withrvmsudo ruby ./dnscat2.rb -u
4) start up the client with ./dnscat --host 0.0.0.0 --port 53 --console 5) paste the contents of the binary file into the console for the server sideThe error is only found for messages from server to client, and not from client to server.