Nmap Development mailing list archives
nc -kle 'cat largefile' doesn't transmit correctly
From: Tobias Girstmair <t-nmap () girst at>
Date: Sat, 27 Nov 2021 20:13:51 +0100
Hi folks, I'm using ncat as a simple web server, as described in https://nmap.org/ncat/guide/ncat-tricks.html#ncat-httpserv . The file I'm serving is relatively large (80kB), and I noticed that it gets mangled very often: a section of over a kilobyte is missing from the middle (at packet boundaries; e.g. after 44888 bytes using 1448 sized packets). This seems to only happen when using --exec or --sh-exec; not when piping the same file in through stdin. It also only happens on 'real' networks (i.e., not loopback). I've tested 7.50 from centos7, 7.91 from voidlinux and fedora35, as well as todays' svn/git version, git commit 158c2e4. Steps to reproduce: 1. generate a large file (`head -c100000 /dev/urandom > largefile`) and share it between server and client 2. on the server side, run `ncat -kle '/bin/cat largefile' 1234` 3. on the client side, run `nc --recv-only server.host 1234 | diff -qs - largefile`. notice the output (might require multiple tries): > Files - and largefile differ > write: Broken pipe 4. alternatively, run `nc --recv-only 10.42.1 1234|wc -c` on the client and notice that the reported bytes will be less than the filesize (e.g. 96688 < 100000). 5. run the following snippets on the server side and repeat; these will work correctly: - `ncat -l 1234 < largefile` - `ncat -klc 'cat largefile; sleep .1' 1234` I'm a bit confused why this happens. Any ideas? Thanks, tobi _______________________________________________ Sent through the dev mailing list https://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- nc -kle 'cat largefile' doesn't transmit correctly Tobias Girstmair (Nov 27)
