Skip to main content
Menu
Advisories

Path traversal in data-provider allows reading classpath JSON files

GHSA-CJF2-QM67-6HH8Published Updated GitHub

Description

DropdownJsonFileDataProvider and TranslationJsonFileDataProvider insert the user-supplied key query parameter into a classpath resource path without validating it. Path traversal sequences (../) let an authenticated user read any .json file on the application classpath.

Impact

Any authenticated user (ROLE_USER is sufficient) can read .json files outside the intended config/dropdown and config/translation folders, for example:

GET /api/v1/data/translation?key=../../META-INF/spring-configuration-metadata
GET /api/v1/data/translation/all?key=../../META-INF/spring-configuration-metadata

Reachable files include bundled form, case, dashboard and permission definitions, plugin configuration and third-party library metadata. The same flaw exists on the dropdown-list category. There the response is HTTP 500 for files that are not a string map, but the file has already been opened and parsed.

The impact is constrained by:

  • Only files with a .json extension are readable (the suffix is appended by the application)
  • Traversal is limited to the classpath, not the filesystem
  • Authentication is required
  • The access is read-only; POST and DELETE on these endpoints require the admin role

Affected code

  • com.ritense.dataprovider.defaultdataproviders.providers.dropdown.DropdownJsonFileDataProvider#get (classpath:config/dropdown/$key.json)
  • com.ritense.dataprovider.defaultdataproviders.providers.translation.TranslationJsonFileDataProvider#getTranslations (classpath:config/translation/$language.json)

Reachable through GET /api/v1/data/{category} and GET /api/v1/data/{category}/all for the dropdown-list and translation categories.

Patches

Fixed in 13.50.0. The path is now normalised and the request is treated as "not found" unless the resolved path still lies inside config/dropdown/ or config/translation/ (ClasspathJsonResourceResolver). Fixes are not backported; upgrade to 13.50.0 or later.

Workarounds

If you cannot upgrade yet, reject requests to /api/v1/data/* whose key query parameter contains .., %2e%2e or backslashes, for example with a reverse proxy or WAF rule.

Remediation for developers

Resolve the final path and verify it stays inside the intended base directory (the shipped fix). Optionally also restrict key to ^[a-zA-Z0-9_-]+$ in DataProviderConstants.getQueryKey() as an additional layer.

Credit

Reported by an external penetration test.

Affected versions

References

GitHub · valtimo-platform/valtimo