Closed Bug 1240904 Opened 9 years ago Closed 9 years ago

Infoleak when unserializing type NPString

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: tedd, Assigned: mccr8)

References

Details

(Keywords: sec-audit, Whiteboard: [adv-main47-])

Attachments

(1 file)

When unserializing an NPString object, memory is leaked because two pointers are used backwards when calling memcpy[1]. ReadBytes returns a pointer into the serialized object and this pointer is stored in |messageBuffer|, |newBuffer| is the newly created buffer that is also returned as part of the unserialized object [2]. But the memcpy [1] first copies data from |newBuffer| into |messageBuffer|, which effectively overwrites the serialized data (ReadBytes has a bound check so we can't write past the end of the serialized message) When |newBuffer| is then returned, its memory is still unitialized and contains whatever was previously in memory there. As far as the impact is concerned, I haven't found any usage of NPString, according to git blame Ben Turner introduced the code way back in 2009, but the code that used it vanished over the years. Which leaves the question if this is dead code, or if it is planned to use it later on again. [1] https://dxr.mozilla.org/mozilla-central/rev/b67316254602a63bf4e568198a5c7d3288a9db27/dom/plugins/ipc/PluginMessageUtils.h#435 [2] https://dxr.mozilla.org/mozilla-central/rev/b67316254602a63bf4e568198a5c7d3288a9db27/dom/plugins/ipc/PluginMessageUtils.h#436
Group: core-security → dom-core-security
The PPluginScriptableObject Variant type uses nsCString, so I doubt that this code is used. If removing it compiles, r=me to do that.
Keywords: sec-audit
Assignee: nobody → continuation
Component: IPC → Plug-ins
As bsmedberg said, Firefox seems to compile just fine if ParamTraits<NPString> and ParamTraits<NPVariant> are deleted.
I'm going to go ahead and unhide this because it is dead code. Thanks for finding this issue!
Group: dom-core-security
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Whiteboard: [adv-main47-]
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: