[security-audit-agent] Security Audit: Lambda IAM Privilege Escalation Path, Config Dir Permissions, Unpinned Image#61
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rosa-regional-platform-ci The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @rosa-regional-platform-ci. Thanks for your PR. I'm waiting for a openshift-online member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Superseded by #75 (2026-06-15 consolidated audit). |
Security Audit — rosa-regional-platform-cli
Audit Date: 2026-05-15 | Auditor: security-audit-agent (automated)
This PR documents security findings from an automated security audit. No fixes are included — the goal is to surface issues for maintainer triage.
🔴 HIGH — Finding 1: Lambda IAM Role Has Unrestricted Resource Scope for IAM Operations — Privilege Escalation Path
Affected file:
internal/cloudformation/templates/lambda-bootstrap.yaml:88-107Risk: The Lambda execution role can create any IAM role and attach any policy (AWS-managed or customer-managed) to it, scoped to all IAM resources (
Resource: *). There is no IAM permission boundary enforced on created roles. This is a privilege escalation path:AdministratorAccessto it (this action is allowed —AttachRolePolicyonResource: *).sts:AssumeRoletrust policy allows the Lambda's execution role principal).Attack Vectors:
What to Mitigate:
Resourcescope: Limit toarn:aws:iam::${AccountId}:role/rosa-*andarn:aws:iam::${AccountId}:instance-profile/rosa-*.AttachRolePolicy: Add conditioniam:PolicyARN: arn:aws:iam::aws:policy/service-role/ROSA*to prevent attaching arbitrary managed policies.🔴 HIGH — Finding 2: Lambda IAM Role Can Pass Any Role to CloudFormation and Has Unrestricted EC2/Route53 Scope
Affected file:
internal/cloudformation/templates/lambda-bootstrap.yaml:50-52, 94-96, 135-137Risk:
PassRole
Resource: *: The Lambda can pass any IAM role in the account to CloudFormation stacks it deploys. If an existing over-privileged or admin role exists, a malicious CloudFormation template triggered by the Lambda can operate with that role's permissions.VPCResourceManagement
Resource: *: The Lambda can modify security groups, route tables, and VPC configurations for all VPCs in the account — not just ROSA cluster VPCs. A compromised Lambda could open security groups for unrelated production workloads.Route53ResourceManagement
Resource: *: The Lambda can associate any VPC with any hosted zone and create/delete hosted zones across the account, potentially disrupting DNS for non-ROSA services.What to Mitigate:
iam:PassRoleResourcetoarn:aws:iam::${AccountId}:role/rosa-*.ec2:ResourceTag/ManagedBy: rosactl.🟡 MEDIUM — Finding 3: CLI Config Directory Created with World-Readable Permissions (
0755)Affected file:
internal/config/config.go:44Risk: The
~/.rosactl/directory is created with0755(world-readable, world-executable). While the config file itself is written with0600(correct), the directory being0755means:config.jsonand any other files stored there.The config stores the platform API URL (
platform_api_url), which could reveal internal API endpoint addresses to other users on shared systems (CI runners, jump hosts, developer VMs).What to Mitigate: Change
0755to0700inensureConfigDir(). This matches the security posture of~/.aws/(the AWS CLI config directory).🟡 MEDIUM — Finding 4: Lambda Container Image URI Example Uses
:latest— No Digest EnforcementAffected file:
internal/cloudformation/templates/lambda-bootstrap.yaml:2-8Risk: The description explicitly gives
:latestas an example, and there is noAllowedPatternconstraint requiring a digest-pinned URI. Operators following the example deploy with a mutable tag. Combined with the Lambda's IAM privilege escalation path (Finding 1), a supply chain attack on the container image leads to full account admin access.What to Mitigate:
AllowedPattern: ^.*@sha256:[a-f0-9]{64}$to require digest-pinned images.Triage Guide
0755)