Skip to content

Jb/azure dev#120

Closed
jbarciabf wants to merge 27 commits intomainfrom
jb/azure-dev
Closed

Jb/azure dev#120
jbarciabf wants to merge 27 commits intomainfrom
jb/azure-dev

Conversation

@jbarciabf
Copy link
Collaborator

Card

GCP rework

Details

GCP rework and initialization

jbarciabf and others added 27 commits November 13, 2025 10:13
Created detailed analysis of current and recommended loot files across
all Azure CloudFox modules (whoami, inventory, rbac, storage, vms).

Analysis includes:
- Current loot file implementation status (2/5 modules)
- 15+ recommended new loot files with actionable content
- Detailed implementation guidance with code examples
- Priority-based TODO list with 20+ tasks
- 4-phase implementation roadmap

Focus on actionable items: commands to execute, secrets/credentials,
public IPs with access commands, privilege escalation paths, and
enumeration next steps.
Analyzed all modules in azure/commands/ directory.

KEY FINDINGS:
- 64/72 modules (88.9%) already have loot files - EXCELLENT
- 261 existing loot files across the codebase
- Only 8 modules missing loot files (critical gaps)

MODULES WITHOUT LOOT FILES:
🔴 CRITICAL (4):
1. aks.go - Kubernetes credential extraction
2. storage.go - Storage keys/SAS token commands
3. rbac.go - High-privilege RBAC enumeration
4. permissions.go - Dangerous permission abuse

🟡 HIGH (4):
5. federated-credentials.go - OIDC/GitHub exploitation
6. consent-grants.go - OAuth consent abuse
7. devops-agents.go - Agent token extraction
8. conditional-access.go - CA policy bypass

TOP MODULES (Champions with 10 loot files):
- vms.go - VM exploitation, snapshots, extensions
- arc.go - Hybrid connectivity, certificates
- automation.go - Runbooks, hybrid workers

IMPLEMENTATION PLAN:
- Phase 1 (Week 1-2): 4 critical modules, ~23 loot files
- Phase 2 (Week 3): 4 high-priority modules, ~18 loot files
- Total: ~40 new loot files to achieve 100% coverage

Files:
- docs/azure-loot-analysis/analysis.md - Comprehensive findings
- docs/azure-loot-analysis/todo.md - Implementation roadmap
Implemented actionable loot file generation for 4 critical Azure
security assessment modules. Loot files provide ready-to-execute
commands, privilege escalation paths, and remediation guidance.

Changes:
- rbac.go: Added 4 loot files (high-privilege roles, service
  principals, enumeration commands, privilege escalation)
- permissions.go: Added 4 loot files (dangerous permissions, service
  principal permissions, enumeration, privilege escalation paths)
- consent-grants.go: Added 4 loot files (risky grants, external apps,
  user consent, remediation commands)
- conditional-access.go: Added 4 loot files (weak policies, coverage
  gaps, bypass opportunities, remediation)

Each module now generates context-aware loot files containing:
- Specific attack/exploitation commands
- Investigation and enumeration commands
- Privilege escalation techniques based on discovered permissions
- Remediation and hardening guidance

Total: 16 loot file types across 4 modules, ~2500 lines of
security-focused code
Comprehensive analysis of all Azure CloudFox loot files to identify
non-actionable content that should be moved to standard output.

Key findings:
- 95%+ of loot files are properly actionable (commands/credentials/URLs)
- Identified 5 non-actionable loot files that should be removed:
  1. routes.go: route-custom-routes (just lists routes)
  2. nsg.go: nsg-open-ports (just lists ports, redundant with nsg-targeted-scans)
  3. arc.go: arc-machines (reformats table data)
  4. arc.go: arc-identities (lists identity GUIDs)
  5. hdinsight.go: hdinsight-identities (lists identity info)

Documented decision criteria for actionable vs informational data:
- Actionable: Commands, credentials, URLs, exploitation techniques
- Informational: Simple lists, inventory, status, reformatted table data

Provided specific code locations and examples for each finding.
Included extensive examples of properly actionable loot files to keep.

Recommendation: Remove 5 loot files to improve signal-to-noise ratio
while keeping all 195+ actionable loot files unchanged.
Implemented Phase 1 of loot file cleanup recommendations to remove
non-actionable loot files that contain simple lists/inventory data
instead of actionable commands, credentials, or exploitation techniques.

Files modified:
- routes.go: Removed route-custom-routes (just listed route details)
- nsg.go: Removed nsg-open-ports (duplicated data, nsg-targeted-scans has commands)
- arc.go: Removed arc-machines and arc-identities (reformatted table data)
- hdinsight.go: Removed hdinsight-identities (just listed identity GUIDs)

