Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-103502 Overview
CVE-2026-103502 is an Improper Certificate Validation vulnerability [CWE-295] in hexpm/hex_core, the client library used by Erlang and Elixir tooling to interact with the Hex package repository. The default HTTP adapter, hex_http_httpc, fails to verify server TLS certificates on Erlang/OTP 24, and on OTP 25 when the operating system's CA certificates cannot be loaded. An attacker positioned to intercept HTTPS connections can impersonate hex.pm, repo.hex.pm, or any configured repository or API server. The flaw affects hex_core versions 0.1.0 through 0.19.x and is fixed in 0.20.0.
Critical Impact
Attackers who can intercept HTTPS traffic can impersonate Hex repositories, enabling delivery of malicious package metadata or tarballs to Erlang and Elixir build environments.
Affected Products
- hexpm/hex_core versions 0.1.0 up to (but not including) 0.20.0
- Applications on Erlang/OTP 24 using the default hex_http_httpc adapter
- Applications on Erlang/OTP 25 where the OS CA certificate store cannot be loaded
Discovery Timeline
- 2026-10-12 - CVE-2026-103502 published to NVD
- 2026-10-16 - Last updated in NVD database
Technical Details for CVE-2026-103502
Vulnerability Analysis
The vulnerability stems from how hex_core configures TLS when issuing HTTPS requests through Erlang's built-in httpc client. hex_core:default_config/0 selects the hex_http_httpc adapter. For HTTPS requests whose adapter config contains no ssl option, hex_http_httpc:http_options/2 attempts to build verification options using public_key:cacerts_get/0.
When that call raises an exception, the adapter prints a warning and sends the request without any ssl options. In that case, httpc falls back to the defaults of the ssl application, which prior to OTP 26 do not verify the server certificate. The result is unauthenticated HTTPS, allowing an in-path attacker to present any certificate and impersonate the repository.
Root Cause
public_key:cacerts_get/0 does not exist on OTP 24, so every HTTPS request from hex_core falls through to the insecure default path. On OTP 25, the function raises when no CA store is available on the host. In both cases, hex_core versions before 0.11.0 never set ssl options at all, so no server certificate verification occurs on OTP 25 or earlier, regardless of whether a CA store exists. Versions 0.11.0 through 0.19.x still inherit the insecure fallback when the CA store cannot be loaded.
Attack Vector
Exploitation requires an attacker with network-level interception capability, such as a rogue Wi-Fi operator, compromised upstream router, or a hostile proxy in a CI/CD pipeline. The attacker terminates the TLS connection using a self-signed or attacker-controlled certificate, then serves malicious responses purporting to come from hex.pm or repo.hex.pm. This can be used to deliver tampered package metadata, poisoned tarballs, or malicious API responses to downstream build systems.
%% Patched client interface introduced in hex_core (src/hex_http.erl)
%% Source: https://github.com/hexpm/hex_core/commit/fbb6d9de472e5edb8d6fb6b32a91cb266137892e
-module(hex_http).
-export([get/3]).
-type adapter() :: module().
-type status() :: non_neg_integer().
-type headers() :: map().
-callback get(URI :: string(), headers()) ->
{ok, status(), headers(), binary()} |
{error, term()}.
-callback user_agent_string() -> string().
-spec get(adapter(), string(), headers()) ->
{ok, {status(), headers(), binary()}} | {error, term()}.
get(Adapter, URI, Headers) ->
Headers2 = put_new("user-agent", user_agent(Adapter), Headers),
Adapter:get(URI, Headers2).
See the GitHub Security Advisory GHSA-p26c-h8c2-rwqj and the erlef CNA advisory for the full fix set.
Detection Methods for CVE-2026-103502
Indicators of Compromise
- Log lines from the hex_core adapter containing using default ssl options which are insecure on application startup or during package fetches.
- Unexpected certificate issuers presented by hosts resolving to hex.pm or repo.hex.pm in TLS inspection logs.
- Build artifacts whose checksums diverge from the values published by the Hex registry.
Detection Strategies
- Inventory Erlang and Elixir projects that depend on hex_core and flag any version earlier than 0.20.0, including transitive uses by rebar3, mix, and hex CLI tools.
- Query the Erlang runtime for erlang:system_info(otp_release) across build hosts; prioritize remediation on OTP 24 and OTP 25 systems without /etc/ssl/certs or an equivalent CA bundle.
- Correlate outbound TLS SNI for hex.pm and repo.hex.pm with the certificate chain observed on the wire to detect substitution.
Monitoring Recommendations
- Forward build-host and CI/CD runner logs to a centralized SIEM or data lake and alert on the hex_core insecure-SSL warning string.
- Monitor dependency manifests (rebar.lock, mix.lock) in source control for hex_core version regressions during pull-request review.
- Baseline the expected TLS certificate fingerprints for Hex endpoints and alert on deviation from egress traffic analysis.
How to Mitigate CVE-2026-103502
Immediate Actions Required
- Upgrade hex_core to version 0.20.0 or later in all applications, libraries, and build tooling.
- Upgrade the Erlang runtime to OTP 26 or later where feasible, because its ssl application defaults enable server certificate verification.
- On OTP 25 hosts that must remain, install an OS CA certificate bundle so public_key:cacerts_get/0 succeeds and the secure path is taken.
Patch Information
The fix is delivered in hex_core0.20.0. The changelog entry for the preceding hardening work (0.11.0) notes "Use secure SSL defaults for OTP 25+", and 0.20.0 closes the remaining gap on OTP 24 and on OTP 25 hosts lacking a CA store. The patch commits are available on GitHub (b7b3a42) and GitHub (fbb6d9d). See also the OSV record.
Workarounds
- Replace the default hex_http_httpc adapter with an HTTP client that enforces certificate verification by default, as recommended since hex_core 0.8.2.
- Explicitly pass ssl options including {verify, verify_peer} and a cacertfile path when constructing the adapter configuration.
- Route Hex traffic through a trusted internal mirror with pinned TLS termination until all consumers are upgraded to 0.20.0.
# Pin hex_core 0.20.0 or later in a rebar3-based project
# rebar.config
{deps, [
{hex_core, "0.20.0"}
]}.
# Pin hex_core in a Mix-based project
# mix.exs
defp deps do
[
{:hex_core, "~> 0.20.0"}
]
end
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

