FrankenPHP closed CVE-2026-24895 on January 26, 2026, a path-confusion RCE where strings.ToLower(path) expanded Ⱥ from two UTF-8 bytes to three and the index it returned no longer pointed at the same byte in the original URL. The patch rewrote splitPos() in cgi.go to walk the path byte by byte with an ASCII fast path, and added a Unicode-aware fallback for any non-ASCII byte using golang.org/x/text/search with search.IgnoreCase. The advisory on May 15, 2026 closes CVE-2026-45062 by deleting that fallback. Two distinct flaws in those eleven lines, one a stale control-flow flag, one a Unicode-equivalence fold of 𝗽𝗵𝗽 onto .php, both reported against the same function by the same researcher, both yielding RCE through attacker-uploadable .txt files routed as PHP. The fallback that closed CVE-2026-24895 in January is the code path that opens CVE-2026-45062 in May.
CVE-2026-45062: FrankenPHP's January Patch For The Last Unicode RCE Is The May Unicode RCE
vendor
pattern
cve
proof of concept
WithRequestSplitPath already rules out Unicode matches
FrankenPHP is a PHP application server written in Go by Kévin Dunglas, the maintainer of Symfony's Mercure and a Symfony Core contributor. It embeds the PHP interpreter into a Caddy server module and dispatches HTTP requests into PHP through a CGI-like environment. The function that decides which file on disk a request runs lives in cgi.go, at splitCgiPath():
func splitCgiPath(fc *frankenPHPContext) {
path := fc.request.URL.Path
splitPath := fc.splitPath
if splitPath == nil {
splitPath = []string{".php"}
}
if splitPos := splitPos(path, splitPath); splitPos > -1 {
fc.docURI = path[:splitPos]
fc.pathInfo = path[splitPos:]
fc.scriptName = strings.TrimSuffix(path, fc.pathInfo)
}
fc.scriptFilename = sanitizedPathJoin(fc.documentRoot, fc.scriptName)
fc.worker = workersByPath[fc.scriptFilename]
}splitPos() returns the byte index where path should be cut. Everything before becomes SCRIPT_NAME and resolves to a path on disk that PHP loads and executes. Everything after becomes PATH_INFO. The split entries (default [".php"]) are registered through WithRequestSplitPath, which is the canonical gate every Caddy site config goes through. Its body is short, and it states a precondition the rest of the code is allowed to rely on:
// WithRequestSplitPath contains a list of split path strings.
// Split paths can only contain ASCII characters.
// Comparison is case-insensitive.
func WithRequestSplitPath(splitPath []string) (RequestOption, error) {
var b strings.Builder
for i, split := range splitPath {
b.Grow(len(split))
for j := 0; j < len(split); j++ {
c := split[j]
if c >= utf8.RuneSelf {
return nil, ErrInvalidSplitPath
}
if 'A' <= c && c <= 'Z' {
b.WriteByte(c + 'a' - 'A')
} else {
b.WriteByte(c)
}
}
splitPath[i] = b.String()
b.Reset()
}
// ...
}Two facts are now guaranteed before any path arrives at splitPos: every byte of every split entry is < utf8.RuneSelf (ASCII), and every alphabetic byte is lower-case. The contract of splitPos is to find an ASCII case-insensitive occurrence of those bytes inside the request path. A byte >= utf8.RuneSelf in path can never participate in a legitimate match, because the split entry it would match against is ASCII by construction.
That is the precondition splitPos is built on, and the precondition the January patch decided to handle anyway.
The January patch added a Unicode fallback to enforce an ASCII match
CVE-2026-24895 was a length-expansion bug. The pre-January-2026 splitPos called strings.ToLower(path), ran strings.Index on the lowercased copy, and returned the byte offset. Some Unicode code points expand when lowercased: Ⱥ (U+023A, two bytes in UTF-8) folds to ⱥ (U+2C65, three bytes). A path of /ȺȺȺȺshell.php.txt.php would lowercase to a longer string, the index found inside the longer string would no longer point at the same byte in the original, and the slice operation in splitCgiPath would route payload.txt.php as the script and execute the wrong file. AbdrrahimDahmani reported it. The GHSA was published February 12, 2026.
The fix shipped on January 26, 2026 as commit 04fdc0c1, tagged in v1.11.2. It deleted the strings.ToLower(path) line, deleted the dependency on the lowercased copy, and rewrote the matcher as a byte loop:
var splitSearchNonASCII = search.New(language.Und, search.IgnoreCase)
func splitPos(path string, splitPath []string) int {
if len(splitPath) == 0 {
return 0
}
pathLen := len(path)
// We are sure that split strings are all ASCII-only and lower-case
// because of validation and normalization in WithRequestSplitPath
for _, split := range splitPath {
splitLen := len(split)
for i := 0; i < pathLen; i++ {
if path[i] >= utf8.RuneSelf {
if _, end := splitSearchNonASCII.IndexString(path, split); end > -1 {
return end
}
break
}
if i+splitLen > pathLen {
continue
}
match := true
for j := 0; j < splitLen; j++ {
c := path[i+j]
if c >= utf8.RuneSelf {
if _, end := splitSearchNonASCII.IndexString(path, split); end > -1 {
return end
}
break
}
if 'A' <= c && c <= 'Z' {
c += 'a' - 'A'
}
if c != split[j] {
match = false
break
}
}
if match {
return i + splitLen
}
}
}
return -1
}The comment two lines into the function is the prosecution's first exhibit: the author wrote down, as a contract, that split strings are ASCII-only because WithRequestSplitPath validated them. Two blocks below that comment, on the same indentation level, the author called search.New(language.Und, search.IgnoreCase) to handle the case where path[i] is not ASCII.
golang.org/x/text/search is the Unicode-correct collation library. search.IgnoreCase applies Unicode compatibility decomposition (NFKC) and full Unicode case folding before comparing. It is the right library for matching "München" against "MUNCHEN". It is the wrong library for matching against a four-byte ASCII string the same function just declared cannot contain non-ASCII bytes. The fallback was answering a question the precondition had already answered: there is no legitimate Unicode case in which a non-ASCII byte in the request path is part of a match against the ASCII-validated split entry. The correct answer was always "not a match." The fallback chose "ask the Unicode library."
The Unicode library was happy to answer.
Flaw 1: the inner loop breaks without resetting match
KC1zs4 reported the first flaw in GHSA-3g8v-8r37-cgjm. The inner for j loop walks the split string against the path starting at offset i. When a byte of the path is non-ASCII, the loop hits the fallback splitSearchNonASCII.IndexString(path, split). When that fallback returns -1, the loop breaks. It does not set match = false first.
The outer code then evaluates if match { return i + splitLen } with match still holding its initial value, true. The function returns an offset as if .php had been matched there. The split that follows treats whatever bytes sit at that offset as the script extension.
Concrete walk against /PoC-match-unset.¡.txt, which is 23 bytes (the ¡ U+00A1 is the two-byte UTF-8 sequence 0xC2 0xA1):
- Outer loop:
iwalks 0..15 (all ASCII, no first-byte match for.). i = 16:path[16] = '.'. Innerjloop starts.j = 0:c = '.',c == split[0]. Continue.j = 1:c = path[17] = 0xC2.c >= utf8.RuneSelf. Hit fallback.IndexString(path, ".php")finds no.php(literal or Unicode-equivalent) anywhere in the path. Returns-1. Innerbreakruns.matchwas never set tofalse.
- Outer code:
if match { return i + splitLen }. Returns16 + 4 = 20.
The advisory's PoC output confirms it:
/PoC-match-unset.¡.txt : 20splitCgiPath then slices path[:20] = "/PoC-match-unset.¡." (17 + 2 + 1 = 20 bytes, through the second dot). pathInfo = "txt". scriptName = "/PoC-match-unset.¡.". scriptFilename = "<documentRoot>/PoC-match-unset.¡.". PHP loads and executes the file at that path. The file's actual extension is the trailing ., not .php. PHP runs whatever PHP source is inside it.
The inner break reasoned about itself as "abandon the current starting offset and try the next one." It was sitting underneath a closure that reasoned about itself as "abandon the inner loop with a victory."
Flaw 2: search.IgnoreCase folds 𝗽𝗵𝗽 onto .php
The second flaw, originally filed as GHSA-v4h7-cj44-8fc8 and consolidated into the same advisory, exercises the outer fallback. When the very first byte under inspection is non-ASCII, the outer if path[i] >= utf8.RuneSelf { ... } branch runs and the request immediately reaches splitSearchNonASCII.IndexString(path, ".php"). This is the path-level Unicode search. search.New(language.Und, search.IgnoreCase) does NFKC decomposition and full Unicode case folding. Many code points fold onto ASCII ., p, h:
U+FE52﹒(small full stop) folds to.U+FF0E.(fullwidth full stop) folds to.U+FF50p(fullwidth lowercase p) folds topU+24DFⓟ,U+24DDⓗ(circled) fold top,hU+1D5FD𝗽(mathematical sans-serif bold p) folds topU+1D4C5𝓅(mathematical script p) folds top
The advisory's own reproducer covers every one of them:
/shell﹒php : 12
/shell.php : 12
/shell.php : 12
/shell.php : 12
/shell.ⓟⓗⓟ : 16
/shell.𝗽𝗵𝗽 : 19
/shell.𝓅𝒽𝓅 : 19
/shell.ⓟⓗⓟ.anything-after-payload.php : 16Each row is splitPos returning a position as if a literal .php lived at that byte offset. None of them are .php files. They are Unicode-equivalent renderings of the substring .php, baked into URL paths an attacker controls. The end-of-match offset goes back up the stack to splitCgiPath, which slices the original path there, and sanitizedPathJoin(documentRoot, scriptName) resolves to a file on disk that ends in .𝗽𝗵𝗽. The attacker uploaded that file. The file's contents are PHP. PHP runs.
The end-to-end demonstration from the advisory, against dunglas/frankenphp:latest before May 15:
docker run --rm -d --name frankenphp-poc \
-p 18080:8080 \
-v "$(pwd)/Caddyfile:/etc/frankenphp/Caddyfile:ro" \
-v "$(pwd)/public:/app/public" \
dunglas/frankenphp:latest
# Both files are real files on disk:
# /app/public/poc-match-unset.¡. (contents: <?php echo "marker=flaw1\n"; ?>)
# /app/public/poc-search-norm.𝗽𝗵𝗽 (contents: <?php echo "marker=flaw2\n"; ?>)
# Baseline: a .txt URL is not routed as PHP.
curl -i --path-as-is "http://127.0.0.1:18080/poc-match-unset.txt/trigger"
# Flaw 1: the Unicode byte after a dot stalls match=true.
curl -i --path-as-is "http://127.0.0.1:18080/poc-match-unset.%C2%A1.txt/trigger"
# Response body: marker=flaw1
# Flaw 2: a math-bold .php folds onto the literal under search.IgnoreCase.
curl -i --path-as-is \
"http://127.0.0.1:18080/poc-search-norm.%F0%9D%97%BD%F0%9D%97%B5%F0%9D%97%BD.anything-after-payload.php/trigger"
# Response body: marker=flaw2The CVSS vector is AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H, scored 8.1. The AC:H is the precondition that the attacker can place a file with a non-ASCII byte in its name inside FrankenPHP's document root. Uploads endpoints, package mirrors, user-content stores, anywhere a tenant chooses their own filename, all satisfy that precondition. WAFs that strip non-ASCII bytes from URL paths satisfy it negatively; the bytes are already in path by the time splitPos reads them.
The May patch deletes the January patch
Commit 2d0f4803, released as v1.12.3 on May 15, 2026, removes the golang.org/x/text/search import, deletes the splitSearchNonASCII package variable, and rewrites the matching loop without any Unicode-library fallback:
import (
"unsafe"
"github.com/dunglas/frankenphp/internal/phpheaders"
- "golang.org/x/text/language"
- "golang.org/x/text/search"
)
-var splitSearchNonASCII = search.New(language.Und, search.IgnoreCase)
-
func splitPos(path string, splitPath []string) int {
if len(splitPath) == 0 {
return 0
}
pathLen := len(path)
- // We are sure that split strings are all ASCII-only and lower-case because of validation and normalization in WithRequestSplitPath
for _, split := range splitPath {
splitLen := len(split)
+ if splitLen == 0 || splitLen > pathLen {
+ continue
+ }
- for i := 0; i < pathLen; i++ {
- if path[i] >= utf8.RuneSelf {
- if _, end := splitSearchNonASCII.IndexString(path, split); end > -1 {
- return end
- }
- break
- }
- if i+splitLen > pathLen {
- continue
- }
+ for i := 0; i <= pathLen-splitLen; i++ {
match := true
for j := 0; j < splitLen; j++ {
c := path[i+j]
-
if c >= utf8.RuneSelf {
- if _, end := splitSearchNonASCII.IndexString(path, split); end > -1 {
- return end
- }
+ match = false
break
}The new behavior is the only behavior the precondition ever permitted: any byte >= utf8.RuneSelf in the path is a non-match against the current split entry, full stop. The comment that used to apologize for the fallback is replaced with a comment that explains why the fallback was always wrong:
// Matching is strictly ASCII case-insensitive. Bytes >= utf8.RuneSelf
// in path never match any split entry: split strings are validated
// ASCII-only and lower-cased in WithRequestSplitPath, so any Unicode
// equivalence (e.g. fullwidth or mathematical letters folding to ASCII)
// would let an attacker upload a file whose name contains such code
// points and have it served as PHP. See GHSA-3g8v-8r37-cgjm and
// GHSA-v4h7-cj44-8fc8.The patch ships with eleven regression tests pinning the new behavior, named bluntly. non-ascii byte after dot must not match pins flaw 1. circled php must not match, mathematical sans-serif bold php must not match, fullwidth p in extension must not match pin flaw 2. The author who shipped the January code now ships the tests that would have caught it.
splitPos has produced two Unicode RCEs in four months
The blog catalog has a name for components that fail by class: design-debt-driver. The thesis is that some functions produce CVEs of the same shape across years because the design substrate is fertile for one specific bug family, and each patch closes the instance without closing the substrate. FrankenPHP's splitPos qualifies on the first CVE pair. CVE-2026-24895 (length-expansion under strings.ToLower) and CVE-2026-45062 (Unicode equivalence under search.IgnoreCase) are the same class: a Unicode-aware string operation imported into a context whose precondition was always "bytes, ASCII-only, byte offsets, no Unicode semantics, please." Both yielded RCE in the FrankenPHP process. Both were fixed by deleting the Unicode-aware operation and walking the bytes directly.
The pattern even names the failure mode of the maintenance loop: the substrate does not fix itself when an instance is patched. The January patch is the canonical case. The author understood the previous bug well enough to remove strings.ToLower(path) and rewrite the matcher byte by byte. In the same diff, the author added a Unicode-equivalence library to handle the case where the precondition's invariant was violated. The instance was closed. The substrate was not. The substrate produced the next instance 109 days later, by way of the very code the patch added.
KC1zs4 filed two GHSAs against splitPos (one for each flaw), and GitHub consolidated them after recognizing they were two flaws in the same eleven lines. One researcher, looking at one function for one afternoon, found two distinct RCE paths through the patch that was supposed to make the function safe.
The fix that took 109 days was not additive
The post-May-15 splitPos is a single tight byte loop with no library calls in the hot path. It does what WithRequestSplitPath told it the inputs would always allow it to do. The whole patch reads as a maintainer accepting that the previous fix had reached for the wrong tool, and that the right tool was no tool. There is no Unicode-aware fallback. There is no path under which a non-ASCII byte interacts with the split entry. There is no library call between the request URL and the disk path PHP loads.
There are also operators sitting on FrankenPHP 1.11.2 through 1.12.2 right now, because that range was the recommended fix for the previous RCE and the upgrade-on-CVE habit converged people into the window. Every one of them is carrying the fallback the May advisory removed.
PoC: GHSA-3g8v-8r37-cgjm
splitPos is now what WithRequestSplitPath always said it was: byte-level, ASCII-only, lower-cased. The 109-day patch that got there was the patch that deleted the previous patch.