跳到正文
cccskills
免费在 GitHub 公开

aws-imdsv2-ssrf-bypass

Exploit Server-Side Request Forgery (SSRF) vulnerabilities to extract AWS IAM credentials from the Instance Metadata Service version 2 (IMDSv2). This skill details how to bypass the token requirement of IMDSv2 by chaining HTTP verbs (PUT then GET) if the SSRF vulnerability allows full control over the request headers and methods.

中文简介正在准备中。当前显示原文说明。

集成工具AWS
查看安装方法

包含的文件(3)

  • SKILL.md5.1 KB
  • evals/evals.json530 B
  • scripts/process.py7.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

AWS IMDSv2 SSRF Bypass

When to Use

  • When you have identified an SSRF vulnerability on an AWS EC2 instance, but IMDSv1 is disabled, and the service requires IMDSv2 tokens.
  • When the SSRF vector gives you enough control to issue a PUT request and specify custom HTTP headers.

Prerequisites

  • Authorized scope and rules of engagement for the target environment
  • Appropriate tools installed on the attack/analysis platform
  • Understanding of the target technology stack and architecture
  • Documentation template ready for findings and evidence capture

Workflow

Phase 1: Identifying the Restriction

Attempting a standard IMDSv1 request to http://169.254.169.254/latest/meta-data/ yields a 401 Unauthorized or requires a token. This confirms IMDSv2 is enforced.

Phase 2: Generating the Token (The PUT Request)

IMDSv2 requires a session token. You must use the SSRF to send a PUT request to /latest/api/token with the header X-aws-ec2-metadata-token-ttl-seconds.

# Concept: Push the SSRF payload to request the token PUT /latest/api/token HTTP/1.1
Host: 169.254.169.254
X-aws-ec2-metadata-token-ttl-seconds: 21600

Note: If the SSRF only allows GET requests, bypassing IMDSv2 via this specific method is generally not possible unless you have header injection/request smuggling.

Phase 3: Extracting Metadata (The GET Request)

If Phase 2 succeeds, the response will contain the token string (e.g., AQAAAHN...). You must then issue a second SSRF request (a GET request) to the metadata endpoint, injecting the acquired token via the X-aws-ec2-metadata-token header.

# GET /latest/meta-data/iam/security-credentials/ HTTP/1.1
Host: 169.254.169.254
X-aws-ec2-metadata-token: AQAAAHN...

Phase 4: Looting the IAM Keys

Identify the IAM role name from the previous step, then extract the temporary credentials.

# GET /latest/meta-data/iam/security-credentials/<ROLE_NAME> HTTP/1.1
Host: 169.254.169.254
X-aws-ec2-metadata-token: AQAAAHN...

Configure your local AWS CLI with the retrieved AccessKeyId, SecretAccessKey, and Token.

Decision Point 🔀

flowchart TD
    A[Discover SSRF ] --> B{IMDS Version? ]}
    B -->|IMDSv1| C[Direct GET Request ]
    B -->|IMDSv2| D{SSRF Allows PUT & Headers? }
    D -->|Yes| E[Send PUT to get Token ]
    D -->|No| F[Bypass Failed - IMDSv2 Secure ]
    E --> G[Send GET with Token Header ]
    C & G --> H[Extract Credentials ]

🔵 Blue Team Detection & Defense

  • Enforce IMDSv2 Globally: Restrict Hop Limit: Limit IAM Roles on EC2: Key Concepts | Concept | Description | |---------|-------------|

Output Format

Aws Imdsv2 Ssrf Bypass — Assessment Report
============================================================
Target: [Target identifier]
Assessor: [Operator name]
Date: [Assessment date]
Scope: [Authorized scope]
MITRE ATT&CK: [Relevant technique IDs]

Findings Summary:
  [Finding 1]: [Severity] — [Brief description]
  [Finding 2]: [Severity] — [Brief description]

Detailed Results:
  Phase 1: [Phase name]
    - Result: [Outcome]
    - Evidence: [Screenshot/log reference]
    - Impact: [Business impact assessment]

  Phase 2: [Phase name]
    - Result: [Outcome]
    - Evidence: [Screenshot/log reference]
    - Impact: [Business impact assessment]

Risk Rating: [Critical/High/Medium/Low/Informational]
Recommendations:
  1. [Immediate remediation step]
  2. [Long-term hardening measure]
  3. [Monitoring/detection improvement]

📚 Shared Resources

For cross-cutting methodology applicable to all vulnerability classes, see:

References

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Exploit pervasive logical flaws in Multi-Factor Authentication (MFA/2FA) implementations to bypass the secondary authentication challenge entirely. Techniques include response manipulation, referal spoofing, token reuse, and predictable backup codes.

中文简介正在准备中。当前显示原文说明。

ShulkwiSEC/bb-huge232026年7月11日 更新

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

中文简介正在准备中。当前显示原文说明。

ShulkwiSEC/bb-huge232026年7月11日 更新

Complete PortSwigger deep-dive with exact payloads for every lab variant including zero-day techniques

中文简介正在准备中。当前显示原文说明。

ShulkwiSEC/bb-huge232026年7月11日 更新

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

中文简介正在准备中。当前显示原文说明。

ShulkwiSEC/bb-huge232026年7月11日 更新

Execute AS-REP Roasting to extract and crack the NTLM hashes of Active Directory user accounts that have the "Do not require Kerberos preauthentication" flag explicitly enabled. This attack generates a recoverable Ticket Granting Ticket (TGT) without requiring the attacker to authenticate first.

中文简介正在准备中。当前显示原文说明。

ShulkwiSEC/bb-huge232026年7月11日 更新

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

中文简介正在准备中。当前显示原文说明。

ShulkwiSEC/bb-huge232026年7月11日 更新

查看 ShulkwiSEC 的全部技能

报告此技能的问题