GHSA-rfmp-97jj-h8m6 CVE-2021-22096
Improper Output Neutralization for Logs in Spring Framework
- Severity
- 4.3 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- 1.35%
- Chance of exploitation in the next 30 days. Higher than 71.55% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-117 Improper Output Neutralization for Logs
- Fix
- Available
- 2 packages have a fixed version
Description
In Spring Framework versions 5.3.0 - 5.3.10, 5.2.0 - 5.2.17, and older unsupported versions, it is possible for a user to provide malicious input to cause the insertion of additional log entries.
Affected versions
Maven
| Package | Vulnerable | Fixed in |
|---|---|---|
| org.springframework:spring | >= 5.2.0, < 5.2.18 |
5.2.18 |
| org.springframework:spring | >= 5.3.0, < 5.3.11 |
5.3.11 |
| org.springframework:spring-core | >= 5.3.0, < 5.3.11 |
5.3.11 |
| org.springframework:spring-core | >= 5.2.0, < 5.2.18 |
5.2.18 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
org.springframework:spring Maven → 5.2.18
- maven
<dependency><groupId>org.springframework</groupId><artifactId>spring</artifactId><version>5.2.18</version></dependency>- gradle
implementation("org.springframework:spring:5.2.18")
org.springframework:spring-core Maven → 5.3.11
- maven
<dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>5.3.11</version></dependency>- gradle
implementation("org.springframework:spring-core:5.3.11")
Severity breakdown
CVSS 3.1 4.3
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- Low
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- Low
- Availability
- None
Weakness
CWE-117: Improper Output Neutralization for Logs
The product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file.
How to prevent it
- Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- Implementation: Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
- Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
References
Advisories
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-659m-px2c-25wj Spring Framework Denial of Service via AntPathMatcher | High | Also affects org.springframework:spring-core |
| GHSA-jmp9-x22r-554x Spring Framework annotation detection mechanism may result in improper authorization | High | Also affects org.springframework:spring-core |
| GHSA-r4q3-7g4q-x89m Spring Framework server Web DoS Vulnerability | High | Also affects org.springframework:spring-core |
| GHSA-7phw-cxx7-q9vq Spring Framework is vulnerable to security bypass via mvcRequestMatcher pattern mismatch | High | Also affects org.springframework:spring |
| GHSA-wv88-pf73-x22p Improper Neutralization of Directives in Dynamically Evaluated Code in Spring Framework | High | Also affects org.springframework:spring-core |
| GHSA-f866-m9mv-2xr3 Spring Framework and Spring Security vulnerable to Deserialization of Untrusted Data | Medium | Also affects org.springframework:spring-core |
| GHSA-rhcg-rwhx-qj3j Improper Limitation of a Pathname to a Restricted Directory in Spring Framework | Medium | Also affects org.springframework:spring-core |
| GHSA-wjjr-h4wh-w6vv Spring Framework Inefficient Regular Expression Complexity | Medium | Also affects org.springframework:spring-core |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor