Closed Bug 572809 Opened 14 years ago Closed 14 years ago

PK11_GenerateKeyPair doesn't null check parameters, dereferences and crashes

Categories

(NSS :: Libraries, defect, P1)

3.12.6
x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
3.12.7

People

(Reporter: KaiE, Assigned: KaiE)

References

Details

(Whiteboard: [sg:dos null-deref])

Attachments

(1 file)

Call PK11_GenerateKeyPair with type CKM_DSA_KEY_PAIR_GEN, use NULL for parameters, and it will crash.

Should crashes be security sensitive? Please open if you think it's not necessary. I'll also mark the related bug 104103 as sensitive, because I will add a way to trigger this crash from web content.
Please see bug 104103 comment 13 for further details about the crash.
My reading of the code is, PK11_GenerateKeyPairWithOpFlags will always typecast and dereference "params".

I propose that a null check (and error return) is added to function PK11_GenerateKeyPairWithOpFlags.
Attached patch Patch v1Splinter Review
like this?
Attachment #452033 - Flags: review?(rrelyea)
Comment on attachment 452033 [details] [diff] [review]
Patch v1

r=nelson
I agree with your analysis, Kai.
Attachment #452033 - Flags: review?(rrelyea) → review+
Priority: -- → P1
Target Milestone: --- → 3.12.7
Checking in lib/pk11wrap/pk11akey.c;
/cvsroot/mozilla/security/nss/lib/pk11wrap/pk11akey.c,v  <--  pk11akey.c
new revision: 1.30; previous revision: 1.29
done
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
A null-deref is generally a "safe" crash and doesn't normally need to be security-sensitive in client code (execution jumping to null is another story, but just trying to read it isn't bad). Writing to null needs investigation to make sure null is the only possible bad value (e.g. you forgot to check the return value from malloc before writing to it) and that there isn't some alternate path that could cause you to write to arbitrary values.
Whiteboard: [sg:dos null-deref]
This is a duplicate of 4-year-old public Bug 343868.
It is already public.  It need not be security sensitive any more.
Assignee: nobody → kaie
Group: core-security
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: