Closed Bug 1605922 Opened 5 years ago Closed 4 years ago

mp_toradix buffer overflow (write)

Categories

(NSS :: Libraries, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: guidovranken, Assigned: kjacobs)

Details

(Keywords: csectype-bounds, sec-other)

Attachments

(2 files)

Attached patch poc_mp_toradix.cSplinter Review

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0

Steps to reproduce:

Compile and run attached proof of concept.
Optionally compile NSS + PoC with AddressSanitizer.

Found with Cryptofuzz.
Use of mp_toradix appears very limited within NSS. Marking as security in case third-party dependencies upon NSS are affected.

Actual results:

Buffer overflow (write, 1 byte) in mp_toradix() with an output buffer the size suggested by mp_radix_size()

Expected results:

No buffer overflow

The priority flag is not set for this bug.
:jcj, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jjones)
Flags: needinfo?(jjones)
Attachment #9117723 - Attachment is patch: true
Attachment #9117723 - Attachment mime type: text/x-csrc → text/plain

The priority flag is not set for this bug.
:jcj, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jjones)

Confirmed. This might take a bit of time to get to, but thank you for the report!

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jjones)
Priority: -- → P3

You're welcome :).

Flags: needinfo?(kjacobs.bugzilla)

Thanks for the report.

There isn't any exposure for Firefox where mp_radix_size is unused, but this is a tricky corner case and a good catch (since in most cases the size will be overestimated, leaving sufficient room).

Flags: needinfo?(kjacobs.bugzilla)
Assignee: nobody → kjacobs.bugzilla
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.57
Group: crypto-core-security → core-security-release
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: