Closed
Bug 230351
Opened 21 years ago
Closed 21 years ago
NTLM base64 decoder should tolerate extra '=' padding
Categories
(Core :: Networking: HTTP, defect, P4)
Core
Networking: HTTP
Tracking
()
RESOLVED
FIXED
mozilla1.8beta1
People
(Reporter: darin.moz, Assigned: darin.moz)
References
(Depends on 1 open bug)
Details
(Whiteboard: [patch])
Attachments
(1 file)
|
4.06 KB,
patch
|
cneberg
:
review+
|
Details | Diff | Splinter Review |
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.
| Assignee | ||
Updated•21 years ago
|
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.
| Assignee | ||
Updated•21 years ago
|
Priority: -- → P4
Target Milestone: mozilla1.7alpha → mozilla1.7beta
| Assignee | ||
Updated•21 years ago
|
Target Milestone: mozilla1.7beta → mozilla1.8alpha
| Assignee | ||
Comment 2•21 years ago
|
||
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).
| Assignee | ||
Updated•21 years ago
|
Attachment #155061 -
Flags: review?(cneberg)
| Assignee | ||
Comment 3•21 years ago
|
||
one concern i have is with malformed input leading to the case where |len == 0|
... might want to protect against that better
Comment 4•21 years ago
|
||
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...
| Assignee | ||
Updated•21 years ago
|
Status: ASSIGNED → NEW
Whiteboard: [patch]
| Assignee | ||
Comment 5•21 years ago
|
||
(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.
Comment 6•21 years ago
|
||
(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 7•21 years ago
|
||
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+
| Assignee | ||
Comment 8•21 years ago
|
||
(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.
| Assignee | ||
Comment 9•21 years ago
|
||
fixed-on-trunk
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 10•21 years ago
|
||
FWIW, the code seemed to handle the case of a challenge consisting of all '='
signs without any trouble.
You need to log in
before you can comment on or make changes to this bug.
Description
•