Closed Bug 230351 Opened 21 years ago Closed 21 years ago

NTLM base64 decoder should tolerate extra '=' padding

Categories

(Core :: Networking: HTTP, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: darin.moz, Assigned: darin.moz)

References

(Depends on 1 open bug)

Details

(Whiteboard: [patch])

Attachments

(1 file)

NTLM base64 decoder should tolerate extra '=' padding. IE is apparently quite happy to accept a NTLM Type 2 message that contains an extra '=' sign, and so some server applications have grown up with a bug wherein an extra '=' sign is appended. We should be more tolerant of this kind of thing. This is perhaps something we'd want to fix in PL_Base64Decode instead of special casing it in places where PL_Base64Decode is called.
Severity: normal → minor
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.7alpha
Do we have a list of servers that do this? That would help Darin understand how much of a problem this is.
Priority: -- → P4
Target Milestone: mozilla1.7alpha → mozilla1.7beta
Target Milestone: mozilla1.7beta → mozilla1.8alpha
Blocks: 250014
Target Milestone: mozilla1.8alpha1 → mozilla1.8beta
Attached patch v1 patchSplinter Review
The docs for PL_Base64Decode state that an error is returned if the input is not well-coded. I'm not sure if that implies correct padding or not. Changing the behavior of PL_Base64Decode might have unintended side-effects if someone is/was counting on the behavior of PL_Base64Decode to detect incorrectly padded input. So, maybe the least risky thing for us to do is to simply patch some of the consumers of PL_Base64Decode in the tree... at least the ones that deal with NTLM input (and SPNEGO for good measure).
Attachment #155061 - Flags: review?(cneberg)
one concern i have is with malformed input leading to the case where |len == 0| ... might want to protect against that better
hmm, will NTLM messages always have a size that's a multiple of 3 (after decoding)? Otherwise you are removing too much padding in some cases...
Status: ASSIGNED → NEW
Whiteboard: [patch]
(In reply to comment #4) > hmm, will NTLM messages always have a size that's a multiple of 3 (after > decoding)? Otherwise you are removing too much padding in some cases... No, NTLM messages are not going to be a multiple of 3 in size. My reason for stripping the padding is based on the documentation of PL_Base64Decode, which says that "the source may either include or exclude any trailing '=' characters", so I am excluding them. Note also that in all cases we're computing the allocation size of the output buffer prior to stripping '=' chars. I also confirmed that this algorithm works fine when applied to a decoded source string with length that is not a multiple of 3.
(In reply to comment #5) > No, NTLM messages are not going to be a multiple of 3 in size. My reason for > stripping the padding is based on the documentation of PL_Base64Decode, which > says that "the source may either include or exclude any trailing '=' > characters", so I am excluding them. ah, ok, I didn't expect that behaviour of PL_Base64Decode.
Comment on attachment 155061 [details] [diff] [review] v1 patch Looks fine. Did you have a test case to try this against to make sure that the case where the challenge was just a set of of equal signs didn't bother it?
Attachment #155061 - Flags: review?(cneberg) → review+
(In reply to comment #7) > (From update of attachment 155061 [details] [diff] [review]) > Looks fine. Did you have a test case to try this against to make sure that the > case where the challenge was just a set of of equal signs didn't bother it? > no, but i'll verify that before i commit this patch.
fixed-on-trunk
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
FWIW, the code seemed to handle the case of a challenge consisting of all '=' signs without any trouble.
Depends on: 529916
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: