May 2, 2021 in Living off the land, LOLBins
This post wraps up another Twitter thread I started a few days ago:
If you ever get bored using “copy” to copy files you can always use … curl:
curl file://c:\test\foo -o bar
Same way, you can use it instead of “type” or “cat”
curl file://c:\test\foo
You can also copy file by… uploading it locally
curl -T bar file://c:\test\
this will copy “bar” file to “c:\test\bar”.
And during copying, you can stat copying at a given offset:
and even cooler, you can extract any part of the file using range
curl file://c:\test\foo -C 1
dynamic payload building anyone?
and even cooler, you can extract any part of the file using range
curl file://c:\test\foo -r2-10
offering a chance to build dynamic payloads.
The operation is surgical and using Procmon we can confirm it reads only these two specific bytes:
@nf3xn added one more interesting option:
curl --remote-time file://c:\test\foo -o bar
to preserve file timestamps.