Find log injection vulnerabilities
org.openrewrite.java.security.search.FindLogInjectionArtifactorg.openrewrite.recipe:rewrite-java-securityFinds logging statements where HTTP request input flows unsanitized into the log argument, allowing attackers to inject forged log entries via CRLF injection (CWE-117). Sources are servlet request accessors (getParameter, getHeader, getReader, getInputStream, etc.), Spring WebRequest accessors, and Spring MVC handler parameters bound with @RequestParam, @PathVariable, @RequestHeader, @RequestBody, @RequestPart, @CookieValue, or @MatrixVariable. Uses taint analysis so input assigned to a variable, field, or built into a larger string before being logged is also detected.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.security.search.FindLogInjectionIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-java-security:RELEASEData tables
Structured output this recipe can produce.
- Taint flowRecords taint flows from sources to sinks with their taint types.
org.openrewrite.analysis.java.taint.table.TaintFlowTable - Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats