Least Privilege is a Conversation: Building an Agentic Role Engineering Pipeline

Alex Smolen (Founder · NSEC Labs)

fwd:cloudsec North America 2026 · Day 1

Overview

In the intricate landscape of cloud security, establishing and maintaining least privilege in AWS Identity and Access Management (IAM) remains a formidable challenge, particularly for human-initiated actions. Alex Smolen, founder of NSEC Labs and former security lead at LaunchDarkly and Clever, tackles this persistent problem head-on in his fwd:cloudsec talk. He introduces a novel approach that leverages the power of AI agents to automate and streamline the complex process of role engineering, transforming it from a manual, reactive task into a proactive, conversation-driven pipeline.

Watch on YouTube

Visual summary for Least Privilege is a Conversation: Building an Agentic Role Engineering Pipeline by Alex Smolen
Visual summary for Least Privilege is a Conversation: Building an Agentic Role Engineering Pipeline by Alex Smolen

Key moments

  1. 0:00 Introduction: Least Privilege and AI Agents
  2. 3:30 CloudTrail's Difficulty for IAM Least Privilege
  3. 4:30 Trail Tool: Open-Source CloudTrail Analysis for Agents
  4. 5:15 Trail Tool's CLI: Designed for Agentic Workflows
  5. 6:30 Agent-Assisted Management of ClickOps Resources
  6. 7:40 Automating Least Privilege Policy Generation and Deployment

Least Privilege is a Conversation: Building an Agentic Role Engineering Pipeline

Speakers: Alex Smolen, Founder, NSEC Labs

Conference: fwd:cloudsec

YouTube: https://www.youtube.com/watch?v=15i9o08GHvw

Overview

In the intricate landscape of cloud security, establishing and maintaining least privilege in AWS Identity and Access Management (IAM) remains a formidable challenge, particularly for human-initiated actions. Alex Smolen, founder of NSEC Labs and former security lead at LaunchDarkly and Clever, tackles this persistent problem head-on in his fwd:cloudsec talk. He introduces a novel approach that leverages the power of AI agents to automate and streamline the complex process of role engineering, transforming it from a manual, reactive task into a proactive, conversation-driven pipeline.

Smolen highlights that while defining least privilege for deterministic code workflows like AWS Lambda or ECS services is relatively straightforward, the unpredictable nature of human interactions with AWS through laptops, bastions, or web consoles introduces significant risk. The emergence of powerful AI agents further complicates this, as they represent a new class of highly capable, yet potentially destructive, execution environments. This talk not only presents an innovative open-source tool, Trail Tool, designed to simplify CloudTrail analysis for role engineering, but also explores critical techniques—sandboxing, credential injection, and local IAM enforcement—to secure these very AI agents themselves, ensuring they operate within their own boundaries of least privilege.

The core premise of Smolen's presentation is that understanding user behavior through AWS CloudTrail data is paramount to effective least privilege policy generation. By making this data accessible and actionable for AI agents, organizations can automate the identification of risky "click-ops," dynamically adjust policies based on access denied errors, and even validate the appropriate use of sensitive "break-glass" roles. This vision of an "agentic role engineering pipeline" promises to bridge the gap between robust security controls and developer productivity, enabling security teams to enforce least privilege at scale while fostering a more secure and responsive cloud environment.

Background

▶ Watch: Introduction: Least Privilege and AI Agents (0:00)

The fundamental challenge addressed by this talk is the implementation of least privilege within AWS IAM, particularly when it pertains to human users and their dynamic, often unpredictable, interactions with cloud resources. Smolen draws a clear distinction between deterministic code-shaped workflows, where IAM policies can be precisely defined based on code analysis, and generic execution environments—such as laptops, bastions, or the AWS web console—where human error or malicious intent can lead to significant incidents. These human-centric environments are characterized by their unpredictability, and now, AI agents represent the latest, and perhaps most potent, iteration of this problem due to their power and potential for unexpected destruction.

The difficulty of achieving least privilege is not new. Smolen references a talk he gave in 2018, demonstrating that IAM has long been a hard problem, with many of the same challenges persisting today. The prevailing method for figuring out least privilege, he asserts, is to "listen to what people are doing through understanding their usage and then expressing yourself through thoughtful, carefully deployed policies." This process is often referred to as role engineering, and it inherently involves managing a delicate trade-off: policies must act as effective guardrails without becoming counterproductive choke points that hinder legitimate operations.

A core impediment to effective role engineering is the practical difficulty of extracting meaningful insights from AWS CloudTrail. While CloudTrail logs all API activity, its raw format is notoriously difficult to parse and query for the purpose of IAM policy generation. Smolen reviews existing tools and their limitations:

  • AWS CloudTrail Console: Lacks complex query capabilities, grouping, or aggregation, making it unsuitable for comprehensive policy generation.
  • Indexed Search (e.g., ElasticSearch): Often struggles with the sheer volume of CloudTrail data as organizations scale.
  • Data Lakes: While capable of storing vast amounts of data, writing effective queries to derive actionable IAM insights remains a significant hurdle.
  • IAM Access Analyzer: Can generate least privilege policies, but it only addresses a narrow "bread-and-butter" use case and leaves the critical step of policy application to the user, overlooking many other essential aspects of role engineering.

These limitations highlight a significant gap: a need for tools that can transform raw CloudTrail data into structured, actionable intelligence, enabling more efficient and automated agentic workflows for role engineering. This gap, combined with the emerging security considerations for AI agents themselves, forms the backdrop for Smolen's innovative solutions.

Key Findings

▶ Watch: Trail Tool: Open-Source CloudTrail Analysis for Agents (4:30)

Alex Smolen's talk unveils several key findings and contributions that significantly advance the state of least privilege implementation and the security of AI agents in AWS.

Firstly, a central finding is that AI tooling can fundamentally transform and simplify complex role engineering workflows. By providing structured access to CloudTrail data, AI agents can automate tasks that were previously manual, reactive, and prone to human error. This shifts the paradigm from ad-hoc policy adjustments to a more systematic and conversational approach.

Secondly, Smolen introduces Trail Tool, an open-source solution designed to overcome the inherent difficulties of analyzing CloudTrail data for IAM purposes. Trail Tool is presented as a critical enabler for agentic role engineering, providing helpful indexes of core AWS nouns (sessions, people, roles, resources, services) from CloudTrail, making usage patterns readily queryable by agents.

Thirdly, the talk demonstrates that agentic workflows powered by Trail Tool can automate crucial security tasks:

  • Identifying and remediating "click-ops": Agents can detect resources created or modified outside of Infrastructure as Code (IaC) and take automated actions like updating Terraform or notifying users.
  • Generating and deploying least privilege policies: Policies can be automatically derived from observed CloudTrail actions and integrated into IaC pipelines.
  • Proactive handling of access denied errors: Agents can identify and suggest policy adjustments to resolve legitimate access issues, reducing friction for users.
  • Validating break-glass access: AI-powered summarization can compare actual activity during a break-glass session against its stated justification, closing the loop on critical access approvals.

Finally, Smolen addresses the critical, often overlooked, aspect of securing AI agents themselves. He outlines three distinct, yet complementary, techniques to enforce least privilege on agents interacting with AWS:

  • Sandboxing with credential isolation: Tools like Elhas can vend temporary AWS credentials over a Unix socket, preventing agents from directly accessing host credentials and enabling targeted access in isolated environments like Docker containers.
  • Credential injection with custom proxies: The IAM Agent Proxy demonstrates a novel approach to credential injection for AWS V4 request signing. It allows agents to operate with "fake" credentials, which are then stripped and replaced by the proxy with real, scoped credentials, effectively preventing credential exfiltration.
  • Local IAM enforcement: The IAM Agent Proxy can also perform runtime evaluation of agent actions against a specified policy, issuing forged access denied errors locally. This is particularly significant for AWS Identity Center roles, which traditionally lack support for session policies or self-assumption for fine-grained control.

These findings collectively present a comprehensive strategy for both leveraging AI to solve IAM challenges and securing the AI agents that undertake these tasks, moving towards a more automated, secure, and resilient cloud security posture.

Technical Deep Dive

▶ Watch: Trail Tool's CLI: Designed for Agentic Workflows (5:15)

The technical core of Smolen's presentation revolves around two primary open-source tools: Trail Tool for enabling agentic role engineering, and Elhas alongside IAM Agent Proxy for securing AI agents themselves.

Trail Tool: Unlocking CloudTrail for Agentic Workflows

Trail Tool is architected as a CloudFormation stack that deploys a Lambda function to process AWS CloudTrail logs. This Lambda function ingests CloudTrail events from an S3 bucket and then crunches and aggregates the data, outputting it to DynamoDB. The rationale behind DynamoDB is to provide a highly indexed, queryable store that significantly reduces the volume of raw CloudTrail data while retaining essential information. The "core nouns" indexed by Trail Tool include sessions, people, roles, resources, and services, making it easy to query what happened, who did it, and to what.

The Trail Tool CLI is designed to interact with this DynamoDB store and is specifically built to be consumable by an agent. It comes with a set of agent instructions, guiding an AI agent on how to use it to solve common workflows. For instance, querying for a session provides an aggregated view of human-initiated AWS access, identifying the user via SSO details in CloudTrail. This aggregation is crucial; while it doesn't replace a full Security Information and Event Management (SIM) system for forensics, it provides a manageable and meaningful overlay for agentic workflows.

Smolen illustrates several agentic workflows enabled by Trail Tool:

  1. Identifying and Remediating Click-Ops: Trail Tool indexes resources created or modified via "click-ops" (manual console actions). An agent can query this data, identify non-compliant changes, and then perform actions like updating Terraform files to import these resources into IaC state, or sending automated notifications (e.g., Slack messages) to the responsible individuals, thereby enforcing change control.
  1. Generating Least Privilege Policies: This is a "bread-and-butter" use case made easy by Trail Tool. It automatically translates CloudTrail actions into a corresponding IAM policy. Crucially, it understands where IAM policies are defined (e.g., in Terraform) and can generate a pull request to update the IaC, facilitating safe deployment. Policies can be fine-tuned based on timeframes (e.g., last 30, 60, 90 days) or specific sessions.
  1. Handling Access Denied Errors: Trail Tool indexes access denied errors, including the more informative messages now returned by AWS. An agent can quickly determine what errors a particular role is encountering. This allows for dynamic policy adjustments to permit legitimate actions, potentially even interacting with users to confirm the necessity of new permissions.
  1. Validating Break-Glass Access: For highly privileged "break-glass" roles, Trail Tool can analyze a session's activity and, using AI capabilities like Bedrock, summarize what happened. This summary can then be compared against the user's justification for requesting the role, allowing organizations to close the loop on access approvals and detect unauthorized actions (e.g., creating an IAM access key when only SSM access was justified).

Least Privilege for Agents: Securing the AI Workforce

Smolen then shifts focus to securing the AI agents themselves, outlining three key strategies:

  1. Credential Isolation and Sandboxing with Elhas:

Elhas (built by Michaels, also mentioned as being open-source) is an AWS credential broker that facilitates credential isolation. It allows users to specify an IAM role to assume, starts a daemon, and then vends automatically refreshing temporary credentials over a Unix socket.

The mechanism involves configuring an AWS CLI profile to use a credential_process that reads from this Unix socket. This design is particularly effective for sandboxing environments like Docker containers or VMs. By passing only the Unix socket into the container, the agent within has no direct access to the host's AWS credentials file or environment variables. This ensures that the agent only receives the specific, assumed role credentials vended by Elhas, dramatically limiting its potential blast radius.

  1. Credential Injection with IAM Agent Proxy:

Standard credential injection proxies often rely on bearer tokens, which don't directly apply to AWS due to its use of V4 request signing for authentication. Smolen's IAM Agent Proxy addresses this by acting as a man-in-the-middle proxy. It operates on the principle that if an agent is compelled to exfiltrate credentials, those credentials should be useless.

The proxy first vends fake AWS credentials over a Unix socket (similar to Elhas). The agent then uses these fake credentials to sign its AWS requests. When the request passes through the IAM Agent Proxy, the proxy validates the fake signature, strips it out, and then re-signs the request with real, valid AWS credentials before forwarding it to AWS. This ensures that the agent never possesses real credentials, making credential exfiltration attempts futile.

A significant additional capability of the IAM Agent Proxy is its ability to generate a least privilege policy based on the AWS calls it observes passing through. This provides a dynamic way to scope agent permissions over time.

  1. Local IAM Enforcement with IAM Agent Proxy:

A common challenge, particularly with AWS IAM Identity Center roles, is the difficulty of scoping access using traditional methods like session policies or editing trust relationships for self-assumption. The IAM Agent Proxy provides an elegant solution by enforcing IAM policies locally at runtime.

When the proxy is run in "enforce mode," a specific IAM policy can be passed to it. As the agent makes AWS calls, the proxy evaluates each action against this local policy. If an action is not permitted by the policy, the proxy intercepts the call and issues a forged access denied error directly back to the agent, preventing the request from ever reaching AWS. This allows for granular, dynamic control over Identity Center roles, effectively solving a previously difficult problem of scoping permissions for agents.

These technical solutions, spanning both CloudTrail analysis and agent security, form a powerful toolkit for organizations seeking to implement and maintain least privilege in an increasingly agent-driven cloud environment.

Demo / Proof of Concept

▶ Watch: Agent-Assisted Management of ClickOps Resources (6:30)

The talk effectively functions as a series of integrated demonstrations, showcasing the practical application and capabilities of both Trail Tool and the IAM Agent Proxy with Elhas. These proofs of concept illustrate a maturity journey for an organization aiming to lock down IAM over time.

Trail Tool Demos:

  1. Querying User Sessions: Smolen first demonstrates the basic functionality of the trail tool CLI by querying for sessions associated with a particular user. This immediately highlights how Trail Tool aggregates CloudTrail data, providing a concise summary of human-initiated AWS access, including SSO details, without needing to sift through raw logs.
  1. Identifying Click-Ops Resources: The demo progresses to showing how Trail Tool can identify resources that were created or modified via "click-ops." This illustrates how an agent could easily query for such non-compliant actions, triggering subsequent automated workflows such as updating Terraform files to import these resources or sending notifications to the relevant users.
  1. Generating Least Privilege Policies: A core demonstration involves Trail Tool's ability to automatically translate observed CloudTrail actions into a least privilege IAM policy. The demo emphasizes its capability to understand existing IaC (like Terraform) and generate a pull request for policy deployment, including options to fine-tune policies based on specific timeframes (e.g., last 30 days) or individual sessions.
  1. Handling Access Denied Errors: Smolen shows how Trail Tool indexes access denied errors, allowing an agent to quickly determine which errors a specific role is encountering. This sets the stage for dynamic policy adjustments, demonstrating how the system could potentially "open up" a policy to resolve legitimate access issues, possibly even by interacting with the user.
  1. Validating Break-Glass Access: For critical "break-glass" scenarios, the demo illustrates Trail Tool's advanced capability to summarize session activity using Bedrock (an AI service). This summary is then compared against the justification provided for accessing the break-glass role, enabling automated auditing to detect and flag discrepancies (e.g., a user requesting SSM access but also creating an IAM access key).

Least Privilege for Agents Demos:

  1. Elhas for Credential Isolation: The demonstration of Elhas shows its configuration to assume a specific role, starting its daemon, and how an AWS CLI profile can be configured to use its credential_process to vend credentials over a Unix socket. Crucially, Smolen showcases how a Docker container can be launched with access only to this Unix socket, demonstrating that the containerized agent has no access to the host's raw AWS credentials, enforcing strong sandboxing.
  1. IAM Agent Proxy for Credential Injection: This demo highlights the IAM Agent Proxy's ability to act as a proxy for AWS calls. An agent is configured to use the proxy with "fake" credentials (also vended over a Unix socket), and the proxy intercepts these calls. The demonstration shows the proxy observing the agent's actions and, critically, generating a least privilege policy based on these observed calls. This illustrates how the agent never holds valid credentials, preventing exfiltration, while the proxy dynamically builds a policy.
  1. IAM Agent Proxy with Local IAM Enforcement: The final demonstration showcases the IAM Agent Proxy's "enforce mode." An IAM policy is passed to the proxy, and when the agent attempts an action not permitted by that policy (e.g., trying to get-role when not allowed), the proxy intercepts the call and issues a forged access denied error locally. This effectively demonstrates how the proxy can enforce granular permissions for agents, especially useful for AWS Identity Center roles where direct session policies are not supported.

These comprehensive demonstrations provide concrete evidence of the proposed solutions' efficacy, moving beyond theoretical concepts to tangible, working implementations for both automating role engineering and securing AI agents.

Defensive Implications

▶ Watch: Automating Least Privilege Policy Generation and Deployment (7:40)

The insights and tools presented by Alex Smolen offer several critical defensive implications for organizations operating in AWS, particularly as they grapple with least privilege and the integration of AI agents.

  1. Enhance Visibility and Automation for Human-Initiated Actions: Organizations should consider implementing Trail Tool to gain unprecedented visibility into human-initiated AWS activity. By leveraging its aggregated and indexed CloudTrail data, security teams can automate the detection of risky behaviors like "click-ops" (manual resource creation/modification outside of IaC) and policy drift. This shifts from reactive incident response to proactive identification and remediation.
  1. Automate Role Engineering Workflows: The agentic workflows enabled by Trail Tool allow for significant automation in role engineering. Defenders can configure agents to automatically generate least privilege policies based on observed usage, update Infrastructure as Code (e.g., Terraform) with these policies, and streamline the approval process. This reduces the manual burden on security teams and ensures policies are continuously aligned with actual usage.
  1. Streamline Access Denied Resolution: By indexing and analyzing access denied errors, Trail Tool empowers agents to dynamically suggest policy adjustments. This capability is crucial for maintaining developer velocity while enforcing least privilege. Defenders can establish automated processes that monitor for access denied events, assess their legitimacy, and propose targeted policy updates, potentially even engaging users for justification.
  1. Strengthen Break-Glass Access Control and Auditing: The ability to use AI (like Bedrock) to summarize actual activity during a break-glass session and compare it against the stated justification is a powerful defensive measure. Organizations should integrate this capability to ensure accountability and detect misuse of highly privileged roles, closing a critical gap in traditional access approval workflows.
  1. Implement Robust Security for AI Agents: As AI agents become more prevalent, securing their access to cloud resources is paramount. Defenders must:
  • Sandbox agent environments: Utilize tools like Elhas and containerization (e.g., Docker) to isolate AI agents from host AWS credentials. This ensures agents only operate with explicitly granted, temporary, and scoped permissions, significantly reducing the blast radius in case of compromise.
  • Employ Credential Injection Proxies: Adopt solutions like the IAM Agent Proxy to prevent credential exfiltration. By ensuring agents only ever handle "fake" credentials, the risk associated with compromised agents attempting to steal and reuse valid AWS credentials is virtually eliminated.
  • Enforce Local IAM Policies for Agents: Leverage the IAM Agent Proxy's local enforcement capabilities, especially for AWS Identity Center roles. This provides a granular mechanism to define and enforce least privilege for agents at runtime, overcoming the limitations of traditional IAM policy application for these specific role types.

By adopting these defensive strategies, organizations can build a more secure, efficient, and resilient cloud environment that effectively manages least privilege for both human users and the burgeoning fleet of AI agents.

Key Takeaways

  • Least privilege in AWS IAM for human-initiated actions remains a persistent and complex challenge, often hindered by the difficulty of extracting actionable insights from raw CloudTrail data.
  • Trail Tool provides a vital open-source solution for simplifying CloudTrail analysis, transforming raw logs into indexed, queryable data (sessions, people, roles, resources, services) stored in DynamoDB, thereby enabling efficient agentic workflows.
  • AI agents, powered by tools like Trail Tool, can automate significant aspects of role engineering, including identifying and remediating "click-ops," generating least privilege policies, dynamically handling access denied errors, and validating break-glass access against justifications using AI summarization.
  • Securing AI agents themselves is critical and requires dedicated techniques:
  • Sandboxing with credential isolation (e.g., Elhas vending credentials over a Unix socket) prevents agents from accessing host credentials.
  • Credential injection (e.g., IAM Agent Proxy stripping fake V4 signatures and adding real ones) prevents credential exfiltration.
  • Local IAM enforcement (e.g., IAM Agent Proxy evaluating actions against a policy at runtime) provides granular control, particularly for AWS Identity Center roles.
  • The IAM Agent Proxy's local IAM enforcement capability is a breakthrough for AWS Identity Center roles, enabling fine-grained control and policy enforcement that was previously difficult to achieve due to limitations with session policies and trust relationships.
  • The talk highlights a future where agent-assisted security operations for IAM are not just aspirational but achievable, fostering a more automated, proactive, and secure cloud environment by treating least privilege as an ongoing "conversation" between usage and policy.

About the Speaker(s)

Alex Smolen is the founder of NSEC Labs, a solo security consultancy. Prior to establishing NSEC Labs, he held leadership roles in security, having led security teams for both LaunchDarkly and Clever. His expertise lies in cloud security, particularly AWS IAM, and exploring innovative solutions to long-standing security challenges.

Reviews

Dr. Zero (Offensive Security Researcher) — SOLID

Smolen is clearly a practitioner who has lived the IAM pain, and Trail Tool plus the IAM Agent Proxy represent genuinely useful open-source contributions. The talk lands solidly in the technical-practitioner lane — not a research drop, but a working-tools session — and it delivers on that promise without much padding.

Heather Calloway (CISO) — SOLID

Smolen knows IAM deeply and the tooling is real — Trail Tool and IAM Agent Proxy address genuine operational gaps that most cloud security teams are hitting right now. But this is a practitioner's talk, not a leader's talk, and it stays in that lane without apology.

→ Top-rated talks at fwd:cloudsec North America 2026

All talks from fwd:cloudsec North America 2026