This repository contains CBOMkit-theia: a tool that detects cryptographic assets in container images as well as directories and generates CBOM.
Note
CBOMkit-theia is part of CBOMkit and meant to run in conjunction with the Sonar Cryptography Plugin.
██████╗██████╗ ██████╗ ███╗ ███╗██╗ ██╗██╗████████╗████████╗██╗ ██╗███████╗██╗ █████╗
██╔════╝██╔══██╗██╔═══██╗████╗ ████║██║ ██╔╝██║╚══██╔══╝╚══██╔══╝██║ ██║██╔════╝██║██╔══██╗
██║ ██████╔╝██║ ██║██╔████╔██║█████╔╝ ██║ ██║█████╗██║ ███████║█████╗ ██║███████║
██║ ██╔══██╗██║ ██║██║╚██╔╝██║██╔═██╗ ██║ ██║╚════╝██║ ██╔══██║██╔══╝ ██║██╔══██║
╚██████╗██████╔╝╚██████╔╝██║ ╚═╝ ██║██║ ██╗██║ ██║ ██║ ██║ ██║███████╗██║██║ ██║
╚═════╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝╚═╝ ╚═╝ by IBM Research
CBOMkit-theia analyzes cryptographic assets in a container image or directory.
It is part of cbomkit (https://github.com/cbomkit/cbomkit) donated to PQCA by IBM Research.
--> Disclaimer: CBOMkit-theia does *not* perform source code scanning <--
--> Use https://github.com/cbomkit/sonar-cryptography for source code scanning <--
Features
- Find certificates in your image/directory
- Find keys in your image/directory
- Find secrets in your image/directory
- Verify the executability of cryptographic assets in a CBOM (requires --bom to be set)
- Output: Enriched CBOM to stdout/console
Supported image/filesystem sources:
- local directory
- local application with dockerfile (ready to be build)
- local docker image from docker daemon
- local docker image as TAR archive
- local OCI image as directory
- local OCI image as TAR archive
- OCI image from OCI registry
- docker image
- image from singularity
Supported BOM formats (input & output):
- CycloneDXv1.6
Examples:
cbomkit-theia dir my/cool/directory
cbomkit-theia image nginx
Plugin Explanations:
> "certificates": Certificate File Plugin
Find x.509 certificates
> "javasecurity": java.security Plugin
Verify the executability of cryptographic assets from Java code
Adds a confidence level (0-1) to the CBOM components to show how likely it is that this component is actually executable
> "secrets": Secret Detection Plugin
Find secrets & keys (private, public and secret keys)
> "opensslconf": OpenSSL Configuration Plugin
Reads OpenSSL configuration files and adds tls protocol and cipher suites to CBOM
Usage:
cbomkit-theia [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
dir Analyze cryptographic assets in a directory
help Help about any command
image Analyze cryptographic assets in a container image
Flags:
-b, --bom string BOM file to be verified and enriched
--config string config file (default is $HOME/.cbomkit-theia.yaml)
--docker-host string Docker daemon socket (default "unix:///var/run/docker.sock")
-h, --help help for cbomkit-theia
--ignore strings file path patterns to ignore during scanning (glob syntax, e.g. 'testdata/,*.tmp')
--log-level string log level (trace, debug, info, warn, error, fatal, panic) (default "info")
-p, --plugins strings list of plugins to use (default [certificates,javasecurity,secrets,opensslconf,keys,vex])
--schema string BOM schema to validate the given BOM (default "provider/cyclonedx/bom-1.6.schema.json")
Use "cbomkit-theia [command] --help" for more information about a command.
- Go 1.26.8 or newer (minimum version declared in
go.mod) - Docker (or similar container runtimes)
- Recommended: Set the
DOCKER_HOSTenvironment variable (default:unix:///var/run/docker.sock)
- Recommended: Set the
docker build -t cbomkit-theia .
# CLI
docker run cbomkit-theia [command] > enriched_CBOM.jsongo mod download
go build
./cbomkit-theia [command] > enriched_CBOM.jsonCBOMkit-theia reads its configuration from $HOME/.cbomkit-theia/config.yaml. This file is automatically created on first run.
By default, all available plugins are enabled:
- certificates
- javasecurity
- secrets (private, public and secret keys)
- opensslconf
Important Note: The application is configured to ensure all plugins are always available. If you manually edit the configuration file to exclude specific plugins, CBOMkit-theia will detect this and automatically restore all plugins to their default enabled state on the next run. If you need to disable specific plugins for a particular run, use the -p flag instead of modifying the config file:
# Run with only specific plugins
./cbomkit-theia image nginx -p certificates -p secretsTo skip certain files during scanning (e.g., test fixtures or development artifacts), you can specify ignore patterns using glob syntax. Patterns can be provided via three sources, which are merged:
1. .cbomkitignore file (placed in the scanned directory root, gitignore-style):
# Skip test fixtures
testdata/
*_test_cert.pem
# Skip vendor/dependency dirs
vendor/
node_modules/
# Skip development secrets
.env
*.key.dev
2. Config file ($HOME/.cbomkit-theia/config.yaml):
ignore:
- testdata/
- "*.tmp"
- vendor/3. CLI flag (--ignore):
cbomkit-theia dir ./myproject --ignore "testdata/,*.tmp,vendor/"Patterns support doublestar glob syntax (e.g., **/*.pdf, *.tmp, dir/). Lines starting with # are treated as comments.
- A pattern without a
/(e.g.,*.tmp,secret.key) matches the file name at any depth. - A pattern that contains a
/anywhere (including a trailing one) is anchored to the scan root. For example,vendor/matches only<root>/vendor/and nota/vendor/. You can use**/vendor/to match the folder at any depth. - A leading
/or./is optional for patterns that already contain a/. It is useful for single files./secret.keymatches only the file at the root, whilesecret.keymatches it anywhere. - A pattern that ends with
/or/**(e.g.,vendor/,vendor/**) matches the whole directory. Such directories are skipped without being opened.**or/**skips everything. - A directory pattern can contain wildcards (e.g.,
**/node_modules/,src/*/gen/). All matching directories are skipped without being opened. - A pattern that ends with
/*(e.g.,docs/*) matches direct children only, nested directories likedocs/sub/are still scanned. [ ] { } * ? \are interpreted as glob syntax. If your ignore pattern contains any of them, and your goal is to match literally, you have to escape with\. For example,pages/[id]/matchespages/i/andpages/d/but notpages/[id]/, howeverpages/\[id\]/will only matchpages/[id]/. An invalid pattern (likepages/[id/) is logged as a warning and matches nothing.- Patterns match the path as walked, not the symlink target, so ignoring
real.txtdoes not excludelink.txt -> real.txt. In directory scans, symlinked directories are not followed. In images, they are, and their files are reported under the link path, sousr/lib/does not excludelib/...when/lib -> /usr/lib. To ignore them, add a pattern for the link path as well (e.g.,link.txt,lib/).
Note
For image scanning, .cbomkitignore is not applicable (there is no local directory root). Config and CLI patterns still apply.
java.securityConfiguration Plugin:- Searches the filessystem for the
java.securityfile and reads the configuration - Reads the
jdk.tls.disabledAlgorithmsproperty and checks if any of the algorithms are used in the given CBOM - Based on the results, a confidence level (
confidence_level) is assigned to the restricted (or not restricted) algorithms in the CBOM- A higher confidence level means that a component is more likely to be executable
- Searches the filessystem for the
- OpenSSL Configuration Plugin:
- Searches the filesystem for OpenSSL configuration files (e.g.,
openssl.cnf) - When an
openssl.cnffile is detected, it will be scanned and a file component will be created as part of the CBOM - Extracts and adds TLS protocol versions and cipher suites configured in the OpenSSL configuration to the CBOM
- Searches the filesystem for OpenSSL configuration files (e.g.,
- X.509 Certificate Plugin:
- Search the filesystem for X.509 certificates
- Add the certificates to the CBOM, as well as signature algorithms, public keys and public key algorithms
- Secret Plugin:
- Leverages gitleaks to find secrets and keys in the data source
- Add the secrets and keys (private, public and secret keys) to the CBOM
Additional plugins can be added by implementing the Plugin interface from cbomkit-theia/scanner/plugins and adding the plugins constructor to the GetAllPluginConstructors function in cbomkit-theia/scanner/scanner.go:
CBOMkit-theia performs several filesystem reads based on the user input and may print the contents of these files to the stderr console. Do not use this tools on untrusted input or provide the output to untrusted parties.
If you'd like to contribute to CBOMkit-theia, please take a look at our contribution guidelines. By participating, you are expected to uphold our code of conduct.
We use GitHub issues for tracking requests and bugs. For questions start a discussion using GitHub Discussions.