Coder Social home page Coder Social logo

attackgithub / fwdsh3ll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dannymas/fwdsh3ll

0.0 2.0 0.0 68 KB

:pager: Forward shell generation framework.

Home Page: https://codeby.net/threads/fwdsh3ll-kogda-reverse-i-bind-ne-smogli-forward-shell-speshit-na-pomosch.65029/

License: GNU General Public License v3.0

Python 100.00%

fwdsh3ll's Introduction

FwdSh3ll

FwdSh3ll Version Python Version License Built with Love

FwdSh3ll is a tiny open source web-payload oriented exploitation-framework for crafting forward shells.

What is a forward shell? Have you ever been caught in a situation when looking for an approach to a CTF box, you discover an RCE vulnerability in a web app but despite that you can't get a reverse shell no matter how hard you try due to strictly filtered outbound traffic? A forward shell is a scheme of shell interaction with a vulnerable Linux machine based on the named pipes mechanism. Check the description for details!

This tool does not claim to provide an all-occasions usage experience out of the box. Each pentest case involes an individual basic enumeration first, whose results may require minor code adjustment.

LEGAL DISCLAIMER: FwdSh3ll was written for use in educational purposes only. Using this tool for attacking web servers without prior mutual consistency can be considered as an illegal activity. It is the final user's responsibility to obey all applicable local, state and federal laws. The author assume no liability and is not responsible for any misuse or damage caused by this tool.

Table of Contents:

Showcase

Demo

This demo is showing the HTB Stratosphere box tomcat user owning.

Description

This method of getting a shell is described in a couple of IppSec's youtube write-ups (VulnHub's Sokar and HTB's Stratosphere). The main idea here is to create a named pipe with mkfifo command and tail -f its input to a /bin/sh process. The output would go into a regular text file which could be simply cat'ted. What is also very cool is that you can move around the filesystem and the shell will remember your current directory as well as spawn other pty shells and so on. Here is how it looks like:

Screenshot

Dependencies

DEB Packages

  • python3.6 (or newer) interpreter

PIP Packages

FwdSh3ll makes use of the following external modules:

To resolve all Python dependencies create a virtual environment and run pip from within:

$ virtualenv -p python3 venv && . venv/bin/activate
(venv) $ pip install -r requirements.txt

Or let the pipenv one-liner do all the dirty work for you:

$ pipenv install && pipenv shell

Usage

usage: FwdSh3ll.py [-h] [-pp PIPES_PATH] [-b64]

non-interactive mode options

optional arguments:
  -h, --help                               show this help message and exit
  -pp PIPES_PATH, --pipes-path PIPES_PATH  set remote path of the named pipes to PIPES_PATH (default: "/dev/shm")

interactive mode options

* Target URL:
    Specify the vulnerable URL to attack.
* Proxy URL (optional):
    Specify proxy if needed.
* Payload:
    Choose required payload from the list.
* Mode (single command vs forward shell):
    Choose required action.

To successfully spawn the forward shell the following stuff should be reachable on the target host:

  • /bin/sh
  • /usr/bin/mkfifo
  • /usr/bin/tail
  • /usr/bin/base64

Payloads

List of RCE vulnerabilities for which payloads are available (will be expanding):

Known Issues

  • If you get the connection timeout error when initializing the forward shell, just rerun the script.
  • Some Linux distributions does not support the /dev/shm path (shared memory, availability depends on kernel config), so if something goes wrong, try changing it to /tmp with -pp switch.
  • When setting the named pipes, the >& file.output syntax for combinig stdout and stderr should be supported by both bash/zsh and (t)csh, but it's not a Bash preferable way though. So there could be issues with the redirection syntax for various shells. Keep that in mind.

Post Scriptum

Special thanks to 0xdf and IppSec for sharing the forward shell concept.

If this tool has been useful for you, feel free to buy me a coffee ☕

Coffee

fwdsh3ll's People

Watchers

 avatar  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.