|
|
e14024 |
diff -up php-5.4.16/ext/openssl/openssl.c.cve6420 php-5.4.16/ext/openssl/openssl.c
|
|
|
e14024 |
--- php-5.4.16/ext/openssl/openssl.c.cve6420 2013-12-06 07:05:06.870106576 +0100
|
|
|
e14024 |
+++ php-5.4.16/ext/openssl/openssl.c 2013-12-06 07:05:06.872106575 +0100
|
|
|
e14024 |
@@ -656,18 +656,28 @@ static time_t asn1_time_to_time_t(ASN1_U
|
|
|
e14024 |
char * thestr;
|
|
|
e14024 |
long gmadjust = 0;
|
|
|
e14024 |
|
|
|
e14024 |
- if (timestr->length < 13) {
|
|
|
e14024 |
+ if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME) {
|
|
|
e14024 |
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal ASN1 data type for timestamp");
|
|
|
e14024 |
+ return (time_t)-1;
|
|
|
e14024 |
+ }
|
|
|
e14024 |
+
|
|
|
e14024 |
+ if (ASN1_STRING_length(timestr) != strlen(ASN1_STRING_data(timestr))) {
|
|
|
e14024 |
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "illegal length in timestamp");
|
|
|
e14024 |
+ return (time_t)-1;
|
|
|
e14024 |
+ }
|
|
|
e14024 |
+
|
|
|
e14024 |
+ if (ASN1_STRING_length(timestr) < 13) {
|
|
|
e14024 |
php_error_docref(NULL TSRMLS_CC, E_WARNING, "extension author too lazy to parse %s correctly", timestr->data);
|
|
|
e14024 |
return (time_t)-1;
|
|
|
e14024 |
}
|
|
|
e14024 |
|
|
|
e14024 |
- strbuf = estrdup((char *)timestr->data);
|
|
|
e14024 |
+ strbuf = estrdup((char *)ASN1_STRING_data(timestr));
|
|
|
e14024 |
|
|
|
e14024 |
memset(&thetime, 0, sizeof(thetime));
|
|
|
e14024 |
|
|
|
e14024 |
/* we work backwards so that we can use atoi more easily */
|
|
|
e14024 |
|
|
|
e14024 |
- thestr = strbuf + timestr->length - 3;
|
|
|
e14024 |
+ thestr = strbuf + ASN1_STRING_length(timestr) - 3;
|
|
|
e14024 |
|
|
|
e14024 |
thetime.tm_sec = atoi(thestr);
|
|
|
e14024 |
*thestr = '\0';
|
|
|
e14024 |
diff -up php-5.4.16/ext/openssl/tests/cve-2013-6420.crt.cve6420 php-5.4.16/ext/openssl/tests/cve-2013-6420.crt
|
|
|
e14024 |
--- php-5.4.16/ext/openssl/tests/cve-2013-6420.crt.cve6420 2013-12-06 07:05:06.872106575 +0100
|
|
|
e14024 |
+++ php-5.4.16/ext/openssl/tests/cve-2013-6420.crt 2013-12-06 07:05:06.872106575 +0100
|
|
|
e14024 |
@@ -0,0 +1,29 @@
|
|
|
e14024 |
+-----BEGIN CERTIFICATE-----
|
|
|
e14024 |
+MIIEpDCCA4ygAwIBAgIJAJzu8r6u6eBcMA0GCSqGSIb3DQEBBQUAMIHDMQswCQYD
|
|
|
e14024 |
+VQQGEwJERTEcMBoGA1UECAwTTm9yZHJoZWluLVdlc3RmYWxlbjEQMA4GA1UEBwwH
|
|
|
e14024 |
+S8ODwrZsbjEUMBIGA1UECgwLU2VrdGlvbkVpbnMxHzAdBgNVBAsMFk1hbGljaW91
|
|
|
e14024 |
+cyBDZXJ0IFNlY3Rpb24xITAfBgNVBAMMGG1hbGljaW91cy5zZWt0aW9uZWlucy5k
|
|
|
e14024 |
+ZTEqMCgGCSqGSIb3DQEJARYbc3RlZmFuLmVzc2VyQHNla3Rpb25laW5zLmRlMHUY
|
|
|
e14024 |
+ZDE5NzAwMTAxMDAwMDAwWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
e14024 |
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
|
e14024 |
+AAAAAAAXDTE0MTEyODExMzkzNVowgcMxCzAJBgNVBAYTAkRFMRwwGgYDVQQIDBNO
|
|
|
e14024 |
+b3JkcmhlaW4tV2VzdGZhbGVuMRAwDgYDVQQHDAdLw4PCtmxuMRQw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7KVQ6bdhg5p5SjpWH1+Mq03uR3ZXPBYdyV8319
|
|
|
e14024 |
+o0lVj1KFI2DCL/liWisJRoof+1cR35Ctd0wYBcpB6TZslMcOPl76dwKwJgeJo2Qg
|
|
|
e14024 |
+Zsfmc2vC1/qOlNuNq/0TzzkVGv8ETT3CgaU+UXe4XOVvkccebJn2dg==
|
|
|
e14024 |
+-----END CERTIFICATE-----
|
|
|
e14024 |
+
|
|
|
e14024 |
+
|
|
|
e14024 |
diff -up php-5.4.16/ext/openssl/tests/cve-2013-6420.phpt.cve6420 php-5.4.16/ext/openssl/tests/cve-2013-6420.phpt
|
|
|
e14024 |
--- php-5.4.16/ext/openssl/tests/cve-2013-6420.phpt.cve6420 2013-12-06 07:05:06.872106575 +0100
|
|
|
e14024 |
+++ php-5.4.16/ext/openssl/tests/cve-2013-6420.phpt 2013-12-06 07:05:06.872106575 +0100
|
|
|
e14024 |
@@ -0,0 +1,18 @@
|
|
|
e14024 |
+--TEST--
|
|
|
e14024 |
+CVE-2013-6420
|
|
|
e14024 |
+--SKIPIF--
|
|
|
e14024 |
+
|
|
|
e14024 |
+if (!extension_loaded("openssl")) die("skip");
|
|
|
e14024 |
+?>
|
|
|
e14024 |
+--FILE--
|
|
|
e14024 |
+
|
|
|
e14024 |
+$crt = substr(__FILE__, 0, -4).'.crt';
|
|
|
e14024 |
+$info = openssl_x509_parse("file://$crt");
|
|
|
e14024 |
+var_dump($info['issuer']['emailAddress'], $info["validFrom_time_t"]);
|
|
|
e14024 |
+?>
|
|
|
e14024 |
+Done
|
|
|
e14024 |
+--EXPECTF--
|
|
|
e14024 |
+%s openssl_x509_parse(): illegal ASN1 data type for timestamp in %s/cve-2013-6420.php on line 3
|
|
|
e14024 |
+string(27) "stefan.esser@sektioneins.de"
|
|
|
e14024 |
+int(-1)
|
|
|
e14024 |
+Done
|