Closed Bug 325366 Opened 20 years ago Closed 20 years ago

Certificates: Large Microsoft CA version causes decoding failure

Categories

(Core Graveyard :: Security: UI, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: martin, Assigned: KaiE)

References

()

Details

(Keywords: fixed1.8.1)

Attachments

(1 file, 1 obsolete file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060122 Firefox/1.6a1 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060122 Firefox/1.6a1 The Microsoft CA version is currently decoded as an Integer. While the data type is apparently correct, it might exceed the valid range for integers. With this patch, display falls back to displaying raw bytes if an error occurs. Reproducible: Always Steps to Reproduce: 1. Install the certificate at the given URL (download to a file, then import) 2. display the certificate details Actual Results: Nothing is displayed Expected Results: It should display all the certificate details, including all the extensions.
Martin, I imported the cert and I'm looking at it using today's trunk build. I either don't understand your report, or I'm unable to reproduce. You said, nothing is displayed for Microsoft CA version. However, I see: Not Critical 0x3010002
What operating system is this on? In GetIntValue, the len of the security item is 5, and SEC_ASN1DecodeInteger returns an error because src->len > sizeof(unsigned long) (which is 4 on my 32-bit system).
Oh, I'm on a 64 bit machine.
Looking at it again: in Firefox 1.5, this is displayed as 02 03 01 00 02 This seems to be DER of an ASN.1 integer. This raises two questions: - why does it happily drop the leading 02 byte in your installation? - should this be decoded some using IntegerTemplate? Microsoft displays that as "V2.1". FWIW, an integer value of 1 is displayed as "V1.0".
I've looked into the issue again, and checked how MSIE decoded this extension. Apparently, the CA version is encoded as an integer, and to be understood as two 16-bit values. The higher word the is the minor version, and the lower word is the major version. In the revised patch, this is all processed correctly. The CA certificates at http://www.dcl.hpi.uni-potsdam.de/CA/ display as revision 1.0, 1.1, 2.0 and 2.1 respectively both under MSIE and with this patch. As a fallback, the patch displays raw bytes, should the extension fail to decode.
Attachment #210266 - Attachment is obsolete: true
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9a1) Gecko/20060217 Firefox/1.6a1 Confirmed 64-bit behaviour, and confirmed bug because you've got a patch. :)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Large Microsoft CA version causes decoding failure → Certificates: Large Microsoft CA version causes decoding failure
Comment on attachment 211609 [details] [diff] [review] Proper decoding of MS CA Version Looks good to me, r=kengert Martin, thanks for this fix.
Attachment #211609 - Flags: review+
Attachment #211609 - Flags: approval-branch-1.8.1+
fixed trunk and 1.8 branch for 1.8.1
Status: NEW → RESOLVED
Closed: 20 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
In the patch, the writer comments: /* Apparently, the encoding is <minor><major>, with 16 bits each */ But I think there is another possible interpretation of those encoded bits. I suspect the MS took the little endian version number and encoded it as if it was big endian. The two methods may be equivalent for numbers like major=02, minor=01, but ... Imagine a version number which is (in hex) 1234,5678 that is, major is 0x1234 (4660 decimal), minor is 0x5678 (22136 decomal). The patch imagines that would be DER encoded as 02 04 56 78 12 34 and patch would decode it properly if it is encoded that way. But, if it was encoded as if it was big endian, then the version number given above would be encoded this way: 02 04 78 56 34 12 and the patch would not decode it properly. So, I have a request. Do you have a MicroSoft tool that can create certificates with these version numbers in them? If so, please use it to create a cert with that version number (major 4660, minor 22136) in it, then test it with your patch. If the patch is right, it will display correctly. If my suspicion is right, that it is encoded little endian, then it will display as major 30806, minor 13330.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: