Inspiration

In AWS IAM, individually reasonable permissions can combine to create unintended privilege escalation paths.

As generative AI makes infrastructure code easier to produce, ensuring the security of that code becomes increasingly important.

We wanted to go beyond conventional security checks. What if we could detect dangerous infrastructure configurations before deployment and use mathematical proofs to increase confidence in the findings?

That idea inspired ProofGate.

What it does

ProofGate is an AWS CDK security tool that uses formal verification with Lean 4 to detect IAM privilege escalation paths to protected S3 buckets and block unsafe deployments.

Developers simply specify the S3 buckets they want to protect. During cdk synth, ProofGate analyzes the generated CloudFormation templates and identifies potentially dangerous IAM permission combinations.

When a violation is detected, ProofGate stops synthesis and provides actionable feedback, including the affected IAM roles, AWS services, protected buckets, and suggested fixes.

ProofGate also follows a fail-closed design: if TypeScript and Lean 4 disagree, or verification cannot be completed, synthesis is blocked.

How we built it

We built ProofGate as an AWS CDK validation plugin using TypeScript and Lean 4.

Our verification pipeline consists of four main steps:

  1. Extract IAM roles, policies, and trust relationships from synthesized CloudFormation templates.
  2. Build a finite model and identify privilege escalation paths using TypeScript.
  3. Evaluate the model with Lean 4 and verify agreement between the two implementations.
  4. Block unsafe configurations and provide actionable security findings.

We used Kiro IDE throughout the development process, leveraging spec-driven development, steering, agent hooks, MCP servers, and research sub-agents.

We also generated a dataset of 879 role-passing launch actions from the AWS Service Reference, allowing ProofGate to analyze privilege escalation paths across a wide range of AWS services.

Challenges we ran into

Our biggest challenge was translating the complexity of AWS IAM into a mathematically verifiable model.

IAM wildcards, ARN matching, service trust relationships, and CloudFormation intrinsic functions introduced numerous edge cases.

We also realized that simply passing results computed by TypeScript into Lean 4 provided limited assurance.

To address this, we redesigned the verification architecture so that Lean 4 independently computes findings for iam:PassRole-based privilege escalation paths. We then proved that this computation matches our formally specified rule.

Balancing verification rigor, practical performance, and compatibility with real-world CDK applications was another major challenge.

Accomplishments that we're proud of

We successfully built and published ProofGate as a usable AWS CDK plugin on npm.

Some of our key accomplishments include:

  • Support for 879 launch actions derived from the AWS Service Reference.
  • Model validation against 58 decisions from the real AWS IAM engine.
  • Property-based testing with 2,000 generated cases per run.
  • Validation using 84 realistic CDK stacks.
  • Reproduction of the preconditions for 60 of the 91 privilege escalation paths cataloged by pathfinding.cloud.
  • Resolution of 532 failing generated test cases found in an early implementation.
  • Discovery and correction of three defects in our published releases.

We are particularly proud that formal verification and independent testing helped us uncover real defects in our own security tool.

Rather than simply claiming that our approach improves reliability, we demonstrated its value through the development of ProofGate itself.

What we learned

We learned that formal verification is not just a way to prove that an implementation is correct. It is also a powerful way to discover weaknesses in specifications, assumptions, and implementation logic.

We also learned that AI-generated code should be supported by explicit specifications, independent testing, and mathematical reasoning rather than being trusted solely because it appears to work.

Formal verification provides guarantees within a defined model and its assumptions. Being transparent about what is proven and what remains outside the verification boundary is therefore essential.

What's next for ProofGate

We want to evolve ProofGate into a more comprehensive security verification tool for cloud infrastructure.

Our future plans include:

  • Extending protection beyond S3 to other AWS resources.
  • Supporting IAM Conditions, Permissions Boundaries, and Service Control Policies.
  • Analyzing cross-stack and cross-account privilege escalation paths.
  • Expanding the scope of formal verification with Lean 4.
  • Integrating ProofGate into CI/CD pipelines and AI-driven infrastructure development workflows.

Our long-term vision is to make formal verification a standard part of cloud infrastructure development.

Built With

Share this project:

Updates

Submission history