Skip to content

EEF-CVE-2026-103502 CVE-2026-103502 GHSA-p26c-h8c2-rwqj

hex_core's default HTTP adapter doesn't verify TLS certificates on OTP 24 and 25

Not rated yet Hex
Severity
0.0 / 10
Unknown · CVSS 4.0
Exploit chance (EPSS)
0.24%
Chance of exploitation in the next 30 days. Higher than 15.39% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-295 Improper Certificate Validation
CWE-636 Not Failing Securely ('Failing Open')
Fix
0.20.0
Upgrade hex_core to this version or later

Description

Summary

Improper Certificate Validation vulnerability in hexpm hex_core allows an attacker who can intercept HTTPS connections to impersonate hex.pm, repo.hex.pm or any other repository or API server to programs that use hex_core's default HTTP adapter on Erlang/OTP 24, or on OTP 25 when the operating system's CA certificates can't be loaded.

hex_core:default_config/0 selects the built-in hex_http_httpc adapter. For an HTTPS request whose adapter config has no ssl option, hex_http_httpc:http_options/2 builds options that verify the server certificate against public_key:cacerts_get/0. When that call raises, the adapter prints a warning and sends the request without ssl options, so httpc uses the defaults of the ssl application, which before OTP 26 don't verify the server certificate. public_key:cacerts_get/0 doesn't exist on OTP 24, so every HTTPS request falls back there, and on OTP 25 it raises when no CA store is found. hex_core versions before 0.11.0 never set ssl options, so they don't verify the server certificate on OTP 25 and earlier whether or not a CA store is found.

The fallback was intended and documented, but the documentation didn't make clear that it meant no certificate verification. Since hex_core 0.8.2 the README has warned that the built-in httpc adapter "has insecure default settings" and recommended other HTTP clients, and the adapter prints "using default ssl options which are insecure" on every request that falls back. hex_core 0.11.0 added certificate verification with the changelog entry "Use secure SSL defaults for OTP 25+". Neither the README nor the warning says that the server certificate isn't verified, the README doesn't say which OTP versions the warning applies to, and on OTP 25 without CA certificates the warning tells users to upgrade to OTP 25 or later, which they already run. This advisory is published so that users who took those notices as general advice know their HTTPS requests weren't authenticated.

This issue affects hex_core: from 0.1.0 before 0.20.0.

Details

  1. hex_core:default_config/0 sets http_adapter to {hex_http_httpc, #{profile => default}}.
  2. hex_http_httpc:request/5 and hex_http_httpc:request_to_file/6 build their httpc options with http_options/2.
  3. For an https URI whose adapter config has no ssl entry in http_options, http_options/2 adds {ssl, [{verify, verify_peer}, {cacerts, public_key:cacerts_get()}, ...]} inside a try.
  4. When public_key:cacerts_get/0 raises (undef on OTP 24; an error on OTP 25 when no CA store is found), the catch prints a warning with io:format/1 and returns the options without ssl.
  5. httpc then uses the ssl application's defaults, which are verify_none before OTP 26, and completes the handshake with any certificate.
  6. hex_core before 0.11.0 (e57b4fb) had no step 3: it never passed ssl options, so step 5 applied on every OTP version before 26.

Proof of concept

  1. Compile src/hex_http.erl and src/hex_http_httpc.erl from hex_core main 4fbc5d1 in the erlang:24 Docker image and run hex_http_httpc:request(get, <<"https://self-signed.badssl.com/">>, #{}, undefined, #{profile => default}) after starting inets and ssl.
  2. The adapter prints [hex_http_httpc] using default ssl options which are insecure. and returns {ok, {200, Headers, Body}} from the server with the self-signed certificate.
  3. In the erlang:25 image with an empty tmpfs mounted on /etc/ssl/certs, public_key:cacerts_get/0 raises and the request also returns {ok, {200, ...}}.
  4. In the erlang:25 image with the CA store present (150 certificates), the same request fails with {error, {failed_connect, ...}} after a Bad Certificate alert.

Impact

An attacker on the network path between a program using hex_core's default adapter and a Hex repository or API server completes the TLS handshake with any certificate. It receives the API keys, OAuth tokens and repository keys the program sends, and can alter API requests and responses. Registry signatures, which hex_core verifies by default, still prevent changes to registry contents. Hex and rebar3 aren't affected because they configure their own HTTP adapters.

Workarounds

Pass ssl options that verify the server certificate in the adapter config, for example {hex_http_httpc, #{http_options => [{ssl, SslOpts}]}}, use another HTTP adapter, or run on OTP 26 or later.

Configurations

Affects programs that use the hex_http_httpc adapter, the default in hex_core:default_config/0, without an ssl option in the adapter's http_options, on OTP 24, or on OTP 25 when public_key:cacerts_get/0 fails. hex_core versions before 0.11.0 are affected on OTP 25 and earlier whether or not the CA certificates load. On OTP 26 and later the ssl defaults verify the server certificate. Hex and rebar3 vendor hex_core but configure their own HTTP adapters, so they aren't affected.

Solutions

Upgrade hex_core to 0.20.0 or later. On OTP 24, or on OTP 25 without the operating system's CA certificates, HTTPS requests through hex_http_httpc then fail with {error, {cacerts_unavailable, Reason}} unless the adapter config has ssl options.

Affected versions

Hex

PackageVulnerableFixed in
hex_core
>= 0.1.0, < 0.20.0
0.20.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

hex_core Hex → 0.20.0

mix
{:hex_core, "~> 0.20.0"} # then: mix deps.update hex_core

Severity breakdown

CVSS 4.0 0.0

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N

Attack vector
Network
Attack complexity
Low
Attack requirements
Present
Privileges required
None
User interaction
Active
Confidentiality (vulnerable system)
High
Integrity (vulnerable system)
Low
Availability (vulnerable system)
None
Confidentiality (subsequent systems)
None
Integrity (subsequent systems)
None
Availability (subsequent systems)
None

Weakness

CWE-295: Improper Certificate Validation

The product does not validate, or incorrectly validates, a certificate.

How to prevent it
  • Architecture and Design, Implementation: Certificates should be carefully managed and checked to assure that data are encrypted with the intended owner's public key.
  • Implementation: If certificate pinning is being used, ensure that all relevant properties of the certificate are fully validated before the certificate is pinned, including the hostname.

CWE-636: Not Failing Securely ('Failing Open')

When the product encounters an error condition or failure, its design requires it to fall back to a state that is less secure than other options that are available, such as selecting the weakest encryption algorithm or using the most permissive access control restrictions.

How to prevent it
  • Architecture and Design: Subdivide and allocate resources and components so that a failure in one part does not affect the entire product.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
EEF-CVE-2026-96596
erl_tar:extract/2 loops forever on a GNU sparse member with a trailing hole
Not rated yet Also affects hex_core
EEF-CVE-2026-105274
hex_core decompresses registry and Erlang term API responses without size limits
Not rated yet Also affects hex_core
EEF-CVE-2026-21619
Unsafe Deserialization of Erlang Terms in hex_core
High Also affects hex_core
GHSA-q3cc-rr2c-87r6
Hex authenticity of signed packages not validated
High Also affects hex_core
GHSA-4487-j8r4-4g2f
Forge: verifyCertificateChain() removes trusted CA certificates with the same subject from the CA store
Low Same weakness, CWE-295
GHSA-5x38-2vff-x55p
Forge: X.509 basicConstraints bypass in verifyCertificateChain() via deprecated extension OIDs 2.5.29.10 and 2.5.29.13
High Same weakness, CWE-295
EEF-CVE-2026-115693
Custom cacerts or cacertfile do not restrict trust to the pinned CA in hackney
Not rated yet Same weakness, CWE-295
GHSA-6q48-6c7w-9gw2
certifi bundles emSign root CAs with compromised intermediate CA keys
Critical Same weakness, CWE-295

Credits: Eric Meadows-Jönsson, Jonatan Männchen / EEF, Peter Ullrich

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor