#3500·haproxy

crt-list per-certificate ciphers/ciphersuites silently ignored when built with AWS-LC

Author: ygkatCreated Sep 16, 2026Updated Sep 18, 2026

Detailed Description of the Problem

When HAProxy is built with USE_OPENSSL_AWSLC=1, a crt-list entry's per-certificate ciphers/ciphersuites restriction is silently ignored: a client can negotiate a cipher that's excluded by that certificate's bracketed restriction, as long as the cipher is allowed at bind/global level. The identical HAProxy source and config, built with USE_OPENSSL=1 against OpenSSL, correctly rejects the same connection.

show ssl crt-list shows the bracketed ciphers/ciphersuites as loaded correctly on the AWS-LC build, so this isn't a config-parsing issue.

Expected Behavior

A connection to a certificate whose crt-list entry restricts ciphers/ciphersuites should be rejected if the client only offers a cipher outside that restriction, even if the bind/global-level list would otherwise allow it.

Steps to Reproduce the Behavior

  1. crt-list with a per-certificate restriction:
default.pem
rsa.pem [ciphers ECDHE-RSA-AES128-GCM-SHA256 ciphersuites TLS_AES_128_GCM_SHA256] rsa.test
  1. Bind/global level deliberately permissive (allows AES256 too), so the per-cert restriction is the only thing that should block it:
ssl-default-bind-ciphers DEFAULT
ssl-default-bind-ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
  1. Connect with a cipher excluded by the per-cert list but allowed at bind level:
openssl s_client -connect host:443 -servername rsa.test -tls1_2 -cipher ECDHE-RSA-AES256-GCM-SHA384
  1. Built against OpenSSL: handshake fails as expected. Built against AWS-LC: handshake succeeds, negotiating the excluded cipher.

Do you have any idea what may have caused this?

SSL_set_SSL_CTX() does not update the connection's active cipher list on AWS-LC. OpenSSL's SSL_set_SSL_CTX() doesn't touch the cipher list either; it only re-derives the certificate, custom extension flags, and sid_ctx. The divergence is earlier, in how each library resolves the active cipher list:

  • OpenSSL: SSL_new() leaves the per-connection cipher list unset (NULL). Cipher negotiation resolves it lazily at negotiation time (sc->cipher_list != NULL ? sc->cipher_list : s->ctx->cipher_list), so it naturally tracks whichever SSL_CTX is currently attached to the connection, including after SSL_set_SSL_CTX() updates it.
  • AWS-LC: SSL_new() eagerly copies ctx->cipher_list/ctx->tls13_cipher_list into the per-connection ssl->config->cipher_list/tls13_cipher_list at connection-creation time (ssl/ssl_lib.cc:594-606). Once populated it stays fixed, and SSL_set_SSL_CTX() never refreshes it. Cipher negotiation then reads this stale copy (ssl/handshake_server.cc:722-727 for TLS 1.2, ssl/tls13_server.cc:102-119 for TLS 1.3).

Do you have an idea how to solve the issue?

In the SNI/select-certificate callback in src/ssl_clienthello.c, right after HAProxy switches SSL_CTX and sets the min/max TLS version on the connection, re-apply the per-cert cipher config directly via SSL_set_cipher_list()/SSL_set_ciphersuites(), guarded by #if defined(OPENSSL_IS_AWSLC) so it's a no-op on every other build:

c
#if defined(OPENSSL_IS_AWSLC)
			/* AWS-LC's SSL_set_SSL_CTX() only re-derives the certificate,
			 * not the cipher list -- the per-cert cipher/ciphersuite
			 * restriction from the crt-list entry would otherwise
			 * silently fall back to the bind-level list. Re-apply it
			 * explicitly here. Config-time validation in
			 * ssl_sock_prepare_ctx() guarantees these strings parse.
			 * Remove once fixed upstream (reported to AWS-LC separately).
			 */
			if (conf->ciphers)
				SSL_set_cipher_list(ssl, conf->ciphers);
#ifdef HAVE_SSL_CTX_SET_CIPHERSUITES
			if (conf->ciphersuites)
				SSL_set_ciphersuites(ssl, conf->ciphersuites);
#endif
#endif

This leaves unrestricted crt-list entries unchanged, and applies to both statically-configured and runtime-added (add ssl crt-list) entries.

Can open a PR for this, or a different approach (e.g. handling it in ssl_sock_switchctx_set() rather than the callback) works too.

What is your configuration?

haproxy
global
	ssl-default-bind-ciphers DEFAULT
	ssl-default-bind-ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256

defaults
	mode http
	timeout connect 5s
	timeout client  30s
	timeout server  30s

frontend fe_ssl
	bind 127.0.0.1:8443 ssl crt-list /path/to/crt-list.txt
	http-request return status 200 content-type text/plain string "ok\n"
# crt-list.txt
default.pem
rsa.pem   [ciphers ECDHE-RSA-AES128-GCM-SHA256   ciphersuites TLS_AES_128_GCM_SHA256] rsa.test
ecdsa.pem [ciphers ECDHE-ECDSA-AES128-GCM-SHA256 ciphersuites TLS_AES_128_GCM_SHA256] ecdsa.test

Output of haproxy -vv

plain
HAProxy version 3.2.21 2026/07/03 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2030.
Known bugs: http://www.haproxy.org/bugs/bugs-3.2.21.html
Running on: Linux 5.14.0-570.42.2.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC x86_64
Build options :
  TARGET  = linux-glibc
  CC      = cc
  CFLAGS  = -O2 -g -fwrapv -fvect-cost-model=very-cheap
  OPTIONS = USE_OPENSSL_AWSLC=1 USE_ZLIB=1 USE_PCRE2=1
  DEBUG   =

Built with multi-threading support (MAX_TGROUPS=32, MAX_THREADS=1024, default=8).
Built with SSL library version : OpenSSL 1.1.1 (compatible; AWS-LC 5.9.0)
Running on SSL library version : AWS-LC 5.9.0
SSL library supports TLS extensions : yes
SSL library supports SNI : yes
SSL library FIPS mode : no
SSL library supports : TLSv1.0 TLSv1.1 TLSv1.2 TLSv1.3

(SSL-relevant portion only. Also reproduced with Running on SSL library version : AWS-LC 5.1.0 on a fuller, production-style build, so it is not specific to this minimal build or to AWS-LC 5.9.0.)

Last Outputs and Backtraces

Not applicable: no crash or error output. HAProxy logs nothing for the affected connections because from its point of view the handshake completes normally; the only observable symptom is the negotiated cipher reported by the client (openssl s_client), as summarized in the table below.

Additional Information

Full test matrix, same HAProxy source built both ways:

Library Cert TLS Cipher requested (excluded by per-cert list) Result
OpenSSL 3.5.5 RSA 1.2 ECDHE-RSA-AES256-GCM-SHA384 Correctly rejected (alert 40)
OpenSSL 3.5.5 RSA 1.3 TLS_AES_256_GCM_SHA384 Correctly rejected (alert 40)
OpenSSL 3.5.5 ECDSA 1.2 ECDHE-ECDSA-AES256-GCM-SHA384 Correctly rejected (alert 40)
OpenSSL 3.5.5 ECDSA 1.3 TLS_AES_256_GCM_SHA384 Correctly rejected (alert 40)
AWS-LC 5.9.0 RSA 1.2 ECDHE-RSA-AES256-GCM-SHA384 Incorrectly accepted
AWS-LC 5.9.0 RSA 1.3 TLS_AES_256_GCM_SHA384 Incorrectly accepted
AWS-LC 5.9.0 ECDSA 1.2 ECDHE-ECDSA-AES256-GCM-SHA384 Incorrectly accepted
AWS-LC 5.9.0 ECDSA 1.3 TLS_AES_256_GCM_SHA384 Incorrectly accepted
AWS-LC 5.1.0 RSA 1.2 ECDHE-RSA-AES256-GCM-SHA384 Incorrectly accepted
AWS-LC 5.1.0 RSA 1.3 TLS_AES_256_GCM_SHA384 Incorrectly accepted
AWS-LC 5.1.0 ECDSA 1.2 ECDHE-ECDSA-AES256-GCM-SHA384 Incorrectly accepted
AWS-LC 5.1.0 ECDSA 1.3 TLS_AES_256_GCM_SHA384 Incorrectly accepted
AWS-LC 1.65.0 RSA 1.2 ECDHE-RSA-AES256-GCM-SHA384 Incorrectly accepted
AWS-LC 1.65.0 RSA 1.3 TLS_AES_256_GCM_SHA384 Incorrectly accepted
AWS-LC 1.65.0 ECDSA 1.2 ECDHE-ECDSA-AES256-GCM-SHA384 Incorrectly accepted
AWS-LC 1.65.0 ECDSA 1.3 TLS_AES_256_GCM_SHA384 Incorrectly accepted