First published: Mon Oct 04 2021(Updated: )
<a href="https://issues.redhat.com/browse/KEYCLOAK-19422">https://issues.redhat.com/browse/KEYCLOAK-19422</a> <a href="https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/theme/ClasspathThemeResourceProviderFactory.java">https://github.com/keycloak/keycloak/blob/master/services/src/main/java/org/keycloak/theme/ClasspathThemeResourceProviderFactory.java</a> 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
Credit: secalert@redhat.com
Affected Software | Affected Version | How to fix |
---|---|---|
Redhat Keycloak | <15.1.0 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
CVE-2021-3856 is a vulnerability in ClassLoaderTheme and ClasspathThemeResourceProviderFactory that allows reading any file available as a resource to the classloader.
CVE-2021-3856 has a severity of medium with a CVSS score of 4.3.
Redhat Keycloak versions up to 15.1.0 are affected by 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.
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.