一个基于终端的AWS安全扫描器,拥有102+项安全检查,涵盖VPC、IAM、S3、CloudTrail、容器(ECS/EKS)以及AI攻击检测。能够检测危险的IAM权限、暴露的密钥、配置错误的S3存储桶、容器漏洞以及新兴的LLM劫持威胁。
一个基于终端的 AWS 安全扫描器,包含 100+ 项安全检查,覆盖 VPC、IAM、S3、CloudTrail、容器(ECS/EKS)及 AI 攻击检测。可检测危险的 IAM 权限、暴露的密钥、配置错误的 S3 存储桶、容器漏洞以及新兴的 LLMjacking 威胁。
产品概览:docs/CAPABILITIES_OVERVIEW.md
*:*).env、.git、凭证)基于 2025 年 2 月威胁情报:8 分钟 AWS 入侵
| 类别 | 数量 |
|---|---|
| 核心(IAM、VPC、S3、CloudTrail、密钥) | 38 |
| 扩展(Lambda、ELB、Route53、Inspector 等) |
# macOS
brew install awscli
# Linux
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install
aws configure
# 或使用命名配置文件
aws configure --profile myprofile
您的 AWS 凭证必须对要扫描的服务拥有只读访问权限。AWS 托管策略 ReadOnlyAccess 即可,或参阅下面的所需权限。
注意:aws-perimeter 仅执行读取操作,绝不会修改您的 AWS 资源。
curl -sSfL https://raw.githubusercontent.com/thirukguru/aws-perimeter/main/install.sh | sh
go install github.com/thirukguru/aws-perimeter@latest
aws-perimeter # 运行完整安全扫描
aws-perimeter --output json # JSON 输出
aws-perimeter --profile prod # 指定 AWS 配置文件
aws-perimeter --region us-west-2 # 指定区域
aws-perimeter --regions us-east-1,us-west-2 # 多区域扫描
aws-perimeter --regions us-east-1,us-west-2 --max-parallel 4 # 多区域扫描并控制并发
aws-perimeter --regions us-east-1,us-west-2 --max-parallel 4 --best-effort # 如果至少一个区域成功则退出成功
aws-perimeter --rules # 将 RULES.md 输出到 stdout(Markdown)
aws-perimeter --capabilities # 将能力概述输出到 stdout(Markdown)
aws-perimeter --all-regions # 扫描所有已启用区域
aws-perimeter --org-scan --org-role-name OrganizationAccountAccessRole # 多账号组织扫描
aws-perimeter --org-scan --max-parallel 5 # 组织+区域并发扇出
aws-perimeter --output html --output-file report.html # 生成 HTML 报告
aws-perimeter --store --profile prod --region us-west-2 # 运行并持久化扫描结果
aws-perimeter --trends --trend-days 30 --account-id 123456789012 # 显示历史趋势表
aws-perimeter history list --db-path ~/.aws-perimeter/history.db
aws-perimeter dashboard --port 8080
对于扇出模式(--regions、--all-regions、--org-scan)配合 --output html --output-file ...,aws-perimeter 会为每个扫描单元写入一份报告,文件名包含区域/账号及时间戳后缀(例如 security-report-us-east-1-20260210-213045.html 或 security-report-123456789012-us-east-1-20260210-213045.html)。
在 HTML 模式下,终端表格输出会被抑制,仅打印简洁的摘要行。
当使用 --output json 时,aws-perimeter 输出一个有效的单一 JSON 文档,不含横幅或旋转动画,因此适用于管道。
aws-perimeter --profile prod --region us-west-2 --output json | jq .
# 多区域 JSON 输出一个聚合的顶层 JSON 文档:
aws-perimeter --profile prod --regions us-east-1,us-west-2 --output json | jq .
# 通过 stdout 重定向导出文档
aws-perimeter --rules > rules.md
aws-perimeter --capabilities > capabilities.md
多区域 JSON 负载包括:
summary(total_regions、success、failed、skipped)results(每个区域的整合扫描负载)failures(区域扫描失败时的区域及错误详情)对于非 JSON 输出模式下的多区域和组织扫描,aws-perimeter 会在执行结束时打印汇总摘要:
account_id、account_name、region、status、duration 和 error。TOTAL、SUCCESS、FAILED、SKIPPED)。--max-parallel 和 --best-effort--max-parallel 控制扇出模式(--regions、--all-regions、--org-scan)中并发运行的区域/账号扫描单元数量。--max-parallel 3 或 --max-parallel 4。--best-effort 适用于多区域扫描:当至少一个区域成功时,命令以成功(0)退出,即使部分区域失败。--best-effort 时,任何区域失败都会返回非零退出码。failures 字段中显示具体错误。以下权限需要完整功能覆盖(包括多区域和组织扫描):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sts:GetCallerIdentity",
"sts:AssumeRole",
"organizations:DescribeOrganization",
"organizations:ListAccounts",
"ec2:Describe*",
"ec2:GetEbsEncryptionByDefault",
"iam:List*",
"iam:Get*",
"iam:GenerateCredentialReport",
"s3:ListAllMyBuckets",
"s3:GetBucket*",
"s3:GetEncryptionConfiguration",
"cloudtrail:DescribeTrails",
"cloudtrail:GetTrailStatus",
"cloudtrail:LookupEvents",
"lambda:ListFunctions",
"lambda:GetFunctionConfiguration",
"lambda:GetFunction",
"ecr:DescribeRepositories",
"ecr:DescribeImages",
"ecr:BatchGetImage",
"ecr:GetDownloadUrlForLayer",
"ecs:ListClusters",
"ecs:DescribeClusters",
"ecs:ListServices",
"ecs:DescribeServices",
"ecs:DescribeTaskDefinition",
"eks:ListClusters",
"eks:DescribeCluster",
"eks:ListNodegroups",
"eks:DescribeNodegroup",
"bedrock:ListProvisionedModelThroughputs",
"bedrock:ListCustomModels",
"bedrock:GetModelInvocationLoggingConfiguration",
"guardduty:ListDetectors",
"guardduty:GetDetector",
"guardduty:ListFindings",
"guardduty:GetFindings",
"securityhub:DescribeHub",
"securityhub:GetFindings",
"config:Describe*",
"kms:ListKeys",
"kms:DescribeKey",
"kms:GetKeyRotationStatus",
"kms:Decrypt",
"rds:DescribeDB*",
"dynamodb:ListTables",
"dynamodb:DescribeTable",
"dynamodb:DescribeContinuousBackups",
"secretsmanager:ListSecrets",
"elasticloadbalancing:Describe*",
"backup:List*",
"apigateway:GET",
"cloudfront:List*",
"cloudfront:Get*",
"cloudwatch:GetMetricStatistics",
"sns:ListTopics",
"sqs:ListQueues"
],
"Resource": "*"
}
]
}
kms:Decrypt 仅在扫描加密对象/包时需要(例如 SSE-KMS S3 对象读取)。在生产环境中,将其限定到所需的 KMS 密钥。
对于 --org-scan,管理委托方必须允许承担成员账号角色(默认:OrganizationAccountAccessRole),例如:
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::*:role/OrganizationAccountAccessRole"
}
成员账号角色信任策略也必须允许您的扫描委托方(用户/角色)承担该角色(如果使用 --external-id,还需包含 sts:ExternalId 条件)。
提示:如需快速开始,请将 AWS 托管策略
arn:aws:iam::aws:policy/ReadOnlyAccess附加到您的 IAM 用户/角色。
Apache License 2.0
| 35 |
| 容器安全(ECS + EKS) | 22 |
| AI 攻击检测 | 7 |
| 总计 | 102 |
| 检查项 | 严重级别 | 描述 |
|---|
| 权限提升 | 🔴 严重 | 用户可提升至管理员 |
| 管理员访问(:) | 🔴 严重 | 授予完全 AWS 访问权限 |
| 暴露的密钥 | 🔴 严重 | Lambda/EC2 中的 API 密钥/令牌 |
| 公开 S3 存储桶 | 🔴 严重 | 存储桶可公开访问 |
| 无 CloudTrail | 🔴 严重 | 无审计日志 |
| 开放的 SSH/RDP | 🔴 严重 | 端口 22/3389 开放至互联网 |
| 特权容器 | 🔴 严重 | ECS 容器具有 root 访问权限 |
| GPU IMDSv1 | 🔴 严重 | GPU 实例的凭证存在风险 |
| 跨账号信任 | 🟠 高 | 外部账号可承担角色 |
| EKS 公开端点 | 🟠 高 | Kubernetes API 可公开访问 |
| Bedrock 无日志记录 | 🟠 高 | AI 模型使用未审计 |
| 标志 | 缩写 | 描述 |
|---|
--profile | -p | 使用的 AWS 配置文件 |
--region | -r | AWS 区域 |
--regions | 逗号分隔的区域列表 | |
--all-regions | 扫描所有已启用区域 | |
--org-scan | 扫描所有活跃的 AWS 组织账号 | |
--org-role-name | 在成员账号中承担的 IAM 角色名称 | |
--external-id | 跨账号角色承担的外部 ID | |
--output | -o | 输出格式:table、json 或 html |
--rules | 输出规则目录 Markdown 并退出 | |
--capabilities | 输出能力 Markdown 并退出 | |
--output-file | -f | 输出文件(HTML 必需) |
--store | 将扫描结果持久化到 SQLite | |
--db-path | 自定义 SQLite 数据库路径 | |
--trends | 显示历史趋势 | |
--trend-days | 趋势窗口天数(默认30) | |
--compare | 比较两次最近的扫描 | |
--export-json | 导出趋势 JSON 文件 | |
--export-csv | 导出趋势 CSV 文件 | |
--account-id | 趋势/历史的账号过滤器 | |
--max-parallel | 最大并发区域/账号扫描单元数 | |
--best-effort | 多区域扫描:至少一个区域成功则返回成功 | |
--dry-run | 修复预览模式 | |
--remediate | 应用支持修复 | |
--dashboard-port | 仪表板端口(根标志;dashboard 子命令使用 --port) | |
--version | -v | 版本信息 |
| 阶段 | 状态 | 规则数 |
|---|
| 阶段 1 | ✅ 完成 | 73 |
| 阶段 2 | 🔲 进行中 | +20 |
| 阶段 2.5 | 🆕 AI 攻击检测 | +13 |
| 阶段 3 | 🔲 计划中 | +15 |
| 阶段 4 | 🔲 计划中 | 功能 |