Giter Club home page Giter Club logo

sliver's Introduction

Sliver

Sliver is an open source cross-platform adversary emulation/red team framework, it can be used by organizations of all sizes to perform security testing. Sliver's implants support C2 over Mutual TLS (mTLS), WireGuard, HTTP(S), and DNS and are dynamically compiled with per-binary asymmetric encryption keys.

The server and client support MacOS, Windows, and Linux. Implants are supported on MacOS, Windows, and Linux (and possibly every Golang compiler target but we've not tested them all).

Release Go Report Card License: GPL v3

v1.6.0 / master

NOTE: You are looking the latest master branch of Sliver v1.6.0; new PRs should target this branch. However, this branch is NOT RECOMMENDED for production use yet. Please use release tagged versions for the best experience.

For PRs containing bug fixes specific to Sliver v1.5, please target the v1.5.x/master branch.

Features

  • Dynamic code generation
  • Compile-time obfuscation
  • Multiplayer-mode
  • Staged and Stageless payloads
  • Procedurally generated C2 over HTTP(S)
  • DNS canary blue team detection
  • Secure C2 over mTLS, WireGuard, HTTP(S), and DNS
  • Fully scriptable using JavaScript/TypeScript or Python
  • Windows process migration, process injection, user token manipulation, etc.
  • Let's Encrypt integration
  • In-memory .NET assembly execution
  • COFF/BOF in-memory loader
  • TCP and named pipe pivots
  • Much more!

Getting Started

Download the latest release and see the Sliver wiki for a quick tutorial on basic setup and usage. To get the very latest and greatest compile from source.

Linux One Liner

curl https://sliver.sh/install|sudo bash and then run sliver

Help!

Please checkout the wiki, or start a GitHub discussion. We also tend to hang out in the #golang Slack channel on the Bloodhound Gang server.

Compile From Source

See the wiki.

Feedback

Please take a moment and fill out our survey

License - GPLv3

Sliver is licensed under GPLv3, some sub-components may have separate licenses. See their respective subdirectories in this project for details.

sliver's People

Contributors

actualtrash avatar audibleblink avatar c-sto avatar cha0tic87 avatar cmprmsd avatar dependabot[bot] avatar dominicbreuker avatar dzflack avatar eriner avatar guervild avatar h4ng3r avatar hypnoticpattern avatar jamesgol avatar kyleavery avatar lesnuages avatar matir avatar maxlandon avatar mdoi12mdjf avatar moloch-- avatar mrale98 avatar mrthe avatar npbf avatar paradoxis avatar r00t0v3rr1d3 avatar rafbishopfox avatar rkervella avatar rwincey avatar timbf avatar tothi avatar usiegl00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sliver's Issues

"One Liners"

Generate one-line commands (e.g. powershell/bash/etc.) to load sliver binaries.

Missing build dependencies/instructions

Heya,

While trying to build the project, I faced several missing dependencies. First example was packr:

$ make
packr clean
make: packr: Command not found
make: *** [Makefile:77: clean] Error 127

Not sure if this has to be mentioned in the build requirements of wrapped up in the go-assets.sh script.
Following things were required for a successful build:

  • Golang packr utility: github.com/gobuffalo/packr/packr
  • protobuf-compiler (protoc command)
  • clone the project into $GOPATH/src/ instead of $GOPATH/src/github.com/bishopfox

Chrome C2

Tunnel C2 thru Chrome using the devtools protocol.

DNS Init Race

sliver > panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x7e5e16]

goroutine 53 [running]:
sliver/server/c2.dnsSessionPoll(0xc00007b6c0, 0xb, 0xc00f9c00f0, 0x3, 0x3, 0x1, 0x3, 0x0, 0x0, 0xc00009abc0)
        /Users/moloch/go/src/sliver/server/c2/udp-dns.go:518 +0x106
sliver/server/c2.handleTXT(0xc00007b6c0, 0xb, 0xc0000261e0, 0x18, 0xc00f9cc000, 0xc00009adc0)
        /Users/moloch/go/src/sliver/server/c2/udp-dns.go:213 +0xca8
sliver/server/c2.handleDNSRequest(0xc00007b6c0, 0xb, 0x9854460, 0xc00ceccf80, 0xc00f9cc000)
        /Users/moloch/go/src/sliver/server/c2/udp-dns.go:131 +0x21f
sliver/server/c2.StartDNSListener.func1(0x9854460, 0xc00ceccf80, 0xc00f9cc000)
        /Users/moloch/go/src/sliver/server/c2/udp-dns.go:104 +0x51
sliver/vendor/github.com/miekg/dns.HandlerFunc.ServeDNS(0xc0000896e0, 0x9854460, 0xc00ceccf80, 0xc00f9cc000)
        /Users/moloch/go/src/sliver/vendor/github.com/miekg/dns/server.go:52 +0x44
sliver/vendor/github.com/miekg/dns.(*ServeMux).ServeDNS(0xc000088340, 0x9854460, 0xc00ceccf80, 0xc00f9cc000)
        /Users/moloch/go/src/sliver/vendor/github.com/miekg/dns/serve_mux.go:128 +0x5d
sliver/vendor/github.com/miekg/dns.(*Server).serveDNS(0xc007699600, 0xc00ceccf80)
        /Users/moloch/go/src/sliver/vendor/github.com/miekg/dns/server.go:687 +0x2c1
sliver/vendor/github.com/miekg/dns.(*Server).serve(0xc007699600, 0xc00ceccf80)
        /Users/moloch/go/src/sliver/vendor/github.com/miekg/dns/server.go:572 +0x2a7
sliver/vendor/github.com/miekg/dns.(*Server).worker(0xc007699600, 0xc00ceccf80)
        /Users/moloch/go/src/sliver/vendor/github.com/miekg/dns/server.go:244 +0x4d
created by sliver/vendor/github.com/miekg/dns.(*Server).spawnWorker
        /Users/moloch/go/src/sliver/vendor/github.com/miekg/dns/server.go:284 +0x86

Implement fail safes to restrict execution on targeted environments

A nice feature to have would be to only execute the payload if a certain set of properties on the target host match our expectations. The idea to restrict execution could help avoid automatic sandbox analysis or executing the sliver on out-of-scope systems.

Such properties could be things like:

  • computer name
  • domain name (when relevant)
  • user name
  • timezone
  • etc.

This would be an optional feature during the payload generation process, and could be handle by a configuration file on the server side of things.

Better Help

Add long-form help and examples to each command.

Unit Tests

We should really write some unit tests ....

Blacklist IP Ranges

Feature to blacklist IP ranges such as Palo Alto networks, or return alternate data to requests originating from blacklisted IP ranges.

For example, instead of returning a DLL for a staged payload request from a blacklisted IP we send back JPGs of memes or /dev/random.

Canary Blue Team Detection

Automatically embed "canaries" into generated binaries to detect detection. For example, embed a random domain should never legitimately be resolved by the sliver implant.

Code refactoring: use the windows syscall API instead of loading kernel32.dll

Some part of the sliver's windows specific code (in handlers_windows.go and ps_windows.go) are using the syscall.MustLoadDLL and syscall.MustFindProc to resolve some kernel32.dll symbols.

This is already covered by the standard Go syscall library for windows, available here. This library implements error checking, and returns the some handy structs such as Handle, or ProcessEntry32.

I think it would be much cleaner to use these API calls instead of resolving this ourselves, and bother with casting and all this boring stuff.

DNS C2 Panics on `nil` DomainKey Response

2019/02/10 07:12:49 udp-dns.go:237: Failed to fetch domain key lookup _dbr7ow.desirable_cake._domainkey.6.bf.mg: dnsquery: This operation returned because the timeout period expired.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x51e191]

goroutine 1 [running]:
crypto/rsa.checkPub(...)
        /Users/moloch/.sliver/go/src/crypto/rsa/rsa.go:75
crypto/rsa.EncryptOAEP(0x72a060, 0xc000426280, 0x727720, 0xc000012110, 0x0, 0xc00000b580, 0x12, 0x12, 0x0, 0x0, ...)
        /Users/moloch/.sliver/go/src/crypto/rsa/rsa.go:377 +0x41
main.RSAEncrypt(0xc00000b580, 0x12, 0x12, 0x0, 0x12, 0x0, 0x0, 0x100000000000000, 0xad)
        /Users/moloch/.sliver/slivers/windows/amd64/DESIRABLE_CAKE/src/sliver/crypto.go:60 +0x9d
main.dnsStartSession(0x6e2dae, 0x7, 0xc0001bded0, 0x1, 0x0, 0x0, 0x0, 0x6f3610)
        /Users/moloch/.sliver/slivers/windows/amd64/DESIRABLE_CAKE/src/sliver/udp-dns.go:205 +0x104
main.dnsConnect(0x0, 0x0)
        /Users/moloch/.sliver/slivers/windows/amd64/DESIRABLE_CAKE/src/sliver/sliver.go:175 +0xd3
main.startConnectionLoop()
        /Users/moloch/.sliver/slivers/windows/amd64/DESIRABLE_CAKE/src/sliver/sliver.go:107 +0xf4
main.main()
        /Users/moloch/.sliver/slivers/windows/amd64/DESIRABLE_CAKE/src/sliver/sliver.go:88 +0xcc

Better Tab Complete

Tab-complete only available commands, add tab complete for local and remote file system paths.

Staged Payloads

Small stubs that just load the DLL / shared library build of Sliver. I'm planning to call these eggs, since in the MtG lore Slivers hatch from eggs :)

Shell generation not working

When I run the following command sliver-server just exits and no shell is generated. This happens with and without the -s argument.

sliver > generate -o linux -m 127.0.0.1 -d -s /home/alxjsn/shell

[*] Generating new linux/amd64 sliver binary 

alxjsn at foxy in ~/go/src/sliver (master●)

Integrated Database

We need a more structured approach for handling data, right now we rely on the filesystem a lot and it's not going to scale well with the code.

Clean Kill Command

Clean kill command implementation that cleans up network connections, optionally deletes it's own binary.

DNS C2 'Failed to decrypt session init msg'

Using generate --dns <domain> --debug for a windows based implant, the following error was observed on the server
...omitted for brevity... INFO[6746] [sliver/server/c2/udp-dns.go:329] RSA Fingerprint: 45S78Cc6Ar9AIXPBbZ2DkgVZVVGf8KrWQa0mNWu6gkA INFO[6746] [sliver/server/c2/udp-dns.go:335] Failed to decrypt session init msg INFO[6746] [sliver/server/c2/udp-dns.go:202] Error during session init: crypto/rsa: decryption error DEBU[6746] [sliver/server/c2/udp-dns.go:238] ;; opcode: QUERY, status: NOERROR, id: 54534 ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ...omitted for brevity...

Sliver compilation issue when using debug mode

Generating a sliver in debug mode using the -d or --debug flag results in the following line being stripped out:
log.SetOutput(ioutil.Discard) - link
As this is the only usage of the ioutil lib in this package, the compiler complains about an unused import when generating in debug mode.

Implementing a dummy Discard writer to get rid of the import could be a solution.

shellcode Command

Implement a shellcode command that just dumps raw shellcode to a file.

Contextual help

It would be nice to have contextual help menus, instead a full list of generic/sliver commands.
I think we could leverage grumble.App.SetPrintHelp to achieve that. The basic idea would be:

  • if there's no active sliver session, only show generic commands
  • otherwise, display commands based on the selected sliver session agent's platform (win/linux/mac os)

Not sure if everything is feasible with grumble, but it's worth a try.

Hosting .NET CLR in the sliver agent

It would be nice to be able to load arbitrary and execute .NET assemblies in the sliver agent (a la execute-assembly). There is already some public ground work on this (see here), and after giving it some thoughts, it should be achieved by:

  • compiling the hosting DLL with sRDI
  • inject the shellcode in the current process
  • play with GetProcAddress to retrieve the exported functions
  • profit?

That's the theory, and it still needs to be adapted.

Makefile error in Linux

Error:

$ make static-linux                                                             
echo 'package assets\n\nconst GitVersion = ""\n' > ./server/assets/version.go 
packr clean
rm -f ./protobuf/client/*.pb.go
rm -f ./protobuf/sliver/*.pb.go
rm -f sliver-client sliver-server *.exe
echo 'package assets\n\nconst GitVersion = "74be4e381206883cb330d9a56688478649e5a0c0"\n' > ./server/assets/version.go 
go install ./vendor/github.com/golang/protobuf/protoc-gen-go
protoc -I protobuf/ protobuf/sliver/sliver.proto --go_out=protobuf/
protoc -I protobuf/ protobuf/client/client.proto --go_out=protobuf/
cd ./server/
packr
Error: /home/alxjsn/go/src/sliver/server/assets/version.go:1:15: illegal character U+005C '\' (and 2 more errors)
Usage:
  packr [flags]
  packr [command]

Available Commands:
  build       Wraps the go build command with packr
  clean       removes any *-packr.go files
  help        Help about any command
  install     Wraps the go install command with packr
  version     prints packr version

Flags:
  -z, --compress       compress box contents
  -h, --help           help for packr
  -i, --input string   path to scan for packr Boxes (default "/home/alxjsn/go/src/sliver")
  -v, --verbose        print verbose logging information

Use "packr [command] --help" for more information about a command.

make: *** [Makefile:70: packr] Error 255

Versions:

$ make --version
GNU Make 4.2.1

$ /bin/echo --version
echo (GNU coreutils) 8.30

Fix: Using the -e argument for echo in Linux fixes the issues and parses the newlines properly.

Infinite Loop on Sliver Reconnect

Occasionally when reconnecting the Sliver binary will enter an infinite loop and consume 100% CPU. I suspect this is related to start() returning nil instead of error which results in the maxConnectionErrors limit never being reached.

Protobuf Dependency Management

the packaged github.com.zip containing the protobuf dep was not matching the protoc-gen-go lib I had on my system, and building the agent always failed with the following error:

undefined: proto.ProtoPackageIsVersion3

I had to repackage the dep with a fresher version of the protobuf lib.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.