CVE-2021-3856: Path Traversal

Published Oct 4, 2021
·
Updated

ClassLoaderTheme and ClasspathThemeResourceProviderFactory allows reading any file available as a resource to the classloader. By sending requests for theme resources with a relative path from an external HTTP client, the client will receive the content of random files if available.

Other sources

https://issues.redhat.com/browse/KEYCLOAK-19422

https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/theme/ClasspathThemeResourceProviderFactory.java

The ThemeResource resource exposes an endpoint for fetching theme resources:

@GET @Path("/{version}/{themeType}/{themeName}/{path:.}") public Response getResource(@PathParam("version") String version, @PathParam("themeType") String themType, @PathParam("themeName") String themeName, @PathParam("path") String path) { ... }

The classbased resource loaders are implemented as:

public InputStream getResourceAsStream(String path) { return classLoader.getResourceAsStream(resourceRoot + path); }

This has no checks for the path parameter, allowing relative traversals like ../.

By sending requests for theme resources with a relative path from an external HTTP client, the client will receive the content of random files if available.

I practice this exposes any files packages within the deployed module, including other resources available as a classloader resource.

Disallowing double dots in the path component is probably the easiest fix

Red Hat

Affected Software

1 affected component
redhat Keycloak<15.1.0

Event History

Oct 4, 2021
Data Sourced
05:21 AM
DescriptionSeverityAffected Software
Aug 26, 2022
CVE Published
via MITRE·03:25 PM
Data Sourced
via MITRE·03:25 PM
DescriptionWeakness

Frequently Asked Questions

1

What is CVE-2021-3856?

CVE-2021-3856 is a vulnerability in ClassLoaderTheme and ClasspathThemeResourceProviderFactory that allows reading any file available as a resource to the classloader.

2

What is the severity of CVE-2021-3856?

CVE-2021-3856 has a severity of medium with a CVSS score of 4.3.

3

What software is affected by CVE-2021-3856?

Redhat Keycloak versions up to 15.1.0 are affected by CVE-2021-3856.

4

How can an attacker exploit CVE-2021-3856?

An attacker can exploit CVE-2021-3856 by sending requests for theme resources with a relative path from an external HTTP client, allowing them to receive the content of random files if available.

5

Is there a fix for CVE-2021-3856?

Yes, upgrading to a version of Redhat Keycloak that is not affected, such as version 15.1.1 or higher, will fix CVE-2021-3856.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203