Open
Bug 1299611
Opened 9 years ago
Updated 3 years ago
Adding policy rules to the Windows sandbox can cause a buffer overrun
Categories
(Core :: Security: Process Sandboxing, defect)
Core
Security: Process Sandboxing
Tracking
()
NEW
People
(Reporter: handyman, Unassigned)
Details
(Whiteboard: sb+)
Attachments
(2 files, 1 obsolete file)
Quick summary:
Right now, this is not an issue in "normal" builds but, if enough additional low-level policy rules are added to the sandbox, the "mullet" structure ("Opcodes in the front, Data in the back") will silently overwrite itself, causing mysterious crashes down the line.
The deal is that policy_low_level.cc attempts to pack the policies in a contiguous buffer. The policies are broken into "OpCodes" and "Data". Right now, everything fits (despite slightly incorrect accounting of the data size, which is a related bug) so there is no problem. However, I had added a bunch of additional rules to PluginProcessParent ("AddSandboxAllowedFile") rules. This swamped the structure, which fills itself by adding opcodes to the top of the memblock and adding data to the bottom. When there is too much to write, they overwrite each other in the middle of the memory block.
The attachment bigrules.patch adds dummy sandbox file rules to cause the overrun. It is just to demonstrate the problem. The attachment catchoverrun.patch fixes the issue by adding ASSERTions to catch the failure. It also fixes the byte accounting, which, as I said above, was slightly off.
Reporter | ||
Comment 2•9 years ago
|
||
Note that PolicyBuffer is one size_t plus a list of PolicyOpcodes (this is the reason for the size_t added to the accounting.)
Reporter | ||
Comment 3•9 years ago
|
||
"Perfect" byte accounting to leave no unnecessary gaps in the buffer.
Attachment #8786921 -
Attachment is obsolete: true
Attachment #8786941 -
Flags: review?(aklotz)
Comment 4•9 years ago
|
||
Comment on attachment 8786941 [details] [diff] [review]
Fix buffer allocation that caused security descriptors to be trashed
I think this patch is going to cause problems because this code comes straight from upstream. I'm going to redirect to Bob in this case since he is in a better position to determine whether to upstream this patch, or alternatively determine how make the change in a way that is merge-friendly.
Attachment #8786941 -
Flags: review?(aklotz) → review?(bobowen.code)
Comment 5•9 years ago
|
||
Comment on attachment 8786941 [details] [diff] [review]
Fix buffer allocation that caused security descriptors to be trashed
Nice find over the opcode count, that does look like a bug.
However, unless we're actually going to hit this with our rules, I think this should be reported and fixed upstream.
Attachment #8786941 -
Flags: review?(bobowen.code)
Updated•9 years ago
|
Component: Plug-ins → Security: Process Sandboxing
Reporter | ||
Comment 6•9 years ago
|
||
Cool. The Chromium engineers are on it. See:
https://bugs.chromium.org/p/chromium/issues/detail?id=643293&can=2&q=low%20level&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified#
I don't think we need to track this.
![]() |
||
Updated•9 years ago
|
Whiteboard: sb+
Reporter | ||
Updated•8 years ago
|
Assignee: davidp99 → nobody
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•