VulnWatch by ve1ve2
medium 4.9 EPSS 0.52%

GHSA-jw5r-xhf5-2xcq / CVE-2026-62947: ACL bypass and arbitrary root file read via cgi-io cgi-download

Source:
OpenWrt releases + advisories (GitHub openwrt/openwrt tags)
Published:
Fetched:
Updated:
Affects:
openwrt cgi-io (OpenWrt)

https://github.com/openwrt/openwrt/security/advisories/GHSA-jw5r-xhf5-2xcq ↗

repo-advisoryCWE-22securityrepo:openwrt/openwrt

ACL bypass and arbitrary root file read via cgi-io cgi-download ## Summary The `cgi-download` handler in cgi-io authorizes the requested `path` against the caller's ubus session `file` ACL and then opens it without canonicalizing the path first (`main.c:540`, `main.c:557`). rpcd's ACL matcher uses `fnmatch()` without `FNM_PATHNAME` (`session.c:146`), so a wildcard in an allowed ACL glob spans `/`. A request path of the form `/../../../` matches the literal allowed prefix during the ACL check, while the subsequent `open()` lets the kernel resolve the embedded `..` and reach a file outside that prefix. cgi-io runs as root, so the resolved target is any file readable by uid 0. The sibling upload handler and rpcd-mod-file both canonicalize before their ACL check and reject the same input. Result: a session holding the `cgi-io download` permission and any wildcard `file` read grant reads any root-readable file, including `/etc/shadow`, which the rpcd file API denies to that same session. ## Affected OpenWrt cgi-io, git HEAD `658b14b`, as shipped in OpenWrt 25.12.4 (r32933-4ccb782af7). `/www/cgi-bin/cgi-download` is a symlink to `/usr/libexec/cgi-io`. Requires an authenticated ubus session holding `cgi-io download` (access group `luci-mod-system-flash`) plus one wildcard `file` read grant: `luci-mod-system-repokeys` (`/etc/apk/keys/*`), `luci-mod-network-config` (`/proc/sys/net/ipv[46]/conf/*`), or `luci-mod-system-flash` itself (`/dev/mtdblock[0-9]*`). On a default single-root install the root LuCI session holds these grants. Deployments that delegate a restricted rpcd `config login` operator the flash access group are affected at a lower privilege tier. Unauthenticated requests are rejected at `main.c:537`; the read is not anonymously reachable. ## Root cause `main_download` reads the `path` POST field and passes it unmodified to `session_access(sid, "file", fields[3], "read")` (`main.c:540`) and then to `open(fields[3], O_RDONLY)` (`main.c:557`). rpcd evaluates the ACL with `fnmatch(acl->object, path, FNM_NOESCAPE)` (`session.c:146`), and the missing `FNM_PATHNAME` lets a `*` in an allowed glob match `/` and therefore an entire `../` traversal suffix. Because the ACL string and the `open()` string are the same raw bytes, the check passes against the allowed prefix while the kernel resolves the `..` to a file outside it. The upload handler canonicalizes with `canonicalize_path()` before its ACL check (`main.c:372`, `main.c:348`), and rpcd-mod-file canonicalizes at `file.c:264` before `rpc_file_access` at `file.c:272`, so both reject the identical traversal. cgi-io runs as root, so the missing canonicalization on the download path turns a path-scoped read grant into a read of any uid-0-readable file. ## Reproduction `openwrt/rootfs:x86_64-25.12.4` in Docker running uhttpd, ubusd, rpcd, rpcd-mod-file and LuCI, with a root password set and stock ACLs. The session below is a restricted operator holding only `luci-mod-system-flash` and `luci-mod-system-repokeys`. Affected packages: :cgi-io (OpenWrt)

Linked vulnerabilities (2)

CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N

ACL bypass and arbitrary root file read via cgi-io cgi-download

CWE: CWE-22Aliases: CVE-2026-62947
CVE-2026-62947 medium 4.9 EPSS 0.52% (p45) NVDCVE.orgGHSA
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N

ACL bypass and arbitrary root file read via cgi-io cgi-download

CWE: CWE-22Aliases: GHSA-jw5r-xhf5-2xcq