Skip to content

[2.4.x] mod_md: Fix a one-second race in md_asn1_time_get(). - #1158

Open
arturobernalg wants to merge 1 commit into
apache:2.4.xfrom
arturobernalg:backport/838-md-asn1-time-race-24x
Open

arturobernalg wants to merge 1 commit into
apache:2.4.xfrom
arturobernalg:backport/838-md-asn1-time-race-24x

Conversation

@arturobernalg

@arturobernalg arturobernalg commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

For OpenSSL >= 1.1.1, convert the certificate's ASN1_TIME directly via ASN1_TIME_to_tm() instead of reconstructing it as apr_time_now() + ASN1_TIME_diff(). The latter samples the current time twice, once explicitly and once inside ASN1_TIME_diff(); if the wall clock ticks over a second between the two reads, the result is off by one second.

md_asn1_time_get() itself is identical to trunk's; nothing else here needed changing.

(cherry picked from commit 7e6d305)

GitHub: closes #838

[Arturo Bernal]


[x] This PR does not report or address a security vulnerability.
[x] Code follows the httpd style guide.
[ ] New log messages (n/a, no new log messages)
[x] changes-entries/md-asn1-time-race.txt included.
[ ] pyhttpd tests (n/a, timing race; verified with a standalone repro against the real compiled object, see commit message)

For OpenSSL >= 1.1.1, convert the certificate's ASN1_TIME directly via
ASN1_TIME_to_tm() instead of reconstructing it as apr_time_now() +
ASN1_TIME_diff(). The latter samples the current time twice, once
explicitly and once inside ASN1_TIME_diff(); if the wall clock ticks
over a second between the two reads, the result is off by one second.

md_asn1_time_get() itself is identical to trunk's; nothing else here
needed changing.

(cherry picked from commit 7e6d305)

GitHub: closes apache#838

[Arturo Bernal]
@arturobernalg
arturobernalg force-pushed the backport/838-md-asn1-time-race-24x branch from abf1952 to 7d6bd7f Compare December 3, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant