See the reference image below. When issuing commands to a bash shell via a netcat connecting using UDP only the first character of the command seems to make it to the server. Moreover, after entering the command a second newline is required.

Why does this behavior occur? What is the proper way to create a shell using netcat+udp?

Example of broken UDP behavior

I'm using GNU Netcat 0.7.1 by Giovanni Giacobbi

  • What version of Linux are you using for this? Netcat is a bit different across the various distributions and can effect the behavior of some flags. – Mark Davidson Mar 22 '11 at 16:02
  • Trying the flags you are using with /bin/nc.traditional under Ubuntu I get nothing when using the UDP flag not the single character issue you are seeing. But works fine with TCP. – Mark Davidson Mar 22 '11 at 16:19

Have a quick look at a related netcat query on serverfault here - this may help. UDP does not behave as well as TCP.


"iodine lets you tunnel IPv4 data through a DNS server. This can be usable in different situations where internet access is firewalled, but DNS queries are allowed."


  • 1
    Thanks for the info. iodine looks like an interesting tool. However in this case I want to know the technical reason for netcat's strange behavior, I'm not looking for alternatives. – Casey Mar 23 '11 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.