Skip to main content

A Neuro-Symbolic Inference Engine for AWS Security & FinOps โ€” combines LLM routing with Z3 SMT/ILP solvers for formal IAM verification and financial blast radius analysis.

Project description

๐Ÿ›ก๏ธ IAM Axiom Verifier

A Neuro-Symbolic Inference Engine for AWS Security & FinOps

IAM Axiom Verifier is a mathematical auditing tool for AWS environments. It combines the flexibility of Large Language Models (LLMs) for semantic routing with the absolute rigor of SMT solvers (Formal Verification) to evaluate IAM policies.

Instead of relying on regular expressions, heuristics, or AI hallucinations, this engine translates the AWS state into a system of inequalities and boolean logic, mathematically demonstrating risk vectors.


๐Ÿšจ Disclaimer - Proof of Concept (PoC)

[!CAUTION] This code/application is a proof of concept. It is NOT ready for production. It may contain bugs and SEVERE security vulnerabilities. Its purpose is purely demonstrative and/or experimental.


๐Ÿšจ The Problem

  • AI Hallucinates: LLMs cannot reliably reason about complex permission graphs or service quotas. An error in a security audit is unacceptable.
  • Static Calculators Fail: Calculating the financial "Blast Radius" of a compromised credential is not a simple summation; it is a combinatorial optimization problem (NP-Hard) crossed with AWS quota constraints and IAM boolean logic.
  • Transitive Depth: While the ultimate goal is to implement "infinite depth" reachability analysis (detecting multi-hop privilege escalation), the current implementation operates at Depth = 1. It evaluates direct access based on exact permissions assigned to the specific entity.

โœจ The Solution (Key Features)

This project implements a "2-in-1" Neuro-Symbolic architecture:

๐Ÿ”’ Module 1: Formal Access Verifier (SAT Solver)

Translates AWS policies (explicit and implicit Allows/Denies) into boolean theorems. It demonstrates if a logical path exists for a role to access a critical resource.

The equation evaluated by Z3: $$Permission_Granted = Has_Allow \land \neg Has_Explicit_Deny$$

๐Ÿ’ธ Module 2: Financial Blast Radius Optimizer (Max-SAT / ILP)

Cross-references IAM permissions with the offline AWS Pricing catalog and Service Quotas. It uses Integer Linear Programming (ILP) to find the exact combination of instances and regions an attacker would use to inflict maximum economic damage.

The objective function: $$\max C = \sum_{i=1}^{n} (c_i \cdot x_i \cdot P_i)$$

Subject to: $$\sum_{i=1}^{n} (v_i \cdot x_i \cdot P_i) \le Q \quad \land \quad 0 \le x_i \le max_qty_i$$


๐Ÿง  Architecture (How it works)

The system enforces a strict boundary between probabilistic reasoning (LLM) and deterministic execution (Z3). Furthermore, it is completely offline and air-gapped from the AWS environment during the inference phase.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ User Question โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Layer 1: Intent (LLM - Gemini / OpenAI) โ”‚ โ”‚ โ†’ Semantic Router: extracts role, action, target resource โ”‚ โ”‚ โ†’ Pydantic validates strict JSON (LLMIntent) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Layer 2: Deterministic Fetcher (Local State) โ”‚ โ”‚ โ†’ Reads frozen IAM policies from /data/ JSON fixtures โ”‚ โ”‚ โ†’ Loads local Service Quotas and public prices โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Layer 3: Compilation (IAM โ†’ SMT) โ”‚ โ”‚ โ†’ Parses IAM JSON to typed PolicyStatements โ”‚ โ”‚ โ†’ Cross-references permissions with offline price catalog โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Layer 4a: SAT Solver โ”‚ โ”‚ Layer 4b: ILP Solver โ”‚ โ”‚ Access Verification โ”‚ โ”‚ Financial Blast Radius โ”‚ โ”‚ โ†’ UNSAT = Impossible โ”‚ โ”‚ โ†’ SAT = Maximum cost โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜


๐Ÿ”„ Standard Execution Flow (The 2-Step Process)

To adhere to strict security practices, data extraction is completely decoupled from the mathematical inference engine.

Step 1: Extract & Freeze AWS State (Requires Credentials)

First, an auditor uses the standalone extraction tool. This connects to AWS via read-only APIs, downloads the policies and quotas, and freezes them into local JSON files inside the src/data/ directory.

python tools/sync_aws.py --profile axiom-auditor --regions us-east-1 eu-west-1

Step 2: Configure the LLM Router

The engine is provider-agnostic. Copy the .env.example file to .env and configure your preferred AI provider (Google Gemini or OpenAI) to power the Semantic Router. You can also enable a USE_MOCK_LLM="true" mode for completely offline, air-gapped testing.

Step 3: Offline Mathematical Audit (Air-Gapped)

Once the data is frozen and the router is configured, you run the engine. The math engine strictly reads the local JSON state and applies mathematical proofs.

Run the automated demonstration suite

iam-axiom-verifier demo


๐Ÿ’ป Usage Examples (Interactive CLI)

The package exposes an interactive natural language interface. You can ask complex security questions, and the LLM will translate them into exact parameters for the Z3 SMT solver.

CASE 1: Formal Access Verification (Specific ARNs) You can query if a role has access to specific cloud resources:

iam-axiom-verifier ask "Can junior developers delete the instance arn:aws:ec2:us-east-1:123456789012:instance/i-prod999?"

> โŒ UNSAT: Mathematically proven. The role does not have any Allow

> for 'ec2:TerminateInstances' on that specific ARN.

CASE 2: Financial Damage Optimization (Blast Radius) Ask the engine to calculate the worst-case scenario if a role is compromised:

iam-axiom-verifier ask "If a hacker gets into the DataEng-Team account, what's the worst financial damage they can do?"

> โš ๏ธ SAT (Max-Cost): Maximum damage is $13,729/day ($572.04/hour).

> Optimal attack vector calculated by Z3:

> โ†’ 15ร— g5.48xlarge ($244.32/h, 2880 vCPUs)

> โ†’ 10ร— p4d.24xlarge ($327.72/h, 960 vCPUs)


๐Ÿ” AWS Configuration (Least Privilege)

To perform Step 1 (Data Extraction) securely, the tool uses a dedicated IAM user with read-only permissions. Never use your administrator user.

1. Create the permission policy

The file docs/iam-axiom-readonly-policy.json contains the minimum necessary policy.

What the policy DOES allow:

  • IAM Role Audit: List roles, view role details, and read attached policies.
  • Price Query: Use the AWS Pricing service to obtain details about EC2 costs.
  • Quota Query: Review the account's service limits via Service Quotas.
  • EC2 Metadata: Describe instance types to dynamically fetch vCPU limits.

What it DOES NOT allow (Implicit restrictions):

  • No Modifying anything: It has zero "Write" permissions.
  • No Data Plane Access: It cannot access S3 objects, EC2 instances, or RDS databases.
  • No Billing Access: It cannot view actual monthly bills or account consumption.

[!CAUTION] This policy is read-only. The extraction tool cannot create, modify, or delete any resource in your AWS account.

2. Configure the local profile

Create an IAM User with the policy above, generate Access Keys for CLI, and run:

aws configure --profile axiom-auditor


๐Ÿ“‚ Project Structure

iam-axiom-verifier/ โ”œโ”€โ”€ .env.example # Template for API Keys (Google Gemini / OpenAI) โ”œโ”€โ”€ .gitignore # Ignores /venv, pycache, .env and local caches โ”œโ”€โ”€ LICENSE # Project license โ”œโ”€โ”€ README.md # Main documentation โ”œโ”€โ”€ requirements.txt # Strict dependencies โ”œโ”€โ”€ engine.py # Entrypoint: Offline Inference Engine & CLI โ”‚ โ”œโ”€โ”€ tools/ # Utilities requiring internet/credentials โ”‚ โ””โ”€โ”€ sync_aws.py # Connects to AWS & freezes state to /src/data โ”‚ โ”œโ”€โ”€ src/ # Core Source Code โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ”œโ”€โ”€ models.py # Data Contracts (Pydantic v2) โ”‚ โ”œโ”€โ”€ aws/ # Layer 2: Deterministic Fetcher (Local JSON) โ”‚ โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ”‚ โ”œโ”€โ”€ fetcher.py # Boto3 logic (Used by tools/sync_aws.py) โ”‚ โ”‚ โ””โ”€โ”€ parser.py # Parses local IAM JSON to typed objects โ”‚ โ”œโ”€โ”€ core/ # Layers 3-4: Mathematical Inference โ”‚ โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ”‚ โ””โ”€โ”€ smt_solver.py # SAT and ILP engines (Z3) โ”‚ โ””โ”€โ”€ llm/ # Layer 1: Probabilistic AI โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ””โ”€โ”€ router.py # Semantic Router (LLM Translator) โ”‚ โ”‚ โ”œโ”€โ”€ data/ # Local cache and frozen Mocks โ”‚ โ”‚ โ”œโ”€โ”€ policy_devteam.json
โ”‚ โ”‚ โ”œโ”€โ”€ policy_dataeng.json
โ”‚ โ”‚ โ””โ”€โ”€ aws_prices_quotas.json
โ”‚ โ””โ”€โ”€ docs/ # Technical and security documentation โ””โ”€โ”€ iam-axiom-readonly-policy.json


๐Ÿ”ง Tech Stack

Component Technology
Logic Core z3-solver (Microsoft Research)
Cloud Integration boto3 (AWS SDK)
AI Router Google GenAI SDK (gemini-2.5-flash) / OpenAI API
Data Contracts pydantic v2
Environment python-dotenv

โฌ‡๏ธ Installation

Install the latest beta release from PyPI:

pip install --pre iam-axiom-verifier

[!NOTE] This package is currently in beta. The --pre flag is required to install pre-release versions.


โš–๏ธ License

This project is licensed under the MIT License. See the LICENSE file for the full text.

โš ๏ธ Disclaimer

[!CAUTION] This code/application is a proof of concept. It is NOT ready for production. It may contain bugs and SEVERE security vulnerabilities. Its purpose is purely demonstrative and/or experimental.

USE AT YOUR OWN RISK. This software is provided "AS IS", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. See the MIT License for full terms.

By using this software, you acknowledge and agree that:

  1. No Liability. The authors and contributors are not responsible for any security breaches, financial losses, unexpected AWS charges, data loss, or any other damages arising from the use of this tool.

  2. Principle of Least Privilege. You must always follow the principle of least privilege when configuring AWS credentials for this tool. Never grant more permissions than strictly necessary. Use the minimal read-only policy provided in docs/iam-axiom-readonly-policy.json.

  3. Audit Before Use. You are solely responsible for reviewing, understanding, and validating the code before deploying it in any environment. Do not run this tool against production AWS accounts without first auditing its behavior in a sandboxed environment.

  4. Not a Substitute for Professional Security Audits. This tool is intended as a supplementary analysis aid and does not replace a comprehensive security assessment performed by qualified professionals.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iam_axiom_verifier-0.1.0b3.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iam_axiom_verifier-0.1.0b3-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file iam_axiom_verifier-0.1.0b3.tar.gz.

File metadata

  • Download URL: iam_axiom_verifier-0.1.0b3.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for iam_axiom_verifier-0.1.0b3.tar.gz
Algorithm Hash digest
SHA256 b156f3ac0459218786766e8d943608d4906cdb9356a8aab06e57589cdda6c922
MD5 812e4abda784c92fcacec7652292cb9e
BLAKE2b-256 a4ebf2b7c5fcf5714f524c25de9dfe9ba60ad6943fe9cd8cbb969d6caaadabae

See more details on using hashes here.

Provenance

The following attestation bundles were made for iam_axiom_verifier-0.1.0b3.tar.gz:

Publisher: pypi-publish.yml on marcbadiam/iam-axiom-verifier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file iam_axiom_verifier-0.1.0b3-py3-none-any.whl.

File metadata

File hashes

Hashes for iam_axiom_verifier-0.1.0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 81f4a0701270ad1949332c55b9dd0ec35dc74cd07e89bb19a62c1e6278cc7d8a
MD5 e46e59533a03fe32f475a2b65697ed4b
BLAKE2b-256 c533c4972184f0420778152871d10d1e1822b0abc38d94ef738d636a40051224

See more details on using hashes here.

Provenance

The following attestation bundles were made for iam_axiom_verifier-0.1.0b3-py3-none-any.whl:

Publisher: pypi-publish.yml on marcbadiam/iam-axiom-verifier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page