CVE-2022-32532

Authorization Bypass
Affects
Apache Shiro
in
Apache Shiro
No items found.
Versions
<1.9.1

Patch Available.

Exclamation circle icon
Patch Available

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

Overview

Apache Shiro is an open-source Java security framework that performs authentication, authorization, cryptography, and session management for applications ranging from small mobile apps to large web and enterprise systems. Its shiro-web module installs Shiro as a servlet filter chain that enforces path-based authentication and authorization rules in front of the application.

An authorization bypass vulnerability (CVE-2022-32532) has been identified in Apache Shiro, which allows attackers to bypass the authentication and authorization rules enforced by a regex-based filter chain by including a newline character in the request path.

Per CWE-863: the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.

This issue affects all versions of Apache Shiro prior to 1.9.1.

Details

Module Info

Vulnerability Info

This Critical-severity vulnerability is found in the org.apache.shiro:shiro-core package in all versions of Apache Shiro prior to 1.9.1. Shiro guards URL paths with chains of authentication and authorization filters, and the matcher that decides which chain applies to a request path is pluggable. When an application configures the regex-based RegExPatternMatcher (for example on PathMatchingFilterChainResolver or a PathMatchingFilter), every path pattern is compiled with no regex flags:

public boolean matches(String pattern, String source) {
    if (pattern == null) {
        throw new IllegalArgumentException("pattern argument cannot be null.");
    }
    Pattern p = Pattern.compile(pattern);
    Matcher m = p.matcher(source);
    return m.matches();
}

Without the Pattern.DOTALL flag, the regex metacharacter . does not match newline characters such as \n or \r. A pattern like /admin/.*, written with the intent of covering everything under /admin/, therefore fails to match a request path that contains a trailing or embedded newline, for example /admin/page\n. On servlet containers that pass such characters through in the request URI, an attacker can append a newline to the path so that the request no longer matches the .-based pattern guarding a filter chain, and the security filters that should have applied are skipped. The result is an authentication and authorization bypass.

Shiro's default path matcher is the non-regex AntPathMatcher, so only applications that explicitly configure RegExPatternMatcher and guard paths with .-based regular expressions are exposed.

Mitigation

Apache Shiro 1.x is End-of-Life and no longer receives open-source updates to address this issue. The final 1.x release was 1.13.0; as of February 28, 2024, Shiro v1 was superseded by v2.

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

  • Upgrade Apache Shiro to a currently supported release line that contains the fix, first shipped upstream in Apache Shiro 1.9.1.
  • Leverage a commercial support partner like HeroDevs for post-EOL security support.

Credits

  • 4ra1n (finder)
Vulnerability Details
Severity
Level
CVSS Assessment
Low
>=0 <4
Medium
>=4 <6
High
>=6 <8
Critical
>=8 <10
Critical
ID
CVE-2022-32532
PROJECT Affected
Apache Shiro
Versions Affected
<1.9.1
NES Versions Affected
Published date
June 28, 2022
≈ Fix date
September 25, 2026
Category
Authorization Bypass
Vex Document
Download VEXHow do I use it?
Sign up for the latest vulnerability alerts fixed in
NES for Apache Shiro
Rss feed icon
Subscribe via RSS
or

By submitting the form 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.