[openssl/openssl] 25d6ae: Detect and prevent recursive config parsing

Neil Horman noreply at github.com
Fri Dec 22 10:38:09 UTC 2023


  Branch: refs/heads/openssl-3.2
  Home:   https://github.com/openssl/openssl
  Commit: 25d6aecd0061eda532b2172b4fa8cb2afbe8d9e6
      https://github.com/openssl/openssl/commit/25d6aecd0061eda532b2172b4fa8cb2afbe8d9e6
  Author: Neil Horman <nhorman at openssl.org>
  Date:   2023-12-22 (Fri, 22 Dec 2023)

  Changed paths:
    M crypto/conf/conf_err.c
    M crypto/err/openssl.txt
    M crypto/provider_conf.c
    M include/crypto/conferr.h
    M include/openssl/conferr.h
    M test/prov_config_test.c
    M test/recipes/30-test_prov_config.t
    A test/recursive.cnf

  Log Message:
  -----------
  Detect and prevent recursive config parsing

If a malformed config file is provided such as the following:

openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
[provider_sect]
 = provider_sect

The config parsing library will crash overflowing the stack, as it
recursively parses the same provider_sect ad nauseum.

Prevent this by maintaing a list of visited nodes as we recurse through
referenced sections, and erroring out in the event we visit any given
section node more than once.

Note, adding the test for this revealed that our diagnostic code
inadvertently pops recorded errors off the error stack because
provider_conf_load returns success even in the event that a
configuration parse failed. The call path to provider_conf_load has been
updated in this commit to address that shortcoming, allowing recorded
errors to be visibile to calling applications.

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22898)

(cherry picked from commit 682fd21afb5428b5716e62eaefb09a7419f9cfd7)




More information about the openssl-commits mailing list