Skip to content

Commit 2c6c9d4

Browse files
hlandaulevitte
authored andcommitted
CVE-2023-0286: Fix GENERAL_NAME_cmp for x400Address (1.1.1)
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org>
1 parent f040f25 commit 2c6c9d4

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

CHANGES

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,23 @@
99

1010
Changes between 1.1.1s and 1.1.1t [xx XXX xxxx]
1111

12-
*)
12+
*) Fixed a type confusion vulnerability relating to X.400 address processing
13+
inside an X.509 GeneralName. X.400 addresses were parsed as an ASN1_STRING
14+
but subsequently interpreted by GENERAL_NAME_cmp as an ASN1_TYPE. This
15+
vulnerability may allow an attacker who can provide a certificate chain and
16+
CRL (neither of which need have a valid signature) to pass arbitrary
17+
pointers to a memcmp call, creating a possible read primitive, subject to
18+
some constraints. Refer to the advisory for more information. Thanks to
19+
David Benjamin for discovering this issue. (CVE-2023-0286)
20+
21+
This issue has been fixed by changing the public header file definition of
22+
GENERAL_NAME so that x400Address reflects the implementation. It was not
23+
possible for any existing application to successfully use the existing
24+
definition; however, if any application references the x400Address field
25+
(e.g. in dead code), note that the type of this field has changed. There is
26+
no ABI change.
27+
28+
[Hugo Landau]
1329

1430
Changes between 1.1.1r and 1.1.1s [1 Nov 2022]
1531

crypto/x509v3/v3_genn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b)
9898
return -1;
9999
switch (a->type) {
100100
case GEN_X400:
101-
result = ASN1_TYPE_cmp(a->d.x400Address, b->d.x400Address);
101+
result = ASN1_STRING_cmp(a->d.x400Address, b->d.x400Address);
102102
break;
103103

104104
case GEN_EDIPARTY:

include/openssl/x509v3.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ typedef struct GENERAL_NAME_st {
136136
OTHERNAME *otherName; /* otherName */
137137
ASN1_IA5STRING *rfc822Name;
138138
ASN1_IA5STRING *dNSName;
139-
ASN1_TYPE *x400Address;
139+
ASN1_STRING *x400Address;
140140
X509_NAME *directoryName;
141141
EDIPARTYNAME *ediPartyName;
142142
ASN1_IA5STRING *uniformResourceIdentifier;

test/v3nametest.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,14 @@ static struct gennamedata {
646646
0xb7, 0x09, 0x02, 0x02
647647
},
648648
15
649+
}, {
650+
/*
651+
* Regression test for CVE-2023-0286.
652+
*/
653+
{
654+
0xa3, 0x00
655+
},
656+
2
649657
}
650658
};
651659

0 commit comments

Comments
 (0)