# IAM Policy Version

<figure><img src="/files/VvABGGCosQLo8m0km7cQ" alt=""><figcaption><p><a href="https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/access_policies_managed-versioning.html">https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/access_policies_managed-versioning.html</a></p></figcaption></figure>

IAM 고객 관리형 정책을 생성한 뒤 변경하면 기존의 정책을 덮어쓰지 않고 새로운 버전을 생성합니다. 이 기능은 깃허브에서 커밋을 하더라도 기존의 히스토리 내역을 조회하거나 되돌릴 수 있는 것과 유사합니다.

버전은 최대 5개까지 관리할 수 있으며, 이를 초과할 경우 가장 오래된 버전이 자동으로 삭제됩니다.

## Abuse

환경 구성 : [IAM Policy Version](/home-lab/aws/iam-policy-version.md)

<pre class="language-bash"><code class="lang-bash"><strong># 현재 IAM 사용자가 적용받는 IAM Policy 열거
</strong>aws iam list-attached-user-policies --user-name '&#x3C;username>'

<strong># IAM Policy의 ARN을 특정하여 버전 열거
</strong>aws iam list-policy-versions --policy-arn '&#x3C;iam-policy-arn>'

<strong># ARN 하위 특정 버전의 속성 확인
</strong>aws iam get-policy-version --policy-arn '&#x3C;iam-policy-arn>' --version-id '&#x3C;version>'

<strong># 특정 버전을 기본 IAM Policy로 사용
</strong>aws iam set-default-policy-version --policy-arn '&#x3C;iam-policy-arn>' --version-id '&#x3C;version>'
</code></pre>

{% hint style="info" %}
해당 시나리오는 다음과 같은 권한이 요구됩니다.

1. iam:ListAttachedUserPolicies
2. iam:ListPolicyVersions
3. iam:GetPolicyVersion
4. iam:SetDefaultPolicyVersion
   {% endhint %}

## References

{% embed url="<https://docs.aws.amazon.com/ko_kr/IAM/latest/UserGuide/access_policies_managed-versioning.html>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pentestwiki.com/cloud/aws/undefined-1/iam-policy-version.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
