Skip to content

Commit b1c2056

Browse files
committed
vm to aa
1 parent 9d8d1d2 commit b1c2056

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

src/images/vm_to_aa.jpg

142 KB
Loading

src/pentesting-cloud/aws-security/aws-basic-information/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,24 @@ SCP examples:
7070

7171
Find **JSON examples** in [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html)
7272

73+
### Resource Control Policy (RCP)
74+
75+
A **resource control policy (RCP)** is a policy that defines the **maximum permissions for resources within your AWS organization**. RCPs are similar to IAM policies in syntax but **don’t grant permissions**—they only cap the permissions that can be applied to resources by other policies. When you attach an RCP to your organization root, an organizational unit (OU), or an account, the RCP limits resource permissions across all resources in the affected scope.
76+
77+
This is the ONLY way to ensure that **resources cannot exceed predefined access levels**—even if an identity-based or resource-based policy is too permissive. The only way to bypass these limits is to also modify the RCP configured by your organization’s management account.
78+
79+
> [!WARNING]
80+
> RCPs only restrict the permissions that resources can have. They don’t directly control what principals can do. For example, if an RCP denies external access to an S3 bucket, it ensures that the bucket’s permissions never allow actions beyond the set limit—even if a resource-based policy is misconfigured.
81+
82+
RCP examples:
83+
84+
- Restrict S3 buckets so they can only be accessed by principals within your organization
85+
- Limit KMS key usage to only allow operations from trusted organizational accounts
86+
- Cap permissions on SQS queues to prevent unauthorized modifications
87+
- Enforce access boundaries on Secrets Manager secrets to protect sensitive data
88+
89+
Find examples in [AWS Organizations Resource Control Policies documentation](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html)
90+
7391
### ARN
7492

7593
**Amazon Resource Name** is the **unique name** every resource inside AWS has, its composed like this:
@@ -384,6 +402,7 @@ If you are looking for something **similar** to this but for the **browser** you
384402
- [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html)
385403
- [https://aws.amazon.com/iam/](https://aws.amazon.com/iam/)
386404
- [https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html)
405+
- [https://aws.amazon.com/blogs/aws/introducing-resource-control-policies-rcps-a-new-authorization-policy/](https://aws.amazon.com/blogs/aws/introducing-resource-control-policies-rcps-a-new-authorization-policy/)
387406

388407
{{#include ../../../banners/hacktricks-training.md}}
389408

src/pentesting-cloud/azure-security/az-privilege-escalation/az-automation-accounts-privesc.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ Fore more information check:
1212

1313
### Hybrid Workers Group
1414

15+
- **From the Automation Account to the VM**
16+
1517
Remember that if somehow an attacker can execute an arbitrary runbook (arbitrary code) in a hybrid worker, he will **pivot to the location of the VM**. This could be an on-premise machine, a VPC of a different cloud or even an Azure VM.
1618

1719
Moreover, if the hybrid worker is running in Azure with other Managed Identities attached, the runbook will be able to access the **managed identity of the runbook and all the managed identities of the VM from the metadata service**.
1820

1921
> [!TIP]
2022
> Remember that the **metadata service** has a different URL (**`http://169.254.169.254`**) than the service from where get the managed identities token of the automation account (**`IDENTITY_ENDPOINT`**).
2123
24+
- **From the VM to the Automation Account**
25+
26+
Moreover, if someone compromise a VM where an automation account script is running, he will be able to locate the **Automation Account** metadata and access it from the VM to obtain tokens for the **Managed Identities** attached to the Automation Account.
27+
28+
As it's possible to see in the following image, having Administrator access over the VM it's possible to find in the **environment variables of the process** the URL and secret to access the automation account metadata service:
29+
30+
![](</images/vm_to_aa.jpg>)
31+
32+
2233
### `Microsoft.Automation/automationAccounts/jobs/write`, `Microsoft.Automation/automationAccounts/runbooks/draft/write`, `Microsoft.Automation/automationAccounts/jobs/output/read`, `Microsoft.Automation/automationAccounts/runbooks/publish/action` (`Microsoft.Resources/subscriptions/resourcegroups/read`, `Microsoft.Automation/automationAccounts/runbooks/write`)
2334

2435
As summary these permissions allow to **create, modify and run Runbooks** in the Automation Account which you could use to **execute code** in the context of the Automation Account and escalate privileges to the assigned **Managed Identities** and leak **credentials** and **encrypted variables** stored in the Automation Account.

0 commit comments

Comments
 (0)