All changes:
- Removed loot file entries from LootMap initialization
- Removed loot file content generation code
- Auto-formatted files with gofmt for proper syntax

Impact:
- Reduces noise in loot file output
- Keeps loot files focused on actionable security data only
- Maintains all 195+ actionable loot files unchanged
- No loss of information - data still in standard table output

Related: docs/azure-loot-analysis/loot-cleanup-recommendations.md
Added comprehensive, realistic multi-step exploitation examples to
aks-pod-exec-commands loot file:

SCENARIO 1: Automated Privilege Escalation Chain
- Complete workflow that automatically enumerates all pods
- Extracts service account tokens from running pods
- Tests each token's permissions against Kubernetes API
- Identifies tokens that can list secrets (high-value targets)
- No more generic placeholders - real automation scripts

SCENARIO 2: Container Escape via Privileged Pod
- Complete pod manifest for container escape
- Includes hostNetwork, hostPID, and privileged settings
- Mounts host root filesystem at /host
- Provides chroot command for immediate host access

Benefits:
- Replaces generic <POD-NAME> placeholders with actual enumeration
- Provides copy-paste ready exploitation workflows
- Demonstrates realistic attack chains
- Shows how to pivot from pod access to cluster compromise

Related: Phase 2 Enhancement - Add detailed exploitation examples
Added three complete exploitation scenarios to storage loot files:
1. Automated bulk data exfiltration using azcopy with SAS token generation
2. Soft-deleted blob recovery for deleted data forensics
3. Connection string extraction from web apps/functions to find storage credentials

Replaces basic SAS token examples with full end-to-end attack chains.
Added four complete database exploitation scenarios:
1. Automated SQL Database data extraction with credential retrieval from Key Vault
2. PostgreSQL/MySQL data exfiltration using connection strings from App Services
3. CosmosDB data extraction via REST API with master keys
4. Automated credential harvesting from Key Vaults, App Services, and Function Apps

Each scenario includes complete workflows from credential discovery through firewall
manipulation, database connection, data extraction, and cleanup.
…nbTDxXvATUGKXmoU91

Claude/cloudfox azure new 01 qlt tnb t dx xv atugk xmo u91
Identified 7 high-value Azure modules that would benefit from enhanced
exploitation scenarios:

High Priority (7-9/10):
- vms.go (9/10): VM takeover, disk snapshots, password resets
- keyvaults.go (9/10): Credential harvesting, soft-deleted secret recovery
- webapps.go (8/10): Kudu exploitation, connection strings, backups
- databricks.go (8/10): Notebook secret scanning, cluster hijacking
- functions.go (7/10): Master key extraction, code download
- automation.go (7/10): Hybrid worker compromise, runbook exploitation

Medium Priority (5-6/10):
- logicapps.go (6/10): Workflow analysis, API connections

Includes detailed enhancement potential, example scenarios, and estimated effort
for each module. Total estimated effort: 15-22 hours for all 7 modules.
Created three key documents:

1. **gold-standard-analysis.md** (20KB)
   - Detailed analysis of acr.go, vms.go, storage.go, aks.go
   - Gold standard patterns for all 8 aspects (entry point, struct, processing, etc.)
   - Complete compliance checklist
   - Anti-patterns to avoid
   - Migration path with effort estimates

2. **audit-results.md** (6KB)
   - Automated compliance audit of all 72 Azure modules
   - Pattern-by-pattern scoring (InitCtx, BaseModule, RunSubEnum, etc.)
   - Categorization: COMPLIANT (44), PARTIAL (14), NON-COMPLIANT (8)

3. **audit-summary-and-plan.md** (13KB)
   - Executive summary: 61% already compliant!
   - 3-phase implementation plan (3 weeks, 42.5 hours)
   - Phase 1: Quick wins (14 modules, 10.5 hours)
   - Phase 2: DevOps overhaul (6 modules, 23 hours)
   - Phase 3: Final cleanup (4 modules, 9 hours)
   - Detailed risk mitigation and testing strategy

Key Findings:
- 44 modules (61%) fully compliant - NO WORK NEEDED
- 14 modules (19%) need minor updates (1-3 patterns)
- 8 modules (11%) need major refactor (DevOps suite + 2 others)
- Total effort: 42.5 hours to achieve 100% standardization
- Expected code reduction: ~65,000 lines across 24 modules

Ready for implementation with clear prioritization and effort estimates.
…nbTDxXvATUGKXmoU91

Claude/cloudfox azure new 01 qlt tnb t dx xv atugk xmo u91
  - identity-protection.go
  - privilege-escalation.go
  - security-center.go
  - trafficmanager.go
  - vpn-gateway.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants