Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all \u003cpre\u003e\u003ccode\u003e blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks"); } } catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); } })(); (function(){ try { var __m = "github.com"; var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length \u003e 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

cnspec

cnspec light-mode logocnspec dark-mode logo

Open source, cloud-native security and policy project

cnspec assesses your entire infrastructure's security and compliance. It finds vulnerabilities and misconfigurations across public and private cloud environments, Kubernetes clusters, containers, container registries, servers, endpoints, SaaS products, infrastructure as code, APIs, and more.

A powerful policy as code engine, cnspec is built upon Mondoo's security data fabric. It comes configured with default security policies that run right out of the box. It's both fast and simple to use!

Quick start

bash -c "$(curl -sSL https://install.mondoo.com/sh)"
cnspec scan local

cnspec scan example

Installation

Install cnspec with our installation script:

Linux and macOS

bash -c "$(curl -sSL https://install.mondoo.com/sh)"

Windows

Set-ExecutionPolicy Unrestricted -Scope Process-Force;
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://install.mondoo.com/ps1'));
Install-Mondoo;

If you prefer manual installation, you can find the cnspec packages in our releases.

Run a scan with policies

Use the cnspec scan subcommand to check local and remote targets for misconfigurations and vulnerabilities.

Local scan

This command evaluates the security of your local machine:

cnspec scan local

Remote scan targets

You can also specify remote targets to scan. For example:

# to scan a docker image:
cnspec scan docker image ubuntu:22.04
# scan public ECR registry
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/r6z5b8t4
cnspec scan docker image public.ecr.aws/r6z5b8t4
# to scan an AWS account using the local AWS CLI config
cnspec scan aws
# scan an EC2 instance with EC2 Instance Connect
cnspec scan aws ec2 instance-connect root@i-1234567890abcdef0
# to scan a Kubernetes cluster via your local kubectl config or a local manifest file
cnspec scan k8s
cnspec scan k8s manifest.yaml
# to scan a GitHub repositoryexport GITHUB_TOKEN=<personal_access_token>
cnspec scan github repo <org/repo>

📚 To learn more, read the cnspec docs.

Policies

cnspec policies are built on the concept of policy as code. cnspec comes with default security policies configured for all supported targets. The default policies are available in the content directory of this repository.

Vulnerability scan

cnspec scans for vulnerabilities in a wide range of platforms. Vulnerability scanning is not restricted to container images; it works for build and runtime as well.

cnspec vulnerability scan example

NOTE: Vulnerability scanning requires the client to be logged into Mondoo Platform.

Examples

# scan container image
cnspec vuln docker debian:12
# scan aws instance via EC2 instance connect
cnspec vuln aws ec2 instance-connect root@i-1234567890abcdef0
# scan instance via SSH
cnspec vuln ssh user@host
# scan windows via SSH or Winrm
cnspec vuln ssh user@host --ask-pass
cnspec vuln winrm user@host --ask-pass
# scan VMware vSphere ESXi hosts
cnspec vuln vsphere user@host --ask-pass
# scan Linux, Windows
cnspec vuln local
PlatformVersions
Alpine3.10 - 3.23
AlmaLinux8, 9, 10
Amazon Linux1, 2, 2023
Arch LinuxRolling
CentOS6, 7, 8, Stream
Debian8, 9, 10, 11, 12, 13
Fedora30 - 43
openSUSELeap 15, Leap 16
Oracle Linux6, 7, 8, 9, 10
Photon Linux2, 3, 4, 5
Red Hat Enterprise Linux6, 7, 8, 9, 10
Rocky Linux8, 9, 10
SUSE Linux Enterprise12, 15, 16
Ubuntu18.04, 20.04, 22.04, 24.04
VMware vSphere ESXi6, 7, 8
Windows10, 11, 2016, 2019, 2022, 2025

cnspec interactive shell

cnspec also provides an interactive shell to explore assertions. It helps you understand the assertions that security policies use, as well as write your own policies. It's also a great way to interact with both local and remote targets on the fly.

Local system shell

cnspec shell local

The shell provides a help command for information on the resources that power cnspec. Running help without any arguments lists all of the available resources and their fields. You can also run help <resource> to get more detail on a specific resource. For example:

cnspec>help ports
ports: TCP/IP ports on the system
list []port: List of all TCP/IP ports
listening []port: All listening ports

The shell uses auto-complete, which makes it easy to explore.

Once inside the shell, you can enter MQL assertions like this:

>ports.listening.none( port ==23 )

To clear the terminal, type clear.

To exit, either hit CTRL + D or type exit.

Prioritize risks that matter with Mondoo Platform

The Mondoo unified security platform finds and prioritizes vulnerabilities and misconfigurations that pose the highest risk to your business. Mondoo's security data fabric analyzes the threat and exposure of every finding within the unique context of your infrastructure. Instead of a flood of irrelevant security alerts, Mondoo shows you how you can make an immediate and significant impact on your security posture.

To get started, contact us.

To learn about Mondoo Platform, read the Mondoo Platform docs or visit mondoo.com.

Register cnspec with Mondoo Platform

To use cnspec with Mondoo Platform, generate a token in the Mondoo App, then run:

cnspec login --token TOKEN

Once authenticated, you can scan any target:

cnspec scan <target>

cnspec returns the results from the scan to STDOUT and to Mondoo Platform.

With an account on Mondoo Platform, you can upload policies:

cnspec bundle upload mypolicy.mql.yaml

Custom policies

A cnspec policy is simply a YAML file that lets you express any security rule or best practice for your fleet.

A few examples can be found in the examples folder in this repo. You can run any of these policies:

cnspec scan local -f examples/example.mql.yaml

If you're interested in writing your own policies or contributing policies back to the cnspec community, read Mondoo's Policy Authoring Guide.

Supported targets

TargetProviderExample
Ansible playbooksansiblecnspec shell ansible YOUR_PLAYBOOK.yml
Arista network devicesaristacnspec scan arista DEVICE_PUBLIC_IP --ask-pass
Atlassian organizationsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
AWS accountsawscnspec scan aws
AWS CloudFormation templatescloudformationcnspec scan cloudformation cloudformation_file.json
AWS EC2 EBS snapshotaws ec2 ebs snapshotcnspec scan aws ec2 ebs snapshot SNAPSHOTID
AWS EC2 EBS volumeaws ec2 ebs volumecnspec scan aws ec2 ebs volume VOLUMEID
AWS EC2 Instance Connectaws ec2 instance-connectcnspec scan aws ec2 instance-connect ec2-user@INSTANCEID
AWS EC2 instancessshcnspec scan ssh user@host
Confluence usersatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Container imagescontainer, dockercnspec scan container ubuntu:latest
Container registriescontainer registrycnspec scan container registry index.docker.io/library/rockylinux:8
DNS recordshostcnspec scan host mondoo.com
Dockerfilesdockercnspec shell docker file FILENAME
GitHub organizationsgithub orgcnspec scan github org mondoohq
GitHub repositoriesgithub repocnspec scan github repo mondoohq/cnspec
GitLab groupsgitlabcnspec scan gitlab --group mondoohq
Google Cloud projectsgcpcnspec scan gcp
Google Workspacegoogle-workspacecnspec scan google-workspace --customer-id CUSTOMER_ID --impersonated-user-email EMAIL --credentials-path JSON_FILE
IoT devicesopcuacnspec shell opcua
Jira projectsatlassiancnspec shell atlassian --host YOUR_HOST_URL --admin-token YOUR_TOKEN
Juniper Junos devicesjunoscnspec scan junos --hostname DEVICE_IP --username USER_NAME --identity-file SSH_IDENTITY_FILE
Kubernetes cluster nodeslocal, sshcnspec scan ssh user@host
Kubernetes clustersk8scnspec scan k8s
Kubernetes manifestsk8scnspec scan k8s manifest.yaml
Kubernetes workloadsk8scnspec scan k8s --discover pods,deployments
Linux hostslocal, sshcnspec scan local or

cnspec scan ssh user@host
macOS hostslocal, sshcnspec scan local or

cnspec scan ssh user@IP_ADDRESS
Microsoft 365 tenantsms365cnspec scan ms365 --tenant-id TENANT_ID --client-id CLIENT_ID --certificate-path PFX_FILE
Microsoft Azure instancessshcnspec scan ssh user@host
Microsoft Azure subscriptionsazurecnspec scan azure --subscription SUBSCRIPTION_ID
Okta orgoktacnspec scan okta --token TOKEN --organization ORGANIZATION
Oracle Cloud Interface (OCI)ocicnspec scan oci
Running containersdockercnspec scan docker CONTAINER_ID
Shodan search engineshodancnspec shell shodan
Slack teamslackcnspec scan slack --token TOKEN
SSL certificates on websiteshostcnspec scan host mondoo.com
Terraform HCLterraformcnspec scan terraform HCL_FILE_OR_PATH
Terraform planterraform plancnspec scan terraform plan plan.json
Terraform stateterraform statecnspec scan terraform state state.json
Vagrant virtual machinesvagrantcnspec scan vagrant HOST
VMware Cloud Directorvcdcnspec shell vcd user@domain@host --ask-pass
VMware vSpherevspherecnspec scan vsphere user@domain@host --ask-pass
Windows hostslocal, ssh, winrmcnspec scan local,

cnspec scan ssh Administrator@IP_ADDRESS --ask-pass or

cnspec scan winrm Administrator@IP_ADDRESS --ask-pass

Agent skills

cnspec includes agent skills that give coding agents MQL expertise and policy navigation capabilities. Skills work across Claude Code, Cursor, Gemini CLI, and Codex.

SkillDescription
mqlMQL query development with syntax guidance, platform-specific patterns, and schema discovery
policy-graphNavigate policy bundles using graph commands — search, trace compliance mappings, explore structure

See skills/README.md for installation instructions and details.

What's next?

There are so many things cnspec can do, from testing your entire fleet for vulnerabilities to gathering information and creating reports for auditors. With its custom policies, cnspec can scan any component you care about!

Explore our:

Join the community!

Our goal is to secure all layers of your infrastructure. If you need support or want to get involved with the development of cnspec, join our community today and let's grow it together!

Development

See our development documentation for information on building and contributing to cnspec.

Legal

  • Copyright: 2018-2026, Mondoo, Inc.
  • License: BUSL 1.1
  • Authors: Christoph Hartmann, Dominik Richter

About

An open source, cloud-native security to protect everything from build to runtime

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages