Skip to content
Access control Write-up Intermediate

CVE-2025–46701 Bypass Tomcat CGI security constraints with a Cr

Tomcat's CGI servlet matched script paths case-sensitively, so on case-insensitive directories a differently-cased URL slipped past security constraints protecting the real script. Where PUT was enabled and the mapping was a wildcard extension, an attacker could upload a script with an upper-case name and then request it in lower case to execute it.

gregk4sec Follow

Published on medium.com

Given a protected (security-constraint enforced) cgi script URL: https://victim-website/cgi-bin/script.pl

gregk4sec with k4security Lab, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the CGI servlet's URL matching and security-constraint checks were case-sensitive while the filesystem was case-insensitive, so differently-cased paths referred to the same file but were not matched by the protection rules.

Impact

An attacker could reach a script that security constraints were meant to protect, and in the stated conditions could upload and execute arbitrary scripts, leading to remote code execution.

What the attacker needed

CGI servlet enabled; case-insensitive target directory; PUT enabled for RCE variant

How it was found

  1. Note the protected CGI script URL under the /cgi-bin/ mapping.
  2. Request the same script with different capitalisation to bypass the security constraint.
  3. Where the mapping is a wildcard extension and PUT is enabled, upload a script with an upper-case name.
  4. Request the uploaded script in lower case to execute it.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A web server can protect a file so only certain people reach it. Here the protection compared the file name letter by letter, but the underlying disk treated upper and lower case as the same file. So asking for the same script with different capitalisation got past the check, and in some setups an attacker could even upload and run their own script.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by gregk4sec

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.