Skip to content

Commit 3118d9c

Browse files
authored
hardening (#397)
* Hardening: when build with OpenSSL older than 1.0.2 or old libressl versions, the parsing of ASN.1 time strings did not do a length check. * Hardening: when reading back OCSP responses stored in the local JSON store, missing 'valid' key led to uninitialized values, resulting in wrong refresh behaviour.
1 parent 2412f64 commit 3118d9c

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

ChangeLog

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
* Hardening: when build with OpenSSL older than 1.0.2 or old libressl versions,
2+
the parsing of ASN.1 time strings did not do a length check.
3+
* Hardening: when reading back OCSP responses stored in the local JSON store,
4+
missing 'valid' key led to uninitialized values, resulting in wrong
5+
refresh behaviour.
6+
7+
v2.6.4
8+
----------------------------------------------------------------------------------------------------
9+
* New directive `MDInitialDelay`, controlling how longer to wait after
10+
a server restart before checking certificates for renewal.
11+
[Michael Kaufmann]
12+
13+
v2.6.3
14+
----------------------------------------------------------------------------------------------------
15+
* borked the git tag. meh.
16+
17+
v2.6.2
18+
----------------------------------------------------------------------------------------------------
119
* Fix error retry delay calculation to not already doubling the wait
220
on the first error.
321

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515

1616
AC_PREREQ([2.69])
17-
AC_INIT([mod_md], [2.6.1], [[email protected]])
17+
AC_INIT([mod_md], [2.6.4], [[email protected]])
1818

1919
LT_PREREQ([2.2.6])
2020
LT_INIT()

src/md_crypt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int pem_passwd(char *buf, int size, int rwflag, void *baton)
206206

207207
/* Get the apr time (micro seconds, since 1970) from an ASN1 time, as stored in X509
208208
* certificates. OpenSSL now has a utility function, but other *SSL derivatives have
209-
* not caughts up yet or chose to ignore. An alternative is implemented, we prefer
209+
* not caught up yet or chose to ignore. An alternative is implemented, we prefer
210210
* however the *SSL to maintain such things.
211211
*/
212212
static apr_time_t md_asn1_time_get(const ASN1_TIME* time)
@@ -220,6 +220,10 @@ static apr_time_t md_asn1_time_get(const ASN1_TIME* time)
220220
const char* str = (const char*) time->data;
221221
apr_size_t i = 0;
222222

223+
if ((time->length < 12) || (
224+
(time->type == V_ASN1_GENERALIZEDTIME) && time->length < 16))
225+
return 0;
226+
223227
memset(&t, 0, sizeof(t));
224228

225229
if (time->type == V_ASN1_UTCTIME) {/* two digit year */

src/md_ocsp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ static apr_status_t ostat_from_json(md_ocsp_cert_stat_t *pstat,
190190
md_timeperiod_t valid;
191191
apr_status_t rv = APR_ENOENT;
192192

193+
memset(&valid, 0, sizeof(valid));
193194
memset(resp_der, 0, sizeof(*resp_der));
194195
memset(resp_valid, 0, sizeof(*resp_valid));
195196
s = md_json_dups(p, json, MD_KEY_VALID, MD_KEY_FROM, NULL);

src/md_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
* @macro
2828
* Version number of the md module as c string
2929
*/
30-
#define MOD_MD_VERSION "2.6.1-git"
30+
#define MOD_MD_VERSION "2.6.4-git"
3131

3232
/**
3333
* @macro
3434
* Numerical representation of the version number of the md module
3535
* release. This is a 24 bit number with 8 bits for major number, 8 bits
3636
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
3737
*/
38-
#define MOD_MD_VERSION_NUM 0x020601
38+
#define MOD_MD_VERSION_NUM 0x020604
3939

4040
#define MD_ACME_DEF_URL "https://acme-v02.api.letsencrypt.org/directory"
4141

0 commit comments

Comments
 (0)