CVE-2022-31679

Information Exposure
Affects
Spring Data REST
in
Spring
No items found.
Versions
>=3.5.0 <=3.5.12, >= 3.6.0 < 3.6.7, >= 3.7.0, < 3.7.3
Exclamation circle icon
Patch Available

This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.

Overview

Spring Data REST automatically exposes Spring Data repositories as RESTful endpoints, providing HATEOAS driven HTTP resources over JPA entities with minimal boilerplate.

A vulnerability (CVE-2022-31679) exists in Spring Data REST's handling of JSON Patch requests (application/json-patch+json). The framework fails to enforce Jackson serialization annotations when applying patch operations to domain objects. This is an instance of Improperly Controlled Modification of Dynamically-Determined Object Attributes (CWE-915), where an attacker exploits insufficient validation of user-supplied input to override variables that should be protected.

In this case, entity fields hidden by @JsonIgnore or @JsonIgnoreProperties can still be modified via carefully crafted JSON Patch requests. An attacker understanding the domain model can write to sensitive properties like passwords or PII that were intentionally hidden from the REST interface.

This issue spans multiple release trains of the spring-data-rest-webmvc and spring-data-rest-core packages.

Details

Module Info

Vulnerability Info

This vulnerability affects applications using Spring Data REST that allow HTTP PATCH operations on repository resources. The problem is that the JSON Patch processor modifies domain objects directly, ignoring Jackson's annotation based visibility rules.

Exploitation is possible when:

  • The application exposes JPA entities via Spring Data REST.
  • Entity fields are marked non-serializable with @JsonIgnore or @JsonIgnoreProperties.
  • The application accepts application/json-patch+json HTTP PATCH requests.
  • The attacker knows the entity's field names.

An attacker can send a JSON Patch replace operation targeting a protected field. Since the patch processor bypasses Jackson's controls, the hidden field is modified in the data store, even though standard REST serialization would exclude it.

While rated Low severity (CVSS 3.7) due to confidentiality impact, the practical risk is higher if hidden fields contain credentials, as the flaw in the affected code also permits unauthorized writes.

Mitigation

Only recent versions of Spring Data REST receive community security patches. Older release trains (such as the 3.5.x line used with Spring Boot 2.5.x) have no publicly available fix. For more information, see here.

Users of the affected components should apply one of the following mitigations:

  • Upgrade to community-supported versions of Spring Data REST

If HTTP PATCH support is not required for your application, disable it as a workaround. Spring Data REST allows you to restrict which HTTP methods are exposed either globally or per-repository. You can disable PATCH for all resources using the ExposureConfiguration API:

@Configuration
public class RestConfig implements RepositoryRestConfigurer {
  @Override
  public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config, CorsRegistry cors) {
    ExposureConfiguration exposureConfig = config.getExposureConfiguration();

    exposureConfig.withItemExposure((metadata, httpMethods) -> httpMethods.disable(HttpMethod.PATCH));
  }
}

See the Spring Data REST reference documentation for full details on customizing HTTP method exposure.

Leverage a commercial support partner like HeroDevs for post-EOL security support.

Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Medium
ID
CVE-2022-31679
PROJECT Affected
Spring Data REST
Versions Affected
>=3.5.0 <=3.5.12, >= 3.6.0 < 3.6.7, >= 3.7.0, < 3.7.3
NES Versions Affected
Published date
March 24, 2026
≈ Fix date
March 11, 2026
Category
Information Exposure
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Spring
Rss feed icon
Subscribe via RSS
or

By clicking “submit” I acknowledge receipt of our Privacy Policy.

Thanks for signing up for our Newsletter! We look forward to connecting with you.
Oops! Something went wrong while submitting the form.