Skip to main content
Moderne OnlyThis recipe is proprietary to Moderne and runs on the Moderne platform or CLI — it isn’t part of the open-source catalog. Available with a Moderne subscription.Contact Sales

Use VulnCheck Exploit Intelligence to fix vulnerabilities

Recipe IDio.moderne.vulncheck.FixVulnCheckVulnerabilities
Artifactio.moderne.recipe:rewrite-vulncheck

This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest patch version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the maximumUpgradeDelta option. Vulnerability information comes from VulnCheck Vulnerability Intelligence. The recipe has an option to limit fixes to only those vulnerabilities that have evidence of exploitation at various levels of severity.

Single recipeOpenRewriteModerne Proprietary License
Try in PlatformTry this recipe in the Moderne platform. Not a user yet? You’ll get a no-setup demo environment, with nothing to install or configure.

Options

5 parameters
1 required4 optional
ParameterExampleTypeRequired
apiTokenA_TOKEN_GENERATED_FROM_VULNCHECKStringRequired
The API token for the VulnCheck api
exploitMaturityweaponizedStringOptional
Fix only those vulnerabilities that have an exploit maturity level equal to or greater than the specified level.
maximumUpgradeDeltapatchUpgradeDeltaOptional
The maximum difference to allow when suggesting a dependency version upgrade. Patch version upgrades are the default and safest option, as patch releases assert full backwards compatibility with no breaking changes. Minor version upgrades can introduce new features but do not _typically_ include breaking changes. Major version upgrades will typically require code changes above and beyond this recipe.
overrideTransitivefalseBooleanOptional
When enabled transitive dependencies with vulnerabilities will have their versions overridden. By default only direct dependencies have their version numbers upgraded.
scopecompileStringOptional
Match dependencies with the specified scope. Default is compile. An explanation of what each scope means can be found in the [Apache Maven documentation](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope).

Examples

xml
ParameterValue
apiTokenvulncheck_93a74420e799d42d3c74b947dc7c729a873034543bc5bf20391278d9b2e94d80
scopenull
overrideTransitivenull
maximumUpgradeDeltanull
exploitMaturitynull
Before
<project>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
</dependencies>
</project>
After
<project>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
</dependencies>
</project>

Usage

Run this recipe

You will need to have configured the Moderne CLI on your machine before you can run the following command.

shell
mod run . --recipe FixVulnCheckVulnerabilities --recipe-option "apiToken=A_TOKEN_GENERATED_FROM_VULNCHECK" --recipe-option "scope=compile" --recipe-option "overrideTransitive=false" --recipe-option "maximumUpgradeDelta=patch" --recipe-option "exploitMaturity=weaponized"

If the recipe is not available locally, then you can install it using:

mod config recipes jar install io.moderne.recipe:rewrite-vulncheck:0.7.2

Data tables

Maven metadata failures
org.openrewrite.maven.table.MavenMetadataFailures

Attempts to resolve maven metadata that failed.

ColumnDescription
Group idThe groupId of the artifact for which the metadata download failed.
Artifact idThe artifactId of the artifact for which the metadata download failed.
VersionThe version of the artifact for which the metadata download failed.
Maven repositoryThe URL of the Maven repository that the metadata download failed on.
SnapshotsDoes the repository support snapshots.
ReleasesDoes the repository support releases.
FailureThe reason the metadata download failed.
Vulnerability report
org.openrewrite.java.dependencies.table.VulnerabilityReport

A vulnerability report that includes detailed information about the affected artifact and the corresponding CVEs.

ColumnDescription
ProjectThe name of the project / module taking the dependency. Relevant in repositories with multiple modules.
CVEThe CVE number.
GroupThe first part of a dependency coordinate com.google.guava:guava:VERSION.
ArtifactThe second part of a dependency coordinate com.google.guava:guava:VERSION.
VersionThe resolved version.
Fixed in versionThe minimum version that is no longer vulnerable.
Last affected versionThe last version which was vulnerable.
Version within deltaThe difference between the version in use and the fixed version is within the configured maximum version delta. The recipe attempted to upgrade the version in use to a fixed version.
SummaryThe summary of the CVE.
Base scoreThe calculated base score.
DepthZero for direct dependencies.
CWEsCommon Weakness Enumeration (CWE) identifiers; semicolon separated.
EPSSEPSS probability score (0.0 to 1.0), or null if no EPSS data available.
Vulnerability report with exploit intelligence
io.moderne.vulncheck.table.VulnerabilityReportWithExploits

A vulnerability report that includes detailed information about the affected artifact and the corresponding CVEs and enriched by VulnCheck exploit data.

ColumnDescription
ProjectThe name of the project / module taking the dependency. Relevant in repositories with multiple modules.
CVEThe CVE number.
GroupThe first part of a dependency coordinate com.google.guava:guava:VERSION.
ArtifactThe second part of a dependency coordinate com.google.guava:guava:VERSION.
VersionThe resolved version.
Fixed in versionThe minimum version that is no longer vulnerable.
Fixable with version update onlyWhether the vulnerability is likely to be fixed by increasing the dependency version only, with no code modifications required. This is a heuristic which assumes that the dependency is accurately versioned according to [semver](https://semver.org/).
SummaryThe summary of the CVE.
Base scoreThe calculated base score.
DepthZero for direct dependencies.
CWEsCommon Weakness Enumeration (CWE) identifiers; semicolon separated.
Exploit maturityThe maturity of the exploit.
Reported exploitWhether the vulnerability has been exploited.
Reported exploited by threat actorsWhether the vulnerability has been exploited by threat actors.
Reported exploited by ransomwareWhether the vulnerability has been exploited by ransomware.
Reported exploited by botnetsWhether the vulnerability has been exploited by botnets.
Source files that had results
org.openrewrite.table.SourcesFileResults

Source files that were modified by the recipe run.

ColumnDescription
Source path before the runThe source path of the file before the run. null when a source file was created during the run.
Source path after the runA recipe may modify the source path. This is the path after the run. null when a source file was deleted during the run.
Parent of the recipe that made changesIn a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all.
Recipe that made changesThe specific recipe that made a change.
Estimated time savingAn estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds.
CycleThe recipe cycle in which the change was made.
Source files that had search results
org.openrewrite.table.SearchResults

Search results that were found during the recipe run.

ColumnDescription
Source path of search result before the runThe source path of the file with the search result markers present.
Source path of search result after run the runA recipe may modify the source path. This is the path after the run. null when a source file was deleted during the run.
ResultThe trimmed printed tree of the LST element that the marker is attached to.
DescriptionThe content of the description of the marker.
Recipe that added the search markerThe specific recipe that added the Search marker.
Source files that errored on a recipe
org.openrewrite.table.SourcesFileErrors

The details of all errors produced by a recipe run.

ColumnDescription
Source pathThe file that failed to parse.
Recipe that made changesThe specific recipe that made a change.
Stack traceThe stack trace of the failure.
Recipe performance
org.openrewrite.table.RecipeRunStats

Statistics used in analyzing the performance of recipes.

ColumnDescription
The recipeThe recipe whose stats are being measured both individually and cumulatively.
Source file countThe number of source files the recipe ran over.
Source file changed countThe number of source files which were changed in the recipe run. Includes files created, deleted, and edited.
Cumulative scanning time (ns)The total time spent across the scanning phase of this recipe.
Max scanning time (ns)The max time scanning any one source file.
Cumulative edit time (ns)The total time spent across the editing phase of this recipe.
Max edit time (ns)The max time editing any one source file.