thecybermafia/okta-recon
GitHub: thecybermafia/okta-recon
针对 Okta 身份平台的红队评估与配置审计工具包,结合被动图谱采集与主动枚举,支持 BloodHound 导入和多维度攻击路径分析。
Stars: 0 | Forks: 0
# okta-recon
Okta 安全评估工具包,用于授权的红队操作和配置审计。两个互补的脚本涵盖了从被动图谱收集到主动枚举和攻击路径分析的全部范围。
| 脚本 | 所需 Token | 目的 |
|---|---|---|
| `okta_readonly_collector.py` | Read-Only Admin | 兼容 BloodHound 的图谱收集、红队分析、密码喷洒目标导出 |
| `okta_audit.py` | Read-Only Admin 或 Super Admin (取决于命令) | 交互式枚举、审计模块、攻击路径查询 |
## 目录
- [依赖项](#requirements)
- [安装](#installation)
- [认证](#authentication)
- [okta\_readonly\_collector.py](#okta_readonly_collectorpy)
- [收集内容](#what-it-collects)
- [输出文件](#output-files)
- [用法](#usage)
- [标志](#flags)
- [检查点与恢复](#checkpoint-and-resume)
- [速率限制显示](#rate-limit-display)
- [红队报告](#red-team-report)
- [导入 BloodHound](#bloodhound-import)
- [okta\_audit.py](#okta_auditpy)
- [全局标志](#global-flags)
- [输出格式](#output-formats)
- [收集命令](#collection-commands)
- [审计模块](#audit-modules)
- [攻击路径模块](#attack-path-modules)
- [攻击路径方法论](#attack-path-methodology)
- [常见工作流](#common-workflows)
## 依赖项
- Python 3.9+
- Okta SSWS API Token(对于大多数命令,Read-Only Administrator 角色即可满足要求)
```
pip install requests python-dotenv
```
## 安装
```
git clone https://github.com/yourorg/okta-recon
cd okta-recon
pip install requests python-dotenv
```
## 认证
这两个脚本按相同的优先级顺序解析凭据——以最先匹配到的为准:
1. **环境变量**(最高优先级——始终覆盖命令行标志)
2. 工作目录中的 **`.env` 文件**
3. **`--domain` / `--token` CLI 标志**
```
# 选项 1 — 环境变量(推荐)
export OKTA_DOMAIN=https://corp.okta.com
export OKTA_API_TOKEN=00xxxYourTokenHere
# 选项 2 — .env 文件
echo "OKTA_DOMAIN=https://corp.okta.com" >> .env
echo "OKTA_API_TOKEN=00xxx..." >> .env
# 选项 3 — flags (okta_audit.py 也支持 OKTA_AUTH_TYPE=bearer 用于 OAuth 2.0)
export OKTA_AUTH_TYPE=ssws # default
```
当同时设置了环境变量和 CLI 标志时,脚本将打印一条通知:
```
[auth] $OKTA_DOMAIN overrides --domain → https://corp.okta.com
```
## okta\_readonly\_collector.py
一个被动的、兼容 OktaHound 的图谱收集器,专为 **Read-Only Administrator** SSWS Token 设计。生成可直接导入的 BloodHound CE OpenGraph v6 JSON 文件,以及红队发现报告和带评分的密码喷洒目标列表。
### 收集内容
| 数据 | Endpoint |
|---|---|
| 组织信息、联系人、偏好设置 | `/api/v1/org` |
| 所有用户 + 完整配置 | `/api/v1/users` |
| 用户应用链接(可见应用) | `/api/v1/users/{id}/appLinks` |
| 用户 MFA 因素 | `/api/v1/users/{id}/factors` |
| 组 + 描述 | `/api/v1/groups` |
| 组成员 | `/api/v1/groups/{id}/users` |
| 组自动分配规则 | `/api/v1/groups/rules` |
| 应用 + 登录模式 | `/api/v1/apps` |
| 应用用户 + 组分配 | `/api/v1/apps/{id}/users`, `/groups` |
| 应用签名密钥 | `/api/v1/apps/{id}/credentials/keys` |
| 策略 + 规则 + 映射(所有类型) | `/api/v1/policies` |
| 授权服务器 + Scopes + Claims | `/api/v1/authorizationServers` |
| 身份提供者 | `/api/v1/idps` |
| 网络区域 + IP 范围 | `/api/v1/zones` |
| 受信来源 | `/api/v1/trustedOrigins` |
| 事件钩子 + 内联钩子 | `/api/v1/eventHooks`, `/inlineHooks` |
| 已注册设备 + 用户 | `/api/v1/devices` |
| 品牌 + 邮件模板 | `/api/v1/brands` |
| 功能标志 | `/api/v1/features` |
| 日志流 | `/api/v1/logStreams` |
| 风险提供者 | `/api/v1/risk/providers` |
| API Token 元数据 | `/api/v1/api-tokens` |
| 用户类型 + 链接对象定义 | `/api/v1/meta/types/user` |
| OIDC 发现文档(公开) | `/.well-known/openid-configuration` |
**无法使用 Read-Only Token 收集的内容**(将被自动跳过):
- 用户 / 组角色分配——仅限 Super Admin
- OAuth 2.0 Scope 授权——仅限 Super Admin
- 系统日志事件——Log Admin 或 Super Admin
- IAM 自定义角色 / 资源集
### 输出文件
| 文件 | 描述 |
|---|---|
| `okta-graph-readonly_.json` | BloodHound CE OpenGraph v6 — 通过 File Ingest 导入 |
| `okta-inventory_.json` | 原始 API 响应,完整 JSON 转储 |
| `okta-redteam_.txt` | 红队发现报告(12 个类别) |
| `okta-spray-targets_.csv` | 评分的密码喷洒候选列表 |
| `okta-summary_.txt` | 人类可读的收集摘要 |
### 用法
```
# 最小化 — 来自环境的凭证
python okta_readonly_collector.py
# 显式凭证
python okta_readonly_collector.py --domain https://corp.okta.com --token 00xxx
# 跳过 MFA 枚举(更快,无 factor 数据)
python okta_readonly_collector.py --skip-mfa
# 自定义输出目录,完成后压缩
python okta_readonly_collector.py --output ./bh-data --zip
# Debug 模式 — 记录每个 HTTP 请求及其时间和 rate-limit headers
python okta_readonly_collector.py --debug
# 减慢请求速度(在 rate limits 严格时有用)
python okta_readonly_collector.py --jitter 1 3
# 隐藏进度条(用于 CI / 非交互式使用)
python okta_readonly_collector.py --quiet
# 跳过红队报告(仅限 graph + inventory)
python okta_readonly_collector.py --no-redteam
```
### 标志
| 标志 | 默认值 | 描述 |
|---|---|---|
| `--domain` / `-d` | — | Okta 组织 URL。被 `$OKTA_DOMAIN` 覆盖 |
| `--token` / `-t` | — | SSWS API Token。被 `$OKTA_API_TOKEN` 覆盖 |
| `--output` / `-o` | `./output` | 输出目录 |
| `--skip-mfa` | off | 跳过单用户因素枚举(更快) |
| `--skip-factors` | off | `--skip-mfa` 的别名 |
| `--no-redteam` | off | 跳过红队报告和喷洒 CSV |
| `--zip` / `-z` | off | 将所有输出压缩为单个 zip 文件 |
| `--jitter MIN MAX` | `0.2 1.2` | 请求延迟范围(以秒为单位)。使用 `0 0` 禁用 |
| `--debug` | off | 记录每个 HTTP 调用及其时间、状态和速率限制头 |
| `--verbosity` / `-v` | `info` | 日志级别:`debug`、`info`、`warning`、`error` |
| `--quiet` / `-q` | off | 隐藏实时进度条 |
### 检查点与恢复
收集状态在每完成一个步骤后保存。如果运行因任何原因被中断,脚本将保存一个检查点并干净地退出。在下一次运行时,它会检测到该文件并询问:
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CHECKPOINT DETECTED
File : ./output/okta-checkpoint-corp-okta-com.json
Saved : 2025-05-06T14:22:11+00:00
Steps completed: org, users, user_applinks, groups, group_members
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Resume from checkpoint? [y]es / [n]o (start fresh):
```
**触发自动保存并优雅退出的情况:**
| 触发器 | 行为 |
|---|---|
| 重试 6 次后 HTTP 429 耗尽 | 保存检查点 → 附带恢复说明退出,退出码为 1 |
| 网络连接丢失 | 保存检查点 → 退出,退出码为 1 |
| `Ctrl-C` (SIGINT) | 保存检查点 → 退出,退出码为 1 |
| `SIGTERM` (kill) | 保存检查点 → 退出,退出码为 1 |
| 正常完成 | 检查点自动删除 |
检查点文件使用原子性的 `tmp → replace` 写入方式,以防止在强杀时发生数据损坏。
### 速率限制显示
Okta 在每次响应中都会零成本返回速率限制头(`X-Rate-Limit-Remaining`、`X-Rate-Limit-Limit`、`X-Rate-Limit-Reset`)。进度条会读取它们并在线显示实时的消耗情况:
```
[████████████░░░░░░░░] 8/19 ── App assignments + signing keys 00:34 🟡 RL 47/600 (7%) resets 18s
↳ app-details: 80/200 (40%) 3.1/s eta 37s │ 🟡 RL 47/600 (7%) resets 18s
```
| 图标 | 含义 |
|---|---|
| 🟢 | 剩余 ≥ 40% 的窗口额度 |
| 🟡 | 剩余 10–39% |
| 🔴 | 剩余 < 10% — 即将保存检查点 |
### 红队报告
`okta-redteam_.txt` 包含 12 个分析部分:
1. **凭据攻击面** — 没有 MFA 的活跃用户、仅使用弱 MFA(SMS/email)的用户、休眠账户(>90 天)、PASSWORD_EXPIRED 账户
2. **特权账户暴露** — 位于管理员命名组中的用户,并与 MFA 状态进行交叉比对
3. **服务 & 机器账户** — 通过模式匹配且没有 MFA 的账户
4. **策略弱点 & MFA 绕过路径** — 不需要 MFA 的活跃规则,列出带有 IP 范围的网络区域 MFA 豁免情况
5. **组规则提权** — 基于用户配置属性自动将用户分配到管理员组的活跃规则
6. **OAuth & API 客户端风险** — 隐式授权、ROPC、通配符重定向 URI、没有 PKCE 的公共客户端
7. **授权服务器分析** — `ALL_CLIENTS` 策略,`offline_access` Scope 暴露情况
8. **外部 IdP 风险** — 社交 IdP(Google、Facebook、Apple),SAML2/OIDC 联邦链
9. **受信来源 & CORS** — 广泛的或带通配符且启用了 CORS 的来源
10. **钩子 & Webhook 攻击面** — 内联钩子(认证期间的代码执行),外部 Endpoint 清单
11. **API Token 暴露** — 所有 Token 的元数据,使用时间分析
12. **传统应用暴露** — SWA/password-vault 应用,直接的用户分配
`okta-spray-targets_.csv` 包含带评分的候选对象(ACTIVE + PASSWORD_EXPIRED 用户),列包括:`login`、`display_name`、`status`、`last_login_days`、`password_age_days`、`mfa_enrolled`、`mfa_types`、`has_strong_mfa`、`admin_groups`、`department`、`title`、`risk_score`、`risk_reasons` — 按风险从高到低排序。
### 导入 BloodHound
1. 打开 BloodHound CE → **Administration** → **File Ingest**
2. 上传 `okta-graph-readonly_.json`
3. 安装自定义节点 Schema:在 **Custom Node Kinds** 下上传 `bh-okta-custom-nodes.json`(一次性设置)
带有图标渲染的节点类型:`Okta_Organization`、`Okta_User`、`Okta_Group`、`Okta_Application`、`Okta_Device`、`Okta_Policy`、`Okta_PolicyRule`、`Okta_AuthorizationServer`、`Okta_IdentityProvider`、`Okta_NetworkZone`、`Okta_Role`、`Okta_RoleAssignment`
## okta\_audit.py
一个交互式的、命令驱动的审计和枚举工具。支持多种输出格式、代理路由以及广泛的攻击路径分析模块。每个子命令都直接映射到一个或多个 Okta Admin API Endpoint。
### 全局标志
全局标志**必须放置在**子命令之前:
```
python okta_audit.py [global flags] [command flags]
```
| 标志 | 默认值 | 描述 |
|---|---|---|
| `--format pretty\|json\|html\|bloodhound` | `pretty` | 输出格式 |
| `--jitter MIN MAX` | `0.5 2.0` | 请求之间的秒数 |
| `--proxy URL` | — | HTTP 或 SOCKS5 代理(例如 `http://127.0.0.1:8080`) |
| `--dry-run` | off | 打印 API 调用而不实际执行它们 |
| `--user-agent "UA"` | 轮换 | 覆盖 User-Agent 标头 |
| `--output FILE` | stdout | 将输出写入文件 |
| `--title "..."` | — | HTML 输出的报告标题 |
### 输出格式
**`pretty`** — 人类可读的、便于 grep 的终端输出(默认)
**`json`** — 每个结果为一个 JSON 对象,适用于日志管道(Splunk、Elastic):
```
python okta_audit.py --format json audit-mfa --mfa-less-admins | your-log-shipper
```
**`html`** — 自包含的可搜索 HTML 报告,带有实时搜索、高风险行高亮显示和严重性标签计数:
```
python okta_audit.py --format html audit-mfa --mfa-less-admins > report.html
```
**`bloodhound`** — 输出 BloodHound CE OpenGraph v6 JSON 文件:
```
python okta_audit.py --format bloodhound users groups > okta_graph.json
# 通过 File Ingest 导入 BloodHound CE
```
### 收集命令
#### 身份
| 命令 | 描述 |
|---|---|
| `who` | API Token 身份 |
| `org` | 组织信息 |
| `users [--search EXPR] [--limit N]` | 所有用户 |
| `user --id UID \| --email EMAIL` | 单个用户详情 |
| `user-roles --id UID` | 用户的角色 |
| `user-factors --id UID` | 用户的 MFA 因素 |
| `user-applinks --id UID` | 用户的应用链接 |
| `user-grants --id UID` | 用户的 OAuth 授权 |
| `user-clients --id UID` | 用户的 OAuth 客户端 |
| `user-client-grants --id UID` | 用户的客户端授权 |
| `user-devices --id UID` | 用户的设备 |
| `user-risk --id UID` | 用户的风险评分 |
| `user-classification --id UID` | 用户的风险分类 |
| `user-sessions --id UID` | 用户的活跃会话 |
| `myaccount-phones` | 手机验证器(Token 所有人) |
| `myaccount-webauthn` | WebAuthn 注册(Token 所有人) |
| `myaccount-password-complexity` | 密码策略(Token 所有人) |
| `myaccount-authenticators` | 所有验证器(Token 所有人) |
#### 组
| 命令 | 描述 |
|---|---|
| `groups [--limit N]` | 所有组 |
| `group-members --id GID \| --name NAME` | 组成员 |
| `group-apps --id GID \| --name NAME` | 分配给组的应用 |
| `group-rules` | 所有组自动分配规则 |
| `group-rule --id RID` | 单个组规则详情 |
| `group-owners --id GID \| --name NAME` | 组所有者 |
#### 应用
| 命令 | 描述 |
|---|---|
| `apps [--limit N]` | 所有应用 |
| `app-users --id AID \| --name NAME` | 应用的用户 |
| `app-groups --id AID \| --name NAME` | 分配给应用的组 |
| `oauth-clients [--limit N]` | OAuth 2.0 客户端应用 |
#### 策略
| 命令 | 描述 |
|---|---|
| `policies [--type TYPE] [--all]` | 策略(见下面的策略类型) |
| `policy-rules [--id PID] [--type TYPE] [--all]` | 策略规则 |
| `policy-mappings --id PID` | 策略的应用映射 |
| `device-assurance-policies` | 设备保证策略 (OIE) |
**策略类型:** `OKTA_SIGN_ON`、`MFA_ENROLL`、`ACCESS_POLICY`、`PASSWORD`、`IDP_DISCOVERY`、`PROFILE_ENROLLMENT`
#### 授权 & OAuth
| 命令 | 描述 |
|---|---|
| `auth-servers` | 授权服务器 |
| `auth-server-detail --id ASID` | 带有策略的单个授权服务器 |
| `auth-server-scopes --id ASID` | 授权服务器的 Scope |
| `auth-server-claims --id ASID` | 授权服务器的 Claim |
| `auth-server-policies --id ASID` | 授权服务器的策略 |
| `oidc-discovery [--id ASID]` | OIDC Well-Known 发现文档 |
#### 基础设施
| 命令 | 描述 |
|---|---|
| `devices` | 已注册设备 |
| `idps` | 外部身份提供者 |
| `idp-users --id IDP_ID` | IdP 的用户 |
| `network-zones` | 网络区域 |
| `network-zone --id ZID` | 单个网络区域详情 |
| `trusted-origins` | 受信的 CORS/重定向来源 |
| `authenticators` | 验证器 (OIE) |
#### 钩子 & 集成
| 命令 | 描述 |
|---|---|
| `event-hooks` | 事件钩子 |
| `inline-hooks` | 内联钩子 |
| `agent-pools` | Okta 代理池 |
| `push-providers` | 推送通知提供者 |
| `ssf-stream` | 共享信号框架流 |
| `security-events-providers` | 安全事件提供者 |
| `telephony-providers` | 电话通信提供者 |
#### 组织 & 治理
| 命令 | 描述 |
|---|---|
| `logs [--since ISO] [--q QUERY] [--limit N]` | 系统日志事件 |
| `api-tokens` | SSWS API Token 元数据 |
| `api-token-get --id TID` | 单个 API Token 详情 |
| `log-streams` | 日志流配置 |
| `risk-providers` | 风险提供者 |
| `brands` | 品牌自定义 |
| `features` | 功能标志 |
| `iam-roles` | IAM 自定义角色 |
| `schemas` | 用户配置 Schema |
| `user-types` | 用户类型定义 |
| `org-contacts` | 技术 / 账单联系人 |
| `realms` | Okta Realms |
| `realm-assignments` | Realm 分配策略 |
| `email-domains` | 邮件域配置 |
| `rate-limit-settings` | 速率限制配置 |
| `behavior-rules` | 行为检测规则 |
| `behavior-rule --id BID` | 单个行为规则详情 |
| `captcha-instances` | CAPTCHA 配置 |
| `session-get --id SID` | 单个会话详情 |
| `pam-service-accounts` | PAM 服务账户 |
| `governance-entitlements` | 治理权限包 |
| `governance-bundles` | 治理访问包 |
| `user-lockout-settings` | 账户锁定配置 |
### 审计模块
#### `audit-secrets`
扫描用户配置、应用元数据、组描述和钩子配置以查找敏感关键字(`password`、`secret`、`token`、`credential`、`bypass`、`TODO` 等)。
```
python okta_audit.py --format html audit-secrets > secrets.html
```
#### `audit-mfa`
跨用户和管理员的 MFA 状态分析。
```
# 所有用户的 Factor 注册明细
python okta_audit.py audit-mfa --mfa-types
# 具有弱 MFA 或无 MFA 的管理员(高风险 / 中风险 / 低风险)
python okta_audit.py --format html audit-mfa --mfa-less-admins > mfa.html
```
风险级别:`HIGH` = 没有 MFA 的管理员 · `MEDIUM` = 仅具有软件因素的管理员 · `LOW` = 拥有硬件 Token 的管理员
#### `audit-oauth-clients`
扫描所有 OAuth 2.0 客户端以查找危险的授权类型、通配符重定向 URI 和缺失的 PKCE。
```
python okta_audit.py --format html audit-oauth-clients > oauth.html
```
标志:隐式授权、ROPC(`password` 授权)、通配符重定向 URI、没有 PKCE 的公共客户端、`offline_access` 暴露。
#### `audit-auth-servers`
审查授权服务器配置以查找不安全的 Scope 定义、过于宽松的客户端策略(`ALL_CLIENTS`)以及受众配置错误。
```
python okta_audit.py audit-auth-servers
```
#### `audit-group-rules`
审查组自动分配规则以查找提权路径。标记目标是管理员组且其条件评估为用户可修改的配置属性的规则。
```
python okta_audit.py audit-group-rules
```
#### `audit-hooks`
审查事件钩子和内联钩子以查找外部 Endpoint 暴露和认证弱点。
```
python okta_audit.py audit-hooks
```
#### `audit-trusted-origins`
审查受信来源的 CORS 和重定向范围配置错误、通配符域以及不必要的条目。
```
python okta_audit.py audit-trusted-origins
```
#### `find-privileged`
特权配置审查。
```
# admin / production / sensitive-named 组中的用户
python okta_audit.py find-privileged --privileged-overlap
# 拥有 SUPER_ADMIN / MANAGE_USERS / MANAGE_APPS 权限的用户
python okta_audit.py find-privileged --shadow-admins
```
#### `attack-surface`
策略和应用程序配置差距审查。
```
# 运行所有检查
python okta_audit.py attack-surface
# 特定检查
python okta_audit.py attack-surface --find-weak-policies # MFA-not-required rules
python okta_audit.py attack-surface --find-legacy-apps # SWA / password-vault apps
python okta_audit.py attack-surface --idp-discovery # External IdP federations
```
标记不需要 MFA、网络区域为 `ANYWHERE` 或登录模式为 SWA 的规则。
#### `audit-mfa`、`dormant-accounts`、`password-audit`、`token-audit`
```
# 停用 N 天的账户
python okta_audit.py dormant-accounts --days 90
# 密码策略合规性:复杂性、历史记录、锁定
python okta_audit.py password-audit
# API token 使用期限和所有者分析
python okta_audit.py token-audit
```
### 攻击路径模块
#### `user-footprint --id UID`
单个用户的完整访问清单:组、角色、应用程序、因素、设备、授权。用于权限审查和访问认证。
```
python okta_audit.py user-footprint --id 00u1abcdef
python okta_audit.py user-footprint --email jdoe@corp.com
```
#### `recon-user --id UID`
对单个用户的深度侦察:时间线、组成员资格、应用访问权限、MFA 状态、活跃会话、风险评分、OAuth 授权。
```
python okta_audit.py recon-user --email target@corp.com
```
#### `user-timeline --id UID`
从系统日志重建用户的认证和事件时间线。
```
python okta_audit.py user-timeline --id 00u1abcdef --since 2025-01-01
```
#### `session-audit [--threshold N]`
识别具有来自不同 IP 的 N+ 个并发会话的账户。用于检测凭据共享或活跃的入侵活动。
```
python okta_audit.py session-audit --threshold 5
```
#### `admin-backdoors`
识别非标准的管理员访问路径:具有管理员权限的服务账户、具有管理员 API Scope 的应用、属于多个管理员组的用户以及过期的管理员角色分配。
```
python okta_audit.py --format html admin-backdoors > backdoors.html
```
#### `lateral-movement`
构建组到应用的访问映射,并识别与管理员用户共享组成员资格的低权限用户——这些组提供了横向渗透的路径。
```
python okta_audit.py --format html lateral-movement > lateral.html
```
输出包括:`low_priv_user`、`admin_user`、`shared_groups`、`shared_app_access` 以及格式化的攻击路径字符串。
#### `privesc-paths`
识别提权路线:
- 基于可编辑配置属性自动分配给管理员组的组规则
- 影子管理员(具有等效管理员应用授权的非角色用户)
- 分配给普通用户且具有管理员 API Scope 的应用
```
python okta_audit.py --format html privesc-paths > privesc.html
```
#### `enum-service-accounts`
枚举服务和机器账户:通过模式匹配的用户名、它们的组成员资格、应用访问权限和 MFA 状态。识别高权限服务账户以及没有 MFA 的账户。
```
python okta_audit.py enum-service-accounts
```
#### `recon-full`
按顺序运行所有收集命令并输出单一的结构化数据。适用于完整的一次性转储。
```
python okta_audit.py --format json recon-full > full-dump.json
python okta_audit.py --format html recon-full > full-dump.html
```
## 攻击路径方法论
```
Credential Attack
├── Spray active accounts with no MFA → audit-mfa / spray-targets CSV
├── Phishing proxy (Evilginx2) vs SMS/email MFA → audit-mfa
├── ROPC grant bypass (no MFA check) → audit-oauth-clients
└── Route through trusted-zone IPs → attack-surface / network-zones
Privilege Escalation
├── Profile attribute → group rule → admin group → audit-group-rules / privesc-paths
├── Shadow admin via app API scopes → find-privileged --shadow-admins
└── Stale admin role assignments → admin-backdoors
Lateral Movement
├── Shared group membership (user ↔ admin) → lateral-movement
├── Compromised upstream SAML IdP → audit-trusted-origins / idps
└── SWA app credential harvest → attack-surface --find-legacy-apps
Persistence
├── Long-lived API tokens → token-audit / api-tokens
├── Service account with no MFA + broad access → enum-service-accounts
└── Inline hook implant (code on auth path) → audit-hooks
```
## 常见工作流
### 完整的 HTML 审计套件
```
python okta_audit.py --format html --jitter 1 3 audit-mfa --mfa-less-admins > mfa.html
python okta_audit.py --format html attack-surface > surface.html
python okta_audit.py --format html audit-secrets > secrets.html
python okta_audit.py --format html audit-oauth-clients > oauth.html
python okta_audit.py --format html find-privileged > privesc.html
python okta_audit.py --format html admin-backdoors > backdoors.html
python okta_audit.py --format html lateral-movement > lateral.html
```
### BloodHound 攻击路径图
```
# 完整 graph 收集(read-only token)
python okta_readonly_collector.py --output ./bh-data
# 或通过 okta_audit.py 进行定向收集
python okta_audit.py --format bloodhound users groups > okta_graph.json
# 导入 okta_graph.json: BloodHound CE → Administration → File Ingest
```
### 凭据攻击准备
```
# 使用 read-only token 收集所有内容
python okta_readonly_collector.py --output ./recon
# 检查生成的文件
cat ./recon/okta-redteam_*.txt
# 在电子表格中打开 ./recon/okta-spray-targets_*.csv 或将其提供给 spray 工具
```
### 通过 Burp Suite 代理
```
python okta_audit.py --proxy http://127.0.0.1:8080 --dry-run policies --all
python okta_audit.py --proxy http://127.0.0.1:8080 users
```
### JSON 流传输至 Splunk / Elastic
```
python okta_audit.py --format json audit-mfa --mfa-less-admins | your-log-shipper
python okta_audit.py --format json recon-full | jq . | your-log-shipper
```
### 恢复被中断的收集
```
# 运行在中途中断
python okta_readonly_collector.py --output ./recon
# ... 触及 rate limit,checkpoint 已保存 ...
# 重新运行 — 脚本要求恢复
python okta_readonly_collector.py --output ./recon
# 从 checkpoint 恢复?[y]es / [n]o: y
```
标签:API安全, BloodHound, IAM, JSON输出, Okta, Python, SSWS API, 主动枚举, 反取证, 只读管理员, 图形数据收集, 安全评估, 攻击路径分析, 无后门, 无线安全, 网络安全, 足迹分析, 身份与访问管理, 逆向工具, 隐私保护