Closed Bug 556971 Opened 16 years ago Closed 16 years ago

"ifdef MOZ_USE_IMAGE_EXPOSE" Image memory given to plugins is executable by all groups/users

Categories

(Core Graveyard :: Plug-ins, defect)

ARM
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: cjones, Assigned: dougt)

References

Details

(Whiteboard: [sg:critical])

Attachments

(3 files)

See http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsObjectFrame.cpp#5167 This opens fennec to a variety of attacks. Sorry if this has already been filed, but I wasn't CC'd.
we should try to see if 0600 works or 0666. important part is to drop the x bit.
I think we should use 0666, the same for gfxSharedImageSurface.cpp:154.
Also I would like to kill that stuff with patch from bug 553943
Assignee: nobody → dougt
(In reply to comment #2) > I think we should use 0666, the same for gfxSharedImageSurface.cpp:154. Why not 0600? (If that works.)
It's been a while since I've worked with shared memory, but doesn't creating a segment that's world readable/writable (0666) mean that any other user on a multiuser system would be able to monitor/change the plugin contents (bitmap)? That seems... bad.
DougT, can we get an ETA?
Attached patch patch v.1 — — Splinter Review
i tested the nsObjectFrame change on device. it worked fine.
Attachment #438858 - Flags: review?(jmuizelaar)
tracking-fennec: --- → ?
Attachment #438858 - Flags: review?(jmuizelaar) → review+
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
That's not the right patch *and* the patch that Jeff reviewed doesn't have a test. We should make sure that we don't regress this security characteristic, IMO.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Thank you Mike, I will back this out and push the correct patch. I might be a good idea to have some auditing tool that could look at memory allocations and see if they have the execute bit set. Only a few allocations should allow this (the jit stuff is one that comes to mind). Do you know of any tools that can do this? Maybe some valgrind extension?
This is breaking gfxSharedImageSurface working properly... XError: X_ShmAttach: BadAccess (attempt to access private resource denied); 3 requests ago; id=0x40000c Re-running with MOZ_X_SYNC=1 in the environment may give a more helpful backtrace. xulrunner-bin: ../../src/xcb_io.c:176: process_responses: Assertion `!(req && current_request && !(((long) (req->sequence) - (long) (current_request)) <= 0))' failed. permissions must be 0666, otherwise it does not work.
Attached patch Fix to 0666 — — Splinter Review
Attachment #439524 - Flags: review?(dougt)
Oleg -- on what platform? Opening up read+writes for _EVERYONE_ on the system in order to use an section of memory seams like a bug in the kernel.
ohmm. oh, maybe X somehow can't access it without the group+world right? Does this only effect your platform, or can we also see it on a standard ubuntu box? Fwiw, i tested the plugin path on the n900 using the 1.2 rom and didn't see any problem.
> the patch that Jeff reviewed doesn't have a > test. We should make sure that we don't regress this security characteristic, > IMO. It's inconceivable to me that you have to permit anyone to tamper with the segment in order to make XSHM work. So either we misunderstand how the permissions work, or we misunderstand how to make XSHM work with appropriate permissions. (Or the XSHM impl that Oleg is testing is just broken, I guess, but that seems least likely.) (FIXED -- the bug is resolved as filed, one bug per patch/problem.)
Status: REOPENED → RESOLVED
Closed: 16 years ago → 16 years ago
Resolution: --- → FIXED
Wait: cjones, we construct this with IPC_PRIVATE, which means that we should be OK here anyway by my recently-refreshed understanding of how IPC permissions and access work. What is the attack you have in mind?
I'm using desktop QT build... redirecting output on Xephyr DISPLAY=:2 which is running in separate window
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Oleg: this bug is FIXED. The patch is in the tree. Unless we back it out and recreate the security issue alleged in comment 0, it should not be REOPENED. We should get information about the actual behaviour of the shm segments in these various cases, and write some tests, rather than just permuting, IMO.
Status: REOPENED → RESOLVED
Closed: 16 years ago → 16 years ago
Resolution: --- → FIXED
Depends on: 559837
Oleg filed 559837.
Sorry for the tempest in a teapot. The shmget man page on my linux system says Presently, the execute permissions are not used by the system. So this particular bug could be RESOLVED INVALID since AFAIK we only use sysv shmem on linux. We might want to continue the 0600 vs. 0666 discussion in Oleg's bug. For the record, if I set things up correctly, these programs test if nobody/nogroup can attach to a 0666 segment. Locally I see $ ./shmget_test unpriv: succeeded unpriv: done scribbling So I really hope we can avoid using 0600.
(Also FTR 0600 fails.)
(In reply to comment #21) > $ ./shmget_test > unpriv: succeeded > unpriv: done scribbling > Last note: this invocation was wrong, needs to be |sudo ./shmget_test| because it seteuid/setguid's. The test will always succeed if run as a normal user.
(In reply to comment #17) > Wait: cjones, we construct this with IPC_PRIVATE, which means that we should be > OK here anyway by my recently-refreshed understanding of how IPC permissions > and access work. ...howso? AFAIK, IPC_PRIVATE is just a magic value to say "give me an unused key".
Comment on attachment 439524 [details] [diff] [review] Fix to 0666 I am not convinced that this is the right thing to do. Maybe we should try 0600 first, then downgrade security to 0666 if we have to... but I really want to understand why 0600 doesn't work for your X server. I couldn't find one today that failed in the same way yours does.
Attachment #439524 - Flags: review?(dougt) → review-
tracking-fennec: ? → ---
Group: core-security → core-security-release
Group: core-security-release
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: