CVE-2025-54799
Executive Summary
CVE-2025-54799 is a critical security vulnerability in the go-acme/lego library (versions 4.25.1 and below), which is a Let's Encrypt client and ACME library written in Go. The flaw lies in the github.com/go-acme/lego/v4/acme/api package, where the library fails to enforce HTTPS when communicating with Certificate Authorities (CAs) as an ACME client. This affects both the lego library and the lego CLI tool.
The vulnerability allows network-level attackers to intercept, read, and potentially modify ACME protocol communications. This compromises the confidentiality of sensitive data such as account identifiers, request identifiers, and other metadata exchanged during certificate lifecycle operations (registration, authorization, issuance, renewal, and revocation). The attack surface is broadened because the library does not enforce HTTPS on the initial discovery URL provided by the user, nor on subsequent URLs returned by the CA in directory and order objects.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is in a Go package (github.com/go-acme/lego/v4/acme/api). The lego library is a critical component in the Go ecosystem for ACME automation. Any application or service that imports this vulnerable version of the library is at risk. Supply chain attacks could exploit this by intercepting ACME traffic to steal certificates, impersonate clients, or disrupt certificate management. Users of the lego CLI tool are also directly affected. The fix is in version 4.25.2, which enforces HTTPS for all ACME API calls.
CVSS Breakdown & Threat Level
CVSS Score: 0.0 (NVD) – However, based on the vulnerability description, a more accurate score is calculated below.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Attack Vector (AV): Network – The attacker can exploit this remotely over the network.
- Attack Complexity (AC): Low – No special conditions are required; the attacker only needs to be on the network path.
- Privileges Required (PR): None – No authentication is needed.
- User Interaction (UI): None – The victim does not need to perform any action.
- Scope (S): Unchanged – The vulnerability affects only the component itself.
- Confidentiality (C): High – Sensitive ACME protocol data (account IDs, request IDs, etc.) is exposed.
- Integrity (I): None – The vulnerability does not allow modification of data.
- Availability (A): None – The vulnerability does not affect availability.
Threat Level: High – The vulnerability is easily exploitable over the network with no privileges, and it exposes sensitive information that could be used for further attacks (e.g., account hijacking, certificate theft).
Deep Dive & Mechanics
The ACME protocol (RFC 8555) mandates that all communications between the ACME client and the CA must occur over HTTPS to ensure confidentiality and integrity. The go-acme/lego library, in versions prior to 4.25.2, does not enforce this requirement.
Root Cause: The library's api package constructs HTTP requests without validating that the target URL uses the https:// scheme. This affects two key areas:
- Initial Discovery URL: The user provides a base URL (e.g.,
http://example.com/acme/directory). The library does not check if this URL uses HTTPS. - Directory and Order URLs: The CA returns URLs in the directory and order objects (e.g.,
"newNonce": "http://ca.example.com/acme/new-nonce"). The library blindly uses these URLs without enforcing HTTPS.
Attack Scenario:
- An attacker performs a Man-in-the-Middle (MitM) attack on the network path between the ACME client and the CA.
- The attacker intercepts the initial HTTP request (if the user provided an HTTP URL) or modifies the CA's response to include HTTP URLs.
- The attacker can then read all subsequent ACME protocol messages, including account registration details, authorization tokens, and certificate requests.
- This information can be used to impersonate the client, steal certificates, or disrupt the ACME process.
Impact: The primary impact is on confidentiality. An attacker can learn:
- Account identifiers (e.g., account URL, contact information).
- Request identifiers (e.g., order URLs, authorization URLs).
- Metadata about certificate requests (e.g., domains being validated).
- Potentially, the private key if it is transmitted (though ACME typically does not transmit private keys, the metadata could aid in targeted attacks).
Vulnerable vs. Patched Code
Vulnerable Code (v4.25.1 and below):
The vulnerable code is in the api package, likely in a function that makes HTTP requests. The following is a simplified representation:
// Vulnerable: No HTTPS enforcement
func (a *API) doRequest(method, url string, body io.Reader) (*http.Response, error) {
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
// ... set headers, etc.
return a.client.Do(req)
}
The url parameter is used directly without checking the scheme.
Patched Code (v4.25.2):
The fix enforces HTTPS by validating the URL scheme before making the request:
// Patched: Enforce HTTPS
func (a *API) doRequest(method, url string, body io.Reader) (*http.Response, error) {
parsedURL, err := url.Parse(url)
if err != nil {
return nil, err
}
if parsedURL.Scheme != "https" {
return nil, fmt.Errorf("ACME API requires HTTPS, got: %s", url)
}
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
// ... set headers, etc.
return a.client.Do(req)
}
Additionally, the library should validate the initial discovery URL provided by the user.
Exploitation & Lab Setup
Red Team (Offensive)
Prerequisites:
- A network position allowing MitM (e.g., same subnet, compromised router, ARP spoofing).
- A target using
go-acme/legov4.25.1 or below. - A CA that returns HTTP URLs in its directory (or a user who provides an HTTP discovery URL).
Lab Setup:
- Set up a MitM proxy (e.g., mitmproxy, Burp Suite) on the attacker machine.
- Configure the target to use the attacker's proxy (e.g., via environment variable
HTTP_PROXY). - Intercept traffic and modify the CA's directory response to replace
https://withhttp://in all URLs.
Exploitation Steps:
- Start the MitM proxy and configure the target to route through it.
- Run the lego client to perform an ACME operation (e.g.,
lego --email user@example.com --domains example.com --http run). - The proxy intercepts the initial request to the CA's directory.
- Modify the directory response to change all
https://URLs tohttp://. - The lego client will now communicate over HTTP, allowing the attacker to read all subsequent ACME messages.
Example mitmproxy script (Python):
from mitmproxy import http
def response(flow: http.HTTPFlow) -> None:
if "acme" in flow.request.pretty_url:
# Replace https with http in the response body
body = flow.response.text
body = body.replace("https://", "http://")
flow.response.text = body
Blue Team (Defensive)
Detection:
- Monitor network traffic for ACME-related communications over HTTP (port 80) instead of HTTPS (port 443).
- Look for
http://URLs in ACME directory responses. - Alert on any ACME client requests that do not use TLS.
Hunting:
- Search logs for lego client errors related to "HTTPS" or "scheme".
- Use the Sigma rule below to detect HTTP-based ACME traffic.
Mitigation:
- Immediately upgrade to
go-acme/legov4.25.2 or later. - If upgrade is not possible, enforce HTTPS at the network level (e.g., firewall rules blocking ACME traffic on port 80).
- Use a reverse proxy that enforces HTTPS for all outbound ACME connections.
Indicators of Compromise (IOCs)
- Network Traffic: ACME protocol messages (e.g.,
POST /acme/new-account,POST /acme/new-order) over HTTP (port 80) instead of HTTPS (port 443). - Log Entries: lego client logs showing URLs with
http://scheme. - File System: Configuration files or environment variables that set the ACME directory URL to an
http://address. - Process: lego CLI or any Go application using the vulnerable library making HTTP requests to ACME endpoints.
Detection Engineering
YARA Rule
rule CVE_2025_54799_ACME_HTTP_Traffic {
meta:
description = "Detects ACME protocol traffic over HTTP (CVE-2025-54799)"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-54799"
strings:
$acme_path = /\/acme\/(new-account|new-order|new-nonce|authz|challenge|cert|revoke)/ nocase
$http_scheme = "http://"
condition:
$acme_path and $http_scheme
}
Sigma Rule
title: ACME Protocol Traffic Over HTTP
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects ACME client communications over HTTP instead of HTTPS, indicating CVE-2025-54799 exploitation.
author: Valters IT
date: 2025/04/10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2025-54799
logsource:
category: network_connection
product: suricata
detection:
selection:
dest_port: 80
http.url|contains: "/acme/"
condition: selection
falsepositives:
- Legitimate ACME testing over HTTP in isolated environments
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET 80 (msg:"CVE-2025-54799 - ACME Protocol Over HTTP"; flow:to_server,established; content:"/acme/"; http_uri; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade to
go-acme/legov4.25.2 or later. This is the only complete fix. - Verify that all ACME directory URLs in your configuration use
https://. - Monitor network traffic for any ACME communications over HTTP.
Long-term Measures:
- Implement network-level enforcement of HTTPS for all ACME traffic (e.g., firewall rules, egress filtering).
- Use a web application firewall (WAF) or reverse proxy to inspect and validate ACME requests.
- Regularly audit dependencies for known vulnerabilities using tools like
go list -m alland vulnerability scanners. - Educate developers on the importance of enforcing HTTPS in protocol implementations.
Workaround (if upgrade is not possible):
- Manually patch the
doRequestfunction in theapipackage to enforce HTTPS (see patched code above). - Use a custom HTTP client that rejects non-HTTPS URLs.
Valters IT
Securing Digital Frontiers