CVE-2023-36479
JSON

3.5low

Jetty vulnerable to errant command quoting in CGI Servlet

Severity
3.5low CVSS:3.1 by GitHub_M
Exploit likelihood
1.16% (higher than 68% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-3gh6-v5v9-6v9j

Description

Eclipse Jetty Canonical Repository is the canonical repository for the Jetty project. Users of the CgiServlet with a very specific command structure may have the wrong command executed. If a user sends a request to a org.eclipse.jetty.servlets.CGI Servlet for a binary with a space in its name, the servlet will escape the command by wrapping it in quotation marks. This wrapped command, plus an optional command prefix, will then be executed through a call to Runtime.exec. If the original binary name provided by the user contains a quotation mark followed by a space, the resulting command line will contain multiple tokens instead of one. This issue was patched in version 9.4.52, 10.0.16, 11.0.16 and 12.0.0-beta2.

Affected

Product or packageVersionsReported by
eclipse jetty.project>= 9.0.0, <= 9.4.51, >= 10.0.0, <= 10.0.15, >= 11.0.0, <= 11.0.15, <= 12.0.0-beta1CVE List
org.eclipse.jetty:jetty-servlets (Maven)from 9.0.0 before 9.4.52, from 10.0.0 before 10.0.16, from 11.0.0 before 11.0.16GitHub Advisory Database
org.eclipse.jetty.ee10:jetty-ee10-servlets (Maven)before 12.0.0-beta2GitHub Advisory Database
org.eclipse.jetty.ee9:jetty-ee9-servlets (Maven)before 12.0.0-beta2GitHub Advisory Database
org.eclipse.jetty.ee8:jetty-ee8-servlets (Maven)before 12.0.0-beta2GitHub Advisory Database
eclipse jettyfrom 9.0.0 before 9.4.52, from 10.0.0 before 10.0.16, from 11.0.0 before 11.0.16, 12.0.0NVD
debian debian_linux10.0, 11.0, 12.0NVD

All scores

GitHub_M3.5low CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:N/I:L/A:N
GitHub3.5low CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:N/I:L/A:N
NVD3.1low CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N

Classification

CWE-149

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

Eclipse Jetty Canonical Repository is the canonical repository for the Jetty project. Users of the CgiServlet with a very specific command structure may have the wrong command executed. If a user sends a request to a org.eclipse.jetty.servlets.CGI Servlet for a binary with a space in its name, the servlet will escape the command by wrapping it in quotation marks. This wrapped command, plus an optional command prefix, will then be executed through a call to Runtime.exec. If the original binary name provided by the user contains a quotation mark followed by a space, the resulting command line will contain multiple tokens instead of one. This issue was patched in version 9.4.52, 10.0.16, 11.0.16 and 12.0.0-beta2.

GitHub Advisory Database

If a user sends a request to a org.eclipse.jetty.servlets.CGI Servlet for a binary with a space in its name, the servlet will escape the command by wrapping it in quotation marks. This wrapped command, plus an optional command prefix, will then be executed through a call to Runtime.exec. If the original binary name provided by the user contains a quotation mark followed by a space, the resulting command line will contain multiple tokens instead of one. For example, if a request references a binary called file” name “here, the escaping algorithm will generate the command line string “file” name “here”, which will invoke the binary named file, not the one that the user requested.

if (execCmd.length() > 0 && execCmd.charAt(0) != '"' && execCmd.contains(" "))
execCmd = "\"" + execCmd + "\"";
Exploit Scenario

The cgi-bin directory contains a binary named exec and a subdirectory named exec” commands, which contains a file called bin1. The user sends to the CGI servlet a request for the filename exec” commands/bin1. This request will pass the file existence check on lines 194 through 205. The servlet will add quotation marks around this filename, resulting in the command line string “exec” commands/bin1”. When this string is passed to Runtime.exec, instead of executing the bin1 binary, the server will execute the exec binary with the argument commands/file1”. In addition to being incorrect, this behavior may bypass alias checks, and it may cause other unintended behaviors if a command prefix is configured.

If the useFullPath configuration setting is off, the command need not pass the existence check. The attack would not rely on a binary and subdirectory having similar names, and the attack will succeed on a much wider variety of directory structures.

Impact

Users of the org.eclipse.jetty.servlets.CGI Servlet with a very specific command structure may have the wrong command executed.

Patches

No patch. In Jetty 9.x, 10.x, and 11.x the org.eclipse.jetty.servlets.CGI has been deprecated. In Jetty 12 (all environments) the org.eclipse.jetty.servlets.CGI has been entirely removed.

Workarounds

The org.eclipse.jetty.servlets.CGI Servlet should not be used. Fast CGI support is available instead.

References
NVD (es)

Eclipse Jetty Canonical Repository es el repositorio canónico para el proyecto Jetty. Los usuarios de CgiServlet con una estructura de comando muy específica pueden ejecutar el comando incorrecto. Si un usuario envía una solicitud a un servlet org.eclipse.jetty.servlets.CGI para un binario con un espacio en su nombre, el servlet escapará del comando envolviéndolo entre comillas. Este comando empaquetado, más un prefijo de comando opcional, se ejecutará mediante una llamada a Runtime.exec. Si el nombre binario original proporcionado por el usuario contiene una comilla seguida de un espacio, la línea de comando resultante contendrá varios tokens en lugar de uno. Este problema se solucionó en las versiones 9.4.52, 10.0.16, 11.0.16 y 12.0.0-beta2.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-36479 changed 2025-06-18CVE Terms of Use
GitHub Advisory DatabaseGHSA-3gh6-v5v9-6v9j changed 2026-09-10CC-BY-4.0
NVDCVE-2023-36479 changed 2026-06-17Public domain