reverse_ssh icon indicating copy to clipboard operation
reverse_ssh copied to clipboard

Busybox embedding

Open lachlan2k opened this issue 2 years ago • 1 comments

It would be cool to embed the busybox toolkit in a way it could be used as a fallback shell. This is useful if you're popping a lightweight/distroless container with limited or no tooling, or, if you don't want to invoke any of the existing tools on a box.

lachlan2k avatar Apr 18 '22 22:04 lachlan2k

Yep! This is a great idea, probably only a linux feature at the moment however.

I'll probably use the busybox statically compiled binaries and embed them into the server, if the client binary cant find a shell to work from then it'll stream it and use memfd (or write to disk and delete) to execute things.

NHAS avatar Apr 19 '22 05:04 NHAS

Sweet, as per our conversation.

With the current work to allow users to specify their own shell/command paths with pty we've decided to add URI handlers to allow things to get pulled from remote or embedded sources.

E.g

connect --shell rssh://locally-embed-thing <client>
ssh -J your.rssh.server <client> https://thing.here/path/to/exe

NHAS avatar Oct 18 '22 22:10 NHAS

Can you confirm the example command will transfer the file to remote memory and execute it from memory without issuing a write to file system?

Zulgrib avatar Nov 03 '22 10:11 Zulgrib

Hi there @Zulgrib,

This feature is planned, but not yet implemented. When this is complete the aim will be to have payloads execute directly from memory on linux platforms.

NHAS avatar Nov 04 '22 23:11 NHAS

I've added babies first version of this to the unstable branch. At the moment it only supports http/https and write the executable to disk. Feel free to check it out and see if the syntax is all good for you folk, then I'll get to work implementing the full thing.

NHAS avatar Nov 14 '22 07:11 NHAS

rssh:// handler now exists which can take things directly from the server

NHAS avatar Nov 15 '22 06:11 NHAS

All URI scheme handlers now automatically write to a memfd descriptor when possible meaning this is now fully fileless on linux

NHAS avatar Nov 19 '22 05:11 NHAS