Skip to content

Instantly share code, notes, and snippets.

@nikolabura
Created September 21, 2021 01:31
Show Gist options
  • Save nikolabura/3805fb22b9077c515450421eee3d2df8 to your computer and use it in GitHub Desktop.
Save nikolabura/3805fb22b9077c515450421eee3d2df8 to your computer and use it in GitHub Desktop.
Clumsy socat authentication
Almost certainly vulnerable; kind of neat anyways. DO NOT USE for anything important.
# vvvv<-PORT PASSWORD->vvvvvvvv vvvv<-SECURE COMMAND
socat tcp-listen:8080,reuseaddr,fork system:"head -n 1 | grep -q '^password' && date"
Connecting:
$ echo password | nc remote 8080 # succeeds
Mon Sep 20 21:29:36 EDT 2021
$ echo notthepassword | nc remote 8080 # fails
$ echo passwordaaaaaa | nc remote 8080 # still succeeds with extra content following... use $ in grep to prevent
Mon Sep 20 21:29:47 EDT 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment