Kuboid
Open Luck·Kuboid.in
Security BSides2025
Open in YouTube ↗

Getting things fixed: Both inside and outside your company

BSidesSLC478 views41:3710 months ago

This talk explores strategies for security teams to effectively remediate vulnerabilities by improving internal processes and influencing external vendors. It highlights the challenges of managing cloud security at scale, specifically focusing on the risks associated with IMDSv1 and misconfigured OIDC integrations. The speaker demonstrates how to use automated tooling, such as policy linters, to identify and prevent security misconfigurations in cloud environments. The presentation emphasizes the importance of root cause analysis and proactive communication with vendors to drive systemic security improvements.

Beyond the Patch: Why Your Cloud Infrastructure is Leaking Credentials

TLDR: Cloud environments often suffer from systemic credential exposure due to outdated metadata services and misconfigured OIDC integrations. This post breaks down how attackers exploit IMDSv1 and overly permissive OIDC roles to gain unauthorized access to cloud resources. Pentesters should prioritize auditing these configurations, while developers must transition to IMDSv2 and implement strict OIDC trust policies to prevent account takeovers.

Security researchers often focus on finding the next zero-day in a web application, but the most devastating breaches frequently stem from simple, systemic misconfigurations in cloud infrastructure. When an attacker gains a foothold via Server-Side Request Forgery (SSRF), they rarely stop at the application layer. They immediately pivot to the cloud metadata service to harvest temporary security credentials. This is not a theoretical risk. It is the primary path to full environment compromise in modern cloud-native architectures.

The Persistent Threat of IMDSv1

The Instance Metadata Service (IMDS) is a critical component of cloud instances, providing information about the instance itself, including IAM role credentials. The original version, IMDSv1, is inherently vulnerable to SSRF because it does not require any headers or authentication to retrieve these credentials. An attacker who finds a way to make a server perform an arbitrary HTTP request can simply point that request to http://169.254.169.254/latest/meta-data/iam/security-credentials/ and walk away with active, short-lived access keys.

Despite years of warnings, many organizations still leave IMDSv1 enabled. The fix is straightforward: enforce IMDSv2, which requires a session-oriented flow using a PUT request to obtain a token before any metadata can be accessed. This simple change effectively kills the most common SSRF-to-credential-theft attack vector. If you are performing a penetration test and find IMDSv1 enabled, you have already found a critical finding. Do not just report it; demonstrate the impact by retrieving the metadata.

OIDC Integrations: The New Frontier for Privilege Escalation

While IMDSv1 is a known quantity, misconfigured OpenID Connect (OIDC) integrations are the current gold mine for attackers. Many CI/CD pipelines, such as GitHub Actions or GitLab, use OIDC to assume IAM roles in AWS without needing long-lived static credentials. This is a massive security improvement over storing secret keys in environment variables, but it introduces a new class of misconfiguration.

The vulnerability lies in the trust policy of the IAM role. If the policy is too broad, it allows any repository within an organization to assume the role. An attacker who compromises a low-privilege repository can then use that OIDC token to assume a role with high-privilege permissions, effectively escalating their access to the entire cloud account.

To audit these, you need to inspect the Condition block of the IAM role's trust policy. A secure policy must explicitly restrict access to specific repositories or branches. You can use tools like Parliament to lint your IAM policies and identify these overly permissive trust relationships. A policy that looks like this is a red flag:

{
  "Effect": "Allow",
  "Principal": {
    "Federated": "arn:aws:iam::123456789012:oidc-provider/token.actions.githubusercontent.com"
  },
  "Action": "sts:AssumeRoleWithWebIdentity",
  "Condition": {
    "StringEquals": {
      "token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
    }
  }
}

This policy allows any GitHub repository that can authenticate to that OIDC provider to assume the role. By adding a StringEquals condition for token.actions.githubusercontent.com:sub, you can lock the role down to a specific repository or branch, preventing unauthorized cross-repo access.

Auditing for Impact

When you are on an engagement, treat the cloud control plane as part of your scope. Start by mapping the IAM roles and their trust policies. If you find roles that allow OIDC assumption, check if they are restricted to specific repositories. If they are not, you have a clear path to escalation.

Beyond OIDC, look for "shadow" administrative access. Many vendor-provided managed policies are far too broad. For example, some policies might grant iam:CreateAccessKey or iam:PutUserPolicy to an instance that only needs to read from an S3 bucket. These are classic OWASP A01:2021-Broken Access Control issues. Use CloudMapper to visualize your environment and identify these dangerous permission sets.

Driving Systemic Change

Reporting these issues to a security team is only half the battle. The real challenge is getting them fixed. If you find a vendor-provided integration that is inherently insecure, do not just tell the client to "fix it." Reach out to the vendor. If you are a researcher, file a report. If you are a consultant, help your client draft a formal request to the vendor.

Vendors are often unaware of how their integrations are being abused in the wild. When you provide them with a clear, reproducible example of how their configuration leads to privilege escalation, they are often willing to update their documentation or change their default settings.

Security is not just about finding bugs; it is about changing the underlying architecture to make those bugs impossible. Transitioning to IMDSv2 and hardening OIDC trust policies are not just defensive best practices. They are the baseline requirements for any organization that wants to survive in a cloud-native world. Stop fighting fires and start building firebreaks.

Talk Type
talk
Difficulty
intermediate
Has Demo Has Code Tool Released


BSidesSLC 2025

24 talks · 2025
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in