Tomcat RewriteValve and Security Constraint CVE Check
Check from your files whether CVE-2026-65927 (RewriteValve [N] flag) and CVE-2026-65182 (security constraint bypass) apply to Tomcat, and what to upgrade to.
Two Tomcat advisories made public on 2026-08-25 are rated Important and fixed in 11.0.25, 10.1.59 and 9.0.121. This article covers only how to tell from your files whether they apply and which release to move to. The entries are on the security pages for Tomcat 11, 10 and 9. The commands to download and install a new release are in step 5 of the October security release manual and are not repeated here.
[1] Read the affected ranges. The values are "Affects" and "Fixed in" from the security pages.
| CVE | What it is | 11.x affected | 10.1 affected | 9.0 affected |
|---|---|---|---|---|
| CVE-2026-65927 | An off-by-one in the [N] flag of the RewriteValve restarts rewriting at the second rule instead of the first, and may bypass access control | 11.0.0-M1 to 11.0.24 | 10.1.0-M1 to 10.1.57 | 9.0.0-M1 to 9.0.120 |
| CVE-2026-65182 | Security constraint bypass when a constraint for a longer path is declared before a more restrictive constraint for a shorter path (the advisory says "shorter sub-path") | 11.0.0-M1 to 11.0.24 | 10.1.0-M1 to 10.1.57 | 9.0.0.M1 to 9.0.120 |
| Fixed in | 11.0.25 | 10.1.59 | 9.0.121 |
10.1.58 appears in neither the affected nor the fixed list. According to the 10.1.59 section, the 10.1.58 candidate that first carried the fixes did not pass its vote. On 10.1, move to 59 or later.
[2] Start with the version. The 11.0.26 below is after 11.0.25, so it is outside the ranges above.
$ $CATALINA_HOME/bin/version.sh | head -3$ $CATALINA_HOME/bin/version.sh | head -3Server version: Apache Tomcat/11.0.26Server built: Sep 9 2026 21:36:42 UTCServer number: 11.0.26.0If the version is in range, narrow it down with the next three steps. If not, go to step 7.
[3] CVE-2026-65927 matters only when the RewriteValve is used. Find where the valve is declared. For a whole host it is inside <Host> in server.xml; for one web application it is that application's META-INF/context.xml (rewrite documentation).
$ grep -rn RewriteValve conf webapps$ find conf webapps -name rewrite.config$ grep -rn RewriteValve conf webappswebapps/shop/META-INF/context.xml:2: <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />$ find conf webapps -name rewrite.configconf/Catalina/localhost/rewrite.configwebapps/shop/WEB-INF/rewrite.config[4] Look for rules that use the [N] flag (also written next). According to the documentation, the flag reruns the rules from the first one with the URL as just rewritten.
$ grep -rnE "^RewriteRule .*\[([^]]*,)?(N|next)(,[^]]*)?\]" conf webapps --include=rewrite.config$ grep -rnE "^RewriteRule .*\[([^]]*,)?(N|next)(,[^]]*)?\]" conf webapps --include=rewrite.configconf/Catalina/localhost/rewrite.config:2:RewriteRule ^/a/(.*)$ /b/$1 [N]conf/Catalina/localhost/rewrite.config:3:RewriteRule ^/c/(.*)$ /d/$1 [NC,next]No output means there is no [N] in that configuration. If the rule file of a valve found in step 3 has an [N] line, the configuration matches this advisory and you upgrade. The regular expression misses rules that put spaces between the flags, so scan the files by eye as well.
[5] CVE-2026-65182 does not depend on the RewriteValve; it depends on the order of <security-constraint> elements in web.xml. The advisory's wording is "a constraint for a longer path was specified before a more restrictive constraint for a shorter sub-path": a constraint on a longer path declared before a more restrictive constraint on a shorter path. List paths and access conditions in declaration order.
import sysimport xml.etree.ElementTree as ETdef tag(e): return e.tag.split("}")[-1]for i, sc in enumerate([e for e in ET.parse(sys.argv[1]).iter() if tag(e) == "security-constraint"], 1): pats = [p.text for p in sc.iter() if tag(p) == "url-pattern"] methods = [tag(m) + ":" + str(m.text) for m in sc.iter() if tag(m) in ("http-method", "http-method-omission")] ac = [e for e in sc if tag(e) == "auth-constraint"] if not ac: auth = "absent" else: roles = [r.text for r in ac[0].iter() if tag(r) == "role-name"] auth = "roles=" + str(roles) if roles else "empty" print(i, pats, "auth=" + auth, "methods=" + (str(methods) if methods else "all"))$ python3 constraints.py blog/WEB-INF/web.xml$ python3 constraints.py blog/WEB-INF/web.xml1 ['/admin/reports/*'] auth=roles=['auditor'] methods=['http-method:GET']2 ['/admin/*'] auth=empty methods=all3 ['/public/*'] auth=absent methods=allIn the output, auth= shows each constraint's access condition. absent means there is no <auth-constraint> (the constraint does not restrict access), empty means an empty <auth-constraint/> (which blocks all access under the Servlet specification), and roles= lists the permitted roles. methods= appears only when the constraint is narrowed with <http-method> or <http-method-omission>.
The layout in the advisory needs both the order and the strictness to match. In the sample file constraint 1 (/admin/reports/*, the longer path) is declared before constraint 2 (/admin/*, a shorter path), and constraint 2 is an empty <auth-constraint/>, which reads as stricter than constraint 1, so the sample matches the advisory's layout. If two constraints differ only in roles (for example auditor and admin), the script cannot tell which is stricter, so decide by the application's intent. If you find a matching pair, or cannot decide, do not stop at reordering the declarations; upgrade. This article does not present reordering as a fix.
[6] Decide per advisory when the version is in range.
- CVE-2026-65927 applies: step 3 shows a declared valve, and the
rewrite.configit reads has an[N]line from step 4. - CVE-2026-65182 applies: step 5 shows a longer-path constraint declared first, with a shorter-path constraint that is more restrictive (or you cannot tell).
- If neither holds, the configuration is not affected within what this article checks. That is not a guarantee of safety. Upgrade anyway when the version is in range: configuration changes later, while an unpatched version stays as it is.
[7] The release to move to is the fixed release in the table or later. The October security releases (released October 12, made public October 20: 11.0.27, 10.1.61 and 9.0.123) are the latest, so going straight to them is better, and they also carry the AJP and HTTP/2 fixes. After upgrading, run version.sh from step 2 again.
Where the check gets confusing
- The end of the affected range differs by branch. The same fix landed in 11.0.25 for 11.x, 10.1.59 for 10.1 and 9.0.121 for 9.0; all three releases came out in August (18 to 20).
- CVE-2026-65927 matters only where the valve is declared. A
rewrite.configwithout a valve does not apply. - The URL-decoding issue in the same valve (CVE-2026-59083, Low) was fixed earlier (11.0.24 and 10.1.57). A release at or above the fixed releases above includes it.
- A distribution package can carry a fix without raising the version number. This was not tested.