CloudSentrix ๐
GCP IAM Privilege-Escalation Attack-Path Analyzer
CloudSentrix is a free, open-source command-line tool that scans Google Cloud Platform IAM policy exports for privilege-escalation risks, generates interactive attack-path graphs, scores your security posture, and produces client-ready PDF reports โ all without any paid APIs.
What It Does
- Detects 5 GCP IAM privilege-escalation patterns (mapped to MITRE ATT&CK Cloud Matrix)
- Scores your project's security posture from 0โ100
- Calculates blast radius โ if one account is compromised, how much can an attacker reach?
- Generates remediation โ exact
gcloudCLI commands to fix each finding - Exports results as JSON, CSV, SARIF, Interactive HTML Dashboard, or client-ready PDF
- Live scanning โ fetch and scan a live GCP project directly (no file needed)
- Watches a folder and auto-rescans whenever an IAM file changes
- AI summaries โ plain-language executive summaries via Google Gemini
Requirements
- Python 3.10 or higher
- pip
Installation
Windows
git clone https://github.com/Talha-Imran-cloud/cloudsentrix.git
cd cloudsentrix
python -m venv venv
venv\Scripts\activate
pip install -e .
Linux / macOS (Kali, Ubuntu, Debian)
git clone https://github.com/Talha-Imran-cloud/cloudsentrix.git
cd cloudsentrix
python3 -m venv venv
source venv/bin/activate
pip install -e .
Verify installation
cloudsentrix --version
Getting Your GCP IAM Policy File
gcloud projects get-iam-policy YOUR_PROJECT_ID --format=json > my_project_iam.json
Two sample files are included for testing:
sample_data/sample_gcp_iam.jsonโ basic 5-principal examplesample_data/demo_enterprise_iam.jsonโ realistic enterprise scenario
Commands
scan โ Full pipeline scan
cloudsentrix scan --file sample_data/sample_gcp_iam.json
cloudsentrix scan --file my_project.json --severity high
cloudsentrix scan --file my_project.json --top 10
live-scan โ Scan a live GCP project directly โก NEW
# Requires: gcloud CLI authenticated
gcloud auth application-default login
# Fetch and scan live IAM policy
cloudsentrix live-scan --project my-gcp-project-id
# Scan and save the fetched policy
cloudsentrix live-scan --project my-gcp-project-id --save fetched_policy.json
# Filter by severity
cloudsentrix live-scan --project my-gcp-project-id --severity critical
blast-radius โ Blast radius for one principal
cloudsentrix blast-radius --file my_project.json --principal admin@company.com
principal-path โ Escalation path between two principals
cloudsentrix principal-path --file my_project.json \
--source intern@company.com \
--target app-backend@my-project.iam.gserviceaccount.com
mitre-map โ Map findings to MITRE ATT&CK Cloud Matrix
cloudsentrix mitre-map --file my_project.json
remediate โ Generate exact gcloud fix commands
cloudsentrix remediate --file my_project.json
cloudsentrix remediate --file my_project.json --project my-real-project-id
cloudsentrix remediate --file my_project.json --severity critical
score โ Security score only (for CI/CD badges)
cloudsentrix score --file my_project.json
cloudsentrix score --file my_project.json --json
cloudsentrix score --file my_project.json --min-score 70
validate โ Check file format before scanning
cloudsentrix validate --file my_project.json
compare โ Compare two IAM exports (detect new risks)
cloudsentrix compare --old january.json --new february.json
export โ Export results to JSON, CSV, HTML, or SARIF
# JSON export
cloudsentrix export --file my_project.json --output report.json
# CSV export
cloudsentrix export --file my_project.json --output report.csv
# Interactive HTML Dashboard (open in browser)
cloudsentrix export --file my_project.json --output dashboard.html
# SARIF export (GitHub Code Scanning compatible) โก NEW
cloudsentrix export --file my_project.json --output results.sarif
Opening the HTML Dashboard:
Windows:
start dashboard.html
Linux / macOS:
xdg-open dashboard.html
The HTML dashboard includes:
- Security score card
- Finding counts by severity
- Interactive attack graph (drag nodes, scroll to zoom, hover for details)
- Full findings table with MITRE mapping
- Blast radius table
report โ Generate a client-ready PDF report
# Without AI summary
cloudsentrix report --file my_project.json --output my_report.pdf --no-ai
# With Gemini AI summary (set API key first โ see below)
cloudsentrix report --file my_project.json --output my_report.pdf
watch โ Auto-rescan when file changes
# Watch a single file
cloudsentrix watch --path my_project.json
# Watch a folder (rescans any .json file that changes)
cloudsentrix watch --path /path/to/iam/exports/
# Custom poll interval (seconds)
cloudsentrix watch --path my_project.json --interval 5
Press Ctrl+C to stop watching.
rules โ List all detection rules
cloudsentrix rules
list-principals โ List all principals and their roles
cloudsentrix list-principals --file my_project.json
SARIF Export โ GitHub Code Scanning โก NEW
SARIF (Static Analysis Results Interchange Format) output is compatible with:
- GitHub Code Scanning โ upload directly to your repo's Security tab
- VS Code SARIF Viewer extension
- Azure DevOps security dashboards
- Any SARIF 2.1.0-compatible tool
cloudsentrix export --file my_project.json --output results.sarif
Upload to GitHub:
gh api repos/OWNER/REPO/code-scanning/sarifs \
-F sarif=@results.sarif \
-F ref=refs/heads/main \
-F commit_sha=$(git rev-parse HEAD)
Gemini AI Summary (Optional)
The report command can generate a plain-language AI summary using Google Gemini.
Step 1 โ Get a free API key from Google AI Studio
Step 2 โ Set the environment variable:
Windows:
$env:GEMINI_API_KEY = "your_api_key_here"
Linux / macOS:
export GEMINI_API_KEY="your_api_key_here"
Step 3 โ Run:
cloudsentrix report --file my_project.json --output report.pdf
If no API key is set, a built-in template summary is used automatically.
Exit Codes
| Code | Meaning |
|---|---|
0 |
Success, no CRITICAL findings |
1 |
CRITICAL findings detected (use this to fail CI pipelines) |
2 |
Command could not complete (bad file, wrong format, etc.) |
Detection Rules
| Rule | Title | Severity | MITRE |
|---|---|---|---|
| GCP-001 | Publicly Accessible Role Binding | CRITICAL | T1078.004 |
| GCP-002 | Service Account Token Creator | CRITICAL | T1098.001 |
| GCP-003 | Service Account Key Admin | CRITICAL | T1098.001 |
| GCP-004 | IAM Policy Administrator | CRITICAL | T1098.003 |
| GCP-005 | Service Account Impersonation via Resource Attach | HIGH | T1548.005 |
Running Tests
pip install -e ".[dev]"
pytest tests/ -v
Expected output: 144 passed
Project Structure
cloudsentrix/
โโโ src/
โ โโโ cli.py # CLI entry point (15 commands)
โ โโโ parser.py # GCP IAM JSON parser
โ โโโ graph.py # IAM permission graph engine
โ โโโ detection.py # Privilege-escalation detection rules
โ โโโ risk_score.py # 0-100 security scoring engine
โ โโโ blast_radius.py # Attack-path blast radius calculator
โ โโโ watch_handler.py # File system watcher
โ โโโ live_scanner.py # Live GCP project scanner
โ โโโ pdf_report.py # PDF report generator
โ โโโ ai_summary.py # Gemini AI summary integration
โโโ tests/ # 144 pytest tests
โโโ sample_data/
โ โโโ sample_gcp_iam.json # Basic test file
โ โโโ demo_enterprise_iam.json # Realistic enterprise demo
โโโ .github/workflows/ci.yml # GitHub Actions CI
โโโ pyproject.toml # Packaging configuration
โโโ README.md
Roadmap ๐บ๏ธ
Coming Soon
| Feature | Description | Status |
|---|---|---|
| AWS Support | Scan AWS IAM policies โ detect privilege escalation via iam:PassRole, sts:AssumeRole, admin policies |
๐ Planned |
| Azure Support | Scan Azure RBAC โ detect Owner/Contributor abuse, service principal risks | ๐ Planned |
| Multi-Cloud Dashboard | Single HTML dashboard comparing GCP, AWS, Azure risk side by side | ๐ Planned |
| Slack / Teams Alerts | Send findings to Slack or Microsoft Teams webhook automatically | ๐ Planned |
| PDF Multi-Project | One PDF report covering multiple GCP projects at once | ๐ Planned |
AWS Support (Preview)
When AWS support ships, usage will look like:
# Export AWS IAM data
aws iam get-account-authorization-details --output json > aws_iam.json
# Scan AWS
cloudsentrix scan --file aws_iam.json --cloud aws
Azure Support (Preview)
# Export Azure RBAC
az role assignment list --all --output json > azure_rbac.json
# Scan Azure
cloudsentrix scan --file azure_rbac.json --cloud azure
License
MIT License โ free to use, modify, and distribute.
Author
Talha Imran โ SOC Analyst | Cloud Security | Pentesting
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloudsentrix-1.0.0.tar.gz.
File metadata
- Download URL: cloudsentrix-1.0.0.tar.gz
- Upload date:
- Size: 53.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ff789ebff851ebdd00e9640532bb0306a28ada1d249e17d86f270f93730c46a
|
|
| MD5 |
87357c27593e8eb282618862ef87bc05
|
|
| BLAKE2b-256 |
5eca2174ca1d78d1600a922cfb58c35491b276d08931a6ed75e0210efd8c072e
|
Provenance
The following attestation bundles were made for cloudsentrix-1.0.0.tar.gz:
Publisher:
publish.yml on Talha-Imran-cloud/cloudsentrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudsentrix-1.0.0.tar.gz -
Subject digest:
1ff789ebff851ebdd00e9640532bb0306a28ada1d249e17d86f270f93730c46a - Sigstore transparency entry: 2382437703
- Sigstore integration time:
-
Permalink:
Talha-Imran-cloud/cloudsentrix@08f3333170157b9ac4df3cbb7a378dd64d8186bc -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Talha-Imran-cloud
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08f3333170157b9ac4df3cbb7a378dd64d8186bc -
Trigger Event:
push
-
Statement type:
File details
Details for the file cloudsentrix-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cloudsentrix-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e49767b4d21fb65d0de0879b71bd975abc16f6137ca2014c31111111a67524f
|
|
| MD5 |
1f01960b53d2a5cfbff7921bddfd0a85
|
|
| BLAKE2b-256 |
3ee94717995361905d7759177cc314e1fb9886b4e4cc83b5ef96bdebafacfbdb
|
Provenance
The following attestation bundles were made for cloudsentrix-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on Talha-Imran-cloud/cloudsentrix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cloudsentrix-1.0.0-py3-none-any.whl -
Subject digest:
1e49767b4d21fb65d0de0879b71bd975abc16f6137ca2014c31111111a67524f - Sigstore transparency entry: 2382437815
- Sigstore integration time:
-
Permalink:
Talha-Imran-cloud/cloudsentrix@08f3333170157b9ac4df3cbb7a378dd64d8186bc -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Talha-Imran-cloud
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08f3333170157b9ac4df3cbb7a378dd64d8186bc -
Trigger Event:
push
-
Statement type: