National Cyber Warfare Foundation (NCWF)login

kosty for AWS cost and security auditing across 32 services


0 user ratings
2026-11-08 03:30:18
milo
Red Team (CNA)
"kosty

kosty is a Python CLI that audits 32 AWS services for cost waste and security gaps, designed for authorized cloud security assessments and FinOps reviews.








Toolkosty-cloud/kosty — plugin-based AWS cost optimization and security audit CLI (v3.6.1)
Categorycloud security and cost auditing CLI
Primary UseRunning kosty audit to inventory cost waste and misconfigurations across 32 AWS services, plus public-exposure mapping and IAM escalation detection during authorized engagements
Safe UseRead-only auditing of AWS environments you own or are explicitly authorized to assess: internal cloud security programs, penetration-test scoping, FinOps reviews, and lab environments
Telemetry NoteRelies on read-heavy AWS API calls (SimulatePrincipalPolicy in --deep mode, List/Describe/Get across services); defenders can observe its activity via CloudTrail events and the .sha256 report sidecars it writes locally

kosty from kosty-cloud positions itself at the intersection of two disciplines that usually live in separate toolchains: cloud security auditing and FinOps cost optimization. Written in Python 3.10+, MIT-licensed, and sitting at 272 stars, it packages 151 checks across 32 AWS services behind a single kosty audit invocation. The version documented in the README is v3.6.1, described as a "modular platform" rewrite — every command, whether the full audit or a per-service scan, runs through one plugin-based scan engine. That architectural decision matters for practitioners because it means a check added for one context is automatically available everywhere the engine runs, and the contribution workflow (kosty/providers/aws/services/ plus scripts/generate_manifest.py) formalizes extensibility with an integrity manifest.


The security half of the ledger is built around four pillars the README calls out explicitly. IAM privilege escalation detection covers 21 known escalation patterns, and the optional --deep flag confirms candidate paths using SimulatePrincipalPolicy rather than relying purely on static policy parsing — a meaningful distinction, since simulated results account for implicit denies and permission boundaries that pattern-matching approaches routinely get wrong. WAF hardening checks evaluate managed rules, rate limiting, bot control, logging, and action mode. API Gateway checks cover WAF association, authorization, throttling, TLS 1.2 enforcement, request validation, and CloudFront bypass detection — that last one being a classic gap where a regional endpoint remains directly reachable even though traffic is supposed to flow through a distribution.


Foundational and data-protection controls round out the check catalog: CloudTrail audit-trail coverage, GuardDuty threat detection enablement, AWS Config drift detection, VPC Flow Logs, KMS key rotation, S3 and RDS encryption, ElastiCache encryption in transit and at rest, and Secrets Manager rotation. What emerges from the service table is breadth over depth per service — 151 checks across 32 services averages under five checks each, but the coverage map is coherent: compute, storage, database, network, security, management, application, AI/ML, secrets, messaging, cache, certificates, containers, and patch management each get category-appropriate checks, from IMDSv1 usage on EC2 to privileged ECS task definitions to SSM patch compliance.


The most interesting capability for an attacker-surface perspective is kosty public-exposure. It maps 15 publicly exposed resource types — ALB, EC2, S3, RDS, API Gateway, Lambda URLs, CloudFront, OpenSearch, Redshift, EKS, ECR, SNS, SQS, and snapshots — and classifies each finding into a three-tier scheme: exposed and unprotected, exposed and partially protected, and exposed and protected with all protections verified. This is essentially an external-attack-surface inventory that an authorized assessor would otherwise assemble manually with a dozen aws CLI calls and a spreadsheet. The triage classification is what makes it useful: raw exposure is normal in cloud estates, but the delta between exposed and actually protected is where findings live.


The AI/ML audit deserves its own paragraph because it reflects where cloud estates are actually drifting. A dedicated kosty ai command targets Bedrock (12 checks) and SageMaker (8 checks). On the Bedrock side, the checks include guardrail presence — the prompt injection protection control — shadow AI detection for unapproved model usage, VPC endpoint enforcement, prompt caching, inference profiles, custom model encryption, logging, budget limits, TPM quota monitoring, cross-account model access, model sizing, and batch eligibility. On SageMaker, it hunts idle GPU endpoints, zombie notebooks, Spot training adoption, checkpointing, Inference Components, VPC endpoints, internet access, and root access. For assessors, shadow AI detection is quietly the most valuable check: unapproved GenAI usage is now a data-exfiltration channel that traditional CSPM tooling ignores entirely.


The cost side is where kosty differentiates from pure security scanners. Rather than emitting generic right-sizing recommendations, it computes actual monthly dollar amounts for 11 services, with the README citing illustrative figures like $280/mo for a stopped m5.2xlarge, $700/mo for an oversized db.r5.4xlarge, $33/mo per unused NAT gateway, $16/mo per target-less load balancer, and $0.40/mo per unused secret. These are estimates based on typical pricing rather than your exact bill, but the framing is operationally honest — findings become line items a manager can act on. Reports are emitted as JSON (kosty audit --output json) and rendered through a single-file, no-build-step dashboard at dashboard/index.html with Overview, Security, and Cost views, severity and service filtering, and per-finding drill-down. Two demo reports (demo_full_audit.json, demo_ai_audit.json) ship in the repo for evaluating the dashboard without connecting it to live data.


Installation and invocation are straightforward and the README's examples are representative of the whole surface: pip install kosty, a Docker image at ghcr.io/kosty-cloud/kosty:latest that mounts ~/.aws read-only, or a source install via pip install -e .. The core entry points are kosty audit --output all for the full sweep, kosty public-exposure --output console for exposure mapping, and kosty ai audit for the GenAI workload pass. The IAM escalation command, kosty iam check-privilege-escalation --deep, is the one place where the tool actively simulates policy evaluation rather than just reading state, and it is the command most likely to generate visible API activity in the target account.


Configuration is handled through kosty.yaml, and the schema shown in the README is well thought out for consulting and enterprise use. Profiles support both role_arn cross-account assumption and named aws_profile credentials, per-profile region lists, and max_workers concurrency tuning. Exclusions can suppress entire services or resources tagged with kosty_ignore=true, which is the right mechanism for keeping scan noise out of intentionally public or intentionally weird resources. The --profiles flag runs all configured profiles in parallel, and the --organization mode with --max-workers 20 extends this to organization-wide audits across hundreds of AWS accounts via cross-account role assumption — clearly aimed at MSPs and multi-tenant security teams.


There are thoughtful operational details scattered through the README that suggest the authors have run this against real environments. Local reports get a .sha256 sidecar for integrity verification, verified with sha256sum -c kosty_full_*.json.sha256 — a small touch, but one that matters when audit reports feed compliance evidence chains. Documentation is unusually complete for a tool at this maturity: full user guide, per-service check lists in docs/SERVICES.md, a CLI reference, examples, configuration guide, multi-profile guide, release notes, and an architecture document covering the plugin system and how to write new checks. The Docker image runs as a non-root user with credentials mounted read-only, which is the correct hygiene for a tool holding audit credentials.


From a defensive and operational-safety standpoint, kosty is a read-oriented auditor: it enumerates and evaluates configuration, and its most invasive action is calling SimulatePrincipalPolicy in deep mode, which is itself a non-mutating IAM API. Everything it does lands in CloudTrail as a heavy stream of List/Describe/Get events across dozens of services — which is exactly what defenders should expect to see, and also what blue teams can use as a detection template if similar enumeration appears without authorization. There is no exploitation functionality, no credential theft, and no mutation of the audited environment anywhere in the documented surface.


The commercial framing is worth noting for transparency: the README links to paid consulting at kosty.cloud and a Calendly booking, so the repository functions partly as an open-source funnel for professional services. That does not diminish the tool — the MIT license is genuine, the check catalog is substantial, and contribution paths are documented — but evaluators should understand the business model. The star-count ask in the README is a growth signal, not a quality one.


For authorized professionals, kosty fits a specific niche: it is what you run when you want a fast, repeatable, evidence-producing baseline of an AWS estate — before an engagement to scope the attack surface, during a review to catch the IAM and AI-workload gaps that generic CSPM tools miss, or on a schedule as a drift alarm for both security posture and spend. The combination of dollar-quantified cost findings, three-tier exposure classification, 21 escalation patterns with simulation-backed confirmation, and dedicated Bedrock/SageMaker coverage makes it a credible addition to an auditor's toolkit rather than yet another S3-bucket checker.



Official project repository for kosty-cloud/kosty.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/kosty-for-aws-cost-and-security.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.