Giter Club home page Giter Club logo

sshdropper's Introduction

SSHDropper

PoC (i.e. not great) worm which spreads via SSH and drops malware.

Features:

  • Password auth using one username/password pair
  • Compile-time configuration
  • Attacks 10.0.0.0/8
  • Heartbeat messages via DNS queries
  • Drops and runs a payload

This was written to showcase go for a talk entitled "Hands-On Writing Malware in Go" at BSidesDC2019. While it would probably work in some real environments, it is probably not the worm you're looking for. Move along.

Configuration

The configurable parameters are all in a fairly large var block near the top of the source. Only the username and password will probably need to be changed. These can be set at compile-time by using the linker's -X flag, something like

go build -ldflags "-X main.username=harpo -X main.password=swordfish"

Dropping a Payload

By default, the dropped payload will just send date's output to /tmp/t. This is probably good for a quick (and safeish) PoC. A better payload can be added by removing the last line (const payload = "#!/bin/sh\ndate > /tmp/t") and appending a binary encoded as a string. A perl snippet is included in the source to make this a bit easier. It should be used something like

ed sshdropper.go
4394
$
const payload = "#!/bin/sh\ndate > /tmp/t"
d
wq
4351
$ perl -E '$"="\\x";$/=\16;say q{const payload = "" +};say qq{\t"\\x@{[unpack"(H2)*"]}` +}for(<>);say qq{\t""}' <./payload >>sshdropper.go

The downside to appending several hundred thousand lines of code is that some editors tend to not do well with really long files. ed(1) can be used to remove the appended payload. In fact, this worm was written entirely with ed(1).

Shortcomings

As this worm was meant to demonstrate using Go rather than be an off-the-shelf solution for malware propagation, it has a few shortcomings:

  • It tries random addresses in 10.0.0.0/8. There's no good way to change this

  • It only tries a single username/password pair and only with password auth

  • It listens on a set port (31337) to keep multiple instances from running which is a bit racy

  • It has no good way to let anybody know it's done anything except the regular DNS heartbeats

  • It makes regular DNS heartbeats which can be signatured

  • It leaves artifacts in /tmp

  • It writes logs to stderr

  • Linux-only as it relies on /proc/self/exe

sshdropper's People

Contributors

magisterquis avatar

Stargazers

 avatar Ariel Lahiany avatar O.T Osman avatar  avatar Paul Pierre avatar Bjørn Tore Svinningen avatar  avatar Rick Blundell avatar r0lan avatar Carson Seese avatar

Watchers

 avatar James Cloos avatar

Forkers

f4rs33r

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.