opentelemetry-go: BSD kenv command not using absolute path enables PATH hijacking
Published 8 Apr 2026 · Updated 10 Sept 2026
Is your project on an affected go.opentelemetry.io/otel/sdk?
Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- >=1.15.0 <1.43.0
- Fixed in
- 1.43.0
go get go.opentelemetry.io/otel/sdk@v1.43.0Details
Summary
The fix for GHSA-9h8m-3fm2-qjrq (CVE-2026-24051) changed the Darwin ioreg command to use an absolute path but left the BSD kenv command using a bare name, allowing the same PATH hijacking attack on BSD and Solaris platforms.
Root Cause
sdk/resource/host_id.go line 42:
if result, err := r.execCommand("kenv", "-q", "smbios.system.uuid"); err == nil {
Compare with the fixed Darwin path at line 58:
result, err := r.execCommand("/usr/sbin/ioreg", "-rd1", "-c", "IOPlatformExpertDevice")
The execCommand helper at sdk/resource/host_id_exec.go uses exec.Command(name, arg...) which searches $PATH when the command name contains no path separator.
Affected platforms (per build tag in host_id_bsd.go:4): DragonFly BSD, FreeBSD, NetBSD, OpenBSD, Solaris.
The kenv path is reached when /etc/hostid does not exist (line 38-40), which is common on FreeBSD systems.
Attack
1. Attacker has local access to a system running a Go application that imports go.opentelemetry.io/otel/sdk
2. Attacker places a malicious kenv binary earlier in $PATH
3. Application initializes OpenTelemetry resource detection at startup
4. hostIDReaderBSD.read() calls exec.Command("kenv", ...) which resolves to the malicious binary
5. Arbitrary code executes in the context of the application
Same attack vector and impact as CVE-2026-24051.
Suggested Fix
Use the absolute path:
if result, err := r.execCommand("/bin/kenv", "-q", "smbios.system.uuid"); err == nil {
On FreeBSD, kenv is located at /bin/kenv.
Is GHSA-hfvc-g4fc-pqhx in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected go.opentelemetry.io/otel/sdk, and gives you the command that fixes it.
More advisories for go.opentelemetry.io/otel/sdk
- MediumCVE-2026-128085opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes · 13 Nov 2026
- LowCVE-2026-81869OpenTelemetry-Go: UTF-8 replacement rune bypasses attribute length truncation in go.opentelemetry.io/otel/sdk · 1 Oct 2026
- LowCVE-2026-81870OpenTelemetry-Go: Exporter config logging may leak endpoint URLs in info logs in go.opentelemetry.io/otel/exporters/otlp/otlptrace · 1 Oct 2026
- MediumCVE-2026-81869OpenTelemetry-Go: UTF-8 replacement rune bypasses attribute length truncation · 29 Sept 2026
- LowCVE-2026-81870OpenTelemetry-Go: Exporter config logging may leak endpoint URLs in info logs · 17 Sept 2026
- LowCVE-2026-24051OpenTelemetry Go SDK Vulnerable to Arbitrary Code Execution via PATH Hijacking in go.opentelemetry.io/otel/sdk · 19 Feb 2026
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.