-
Notifications
You must be signed in to change notification settings - Fork 12
IAM用户验证
iam-user-check用于在授权环境内完成 IAM 身份创建/删除等关键操作,验证 CSPM、CNAPP、CloudTrail / ActionTrail / CloudAudit 等平台能否:
- 检测到新增 / 删除 IAM 用户的身份事件
- 关联登录入口、登录 IP、凭据使用链路
- 触发针对"可疑持久化"的告警规则
- 在调查工作流中还原身份变更的上下文
| 厂商 | add / del | shadow(跨账号角色) | delrole |
|---|---|---|---|
| alibaba | ✓ | ✓ | ✓ |
| tencent | ✓ | ✓ | ✓ |
| aws | ✓ | – | – |
| azure | ✓ | – | – |
| gcp | ✓ | – | – |
| huawei | ✓ | – | – |
| volcengine | ✓ | – | – |
| jdcloud | ✓ | – | – |
| ucloud | ✓ | – | – |
add / del 全 9 家覆盖。跨账号角色(信任策略)的验证目前仍只覆盖阿里云、腾讯云。其他厂商执行 shadow / delrole 会被 provider 拒绝。
通用的角色绑定/解绑(CSPM 视角的"权限变更检测")请走独立的 role-binding-check,全 9 家通用。
创建的用户默认赋予可登录控制台的权限,便于防御方观察完整的登录链路。Azure 走 Microsoft Graph users POST/DELETE,username 需要传完整的 userPrincipalName(如 user@example.com)。GCP 走 service account enable/disable,username 是 SA email 或短名。
ctk > tencent > set payload iam-user-check
payload => iam-user-check
ctk > tencent > set metadata add ctkguest '<your-strong-password>'
metadata => add ctkguest <your-strong-password>
ctk > tencent > show options
Name Current Setting
---- ---------------
accesskey AKIDxxxxxxxxxxxxxxxxxEXAMPLE
metadata add ctkguest <your-strong-password>
payload iam-user-check
provider tencent
region all
secretkey EXAMPLExxxxxxxxxxxxxxxxKEY
token
version Global
ctk > tencent > run
Username Password Login URL
-------- -------- ---------
ctkguest <your-strong-password> https://cloud.tencent.com/login/subAccount/1234567890
i️ 口令建议使用你自己生成的随机强密码。项目配置里预置的默认口令(
config.yaml)只是占位示例,不要在真实验证中直接复用。
ctk > tencent > set metadata del ctkguest
metadata => del ctkguest
ctk > tencent > run
[+] 12:00:00 ctkguest user delete completed.
阿里云、腾讯云支持创建一个被另一个账号信任的角色,用于验证"身份联邦 / 跨账号授权"相关的检测场景。实现原理可参考 常规云服务业务侧攻防视角研究。
ctk > tencent > set metadata shadow ctkrole 111111111111
metadata => shadow ctkrole 111111111111
ctk > tencent > run
清理角色:
ctk > tencent > set metadata delrole ctkrole
metadata => delrole ctkrole
ctk > tencent > run
无人值守模式提供 useradd / userdel 两个 action,便于把"创建测试身份 → 跑检测验证 → 立即清理"串到验证脚本里。属于敏感操作,需 -y / --yes 显式授权:
ctk tencent useradd ctkguest '<strong-password>' -P lab-tencent -y
ctk tencent userdel ctkguest -P lab-tencent -y
执行过程通常会在云审计日志中留下以下事件类别,各厂商字段名会有差异,可作为检测规则/调查查询的锚点:
- IAM 用户创建(
CreateUser/AddUser) - 登录策略附加(
CreateLoginProfile) - 策略授权(
AttachUserPolicy/AttachPolicyToUser) - 角色创建与信任策略(
CreateRole) - 用户/角色删除(
DeleteUser/DeleteRole)
如果这些事件在 CSPM/CNAPP 平台或 SIEM 中缺失、延迟或缺少关键字段(AccessKey、源 IP、UA 等),即说明存在覆盖或上下文完整性缺口。
iam-user-check 在 demo 回放模式下全 9 家可跑通 add / del,无需真实凭据。