Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2018 09:04
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save antirez/0225facc919391b2ec120421b9444304 to your computer and use it in GitHub Desktop.
TripMode TCP out of order bytes reproducing steps

Generate a payload.txt file using this Ruby script:

(1..1000000).each{|i| print "#{i} "}

The file will trivially contain "1 2 3 4 5 ..." so that out of order violations are trivial to spot.

  1. In one terminal open netcat in listen mode: nc -l 6379
  2. In another terminal execute netcat like this: cat payload.txt | nc 6379
  3. In the first terminal you should see like 20796 20797 20798 20799 20800... instead of 1 2 3 ...
  4. Does not happen always, so kill the netcat instances, and GOTO 10 to retry until it happens.

Note: my OSX is not the latest patchlevel, I run 10.13.1

Thanks for TM, it kinda saved my latest weeks of work because at the new office I've no cable connection yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment