Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 105444 - x11-base/xorg-x11 does not clear VRAM on pixmap creation
Summary: x11-base/xorg-x11 does not clear VRAM on pixmap creation
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Auditing (show other bugs)
Hardware: All Linux
: Low normal (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-09 17:59 UTC by Aurel Wildfellner
Modified: 2007-01-06 17:04 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aurel Wildfellner 2005-09-09 17:59:16 UTC
Hi, I wrote an exploit for xorg (more by exident than by plan), which makes it
possbile that one user can read "screen data" of an other user, which is running
xorg on the system. (It seems to be a xorg bug but maybe it's even a problem
with Linux itself). 

xorg-X11: 6.8.2-r1
Linux: 2.6.12-rc1 (I know i,... ;)

These small "photo story" should explain the problem well enough:

http://img292.imageshack.us/my.php?image=strangestory04nk.png
http://img292.imageshack.us/my.php?image=strangestory18xh.png

Please ask for more information, i don't want to write too much now.
Comment 1 SpanKY gentoo-dev 2005-09-09 19:16:14 UTC
well chances are good we're going to need a lot more info here

for starters, how can we reproduce it locally
Comment 2 Donnie Berkholz (RETIRED) gentoo-dev 2005-09-09 19:26:31 UTC
Ajax, would appreciate your input on this.
Comment 3 Aurel Wildfellner 2005-09-10 03:27:56 UTC
Ok, here comes a short version of my code, the orginal one is a bit complexer
and seems to give other (better) data aswell (subjective):

#########################CODE##############################
#include <iostream>

#include <QApplication>
#include <QLabel>
#include <QPixmap>

int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	int x,y;
	std::cout << "(Sep. 2005) Aurel \"DustyDingo\" Wildfellner, use this only for
fixing the bug! \n";
	std::cout << "This is an exploit for xorg (written by exident), it will display
randomly some image data even from other users, who run xorg at the same time.
It's a bit like lotto, type in two numbers (0-1000 are ok, but try what you
want), they are more for the size, but sometimes they influence the result too. \n";
	std::cout << "type in an integer number (x)# ";
	std::cin >> x;
	std::cout << "type in an integer number (y)# ";
	std::cin >> y;
	QLabel label;
	QPixmap pixmap(x,y);
	label.setPixmap(pixmap);
	label.show();
	
	return app.exec();
}
############################CODE##############################

You need Qt4 to build this code:
# qmake -project
# qmake 
# make
and run it

Tested with:
Gentoo Linux (of course)
Linux 2.6.12rc1
xorg-X11 6.8.2-r1 (which is stable btwn.)
Qt for this exploit: Qt-Copy from kdesvn trunk
Qt linked from kde: 3.3.4-r5
KDE 3.4.1
Fluxbox

The best way to reproduce it is to make the same things as in my screenshots
before. Try it several times also with restarting xorg or even the whole system,
because it is not for sure, if it works immediately. Try to produce many
imagedata before running the code, like watching a movie, serving the web or
browse your personal photos. Also try to run it with an different user under the
same wm (open a shell, su - otheruser, and run it).
Comment 4 Adam Jackson 2005-09-10 09:18:34 UTC
without knowing qt too well, it's hard to say what this code is actually doing.
 however:

X makes no effort to zero out framebuffer memory on VT switch.  i believe
pixmaps are initially created with "undefined" contents.  so on switch, the
first server leaves the old pixmap data in place; and the second server
allocates some offscreen range that happened to be used by the first server.

in some sense this is a non-issue, because the attack requires both that you
have two servers running on the same card and that the attacker has essentially
physical access to the machine, in which case you're pretty well boned already.
 but if we decide it's a real issue we can just put a memset in the right place.
Comment 5 Aurel Wildfellner 2005-09-10 11:52:45 UTC
i let this image speaking for me:

http://img75.imageshack.us/my.php?image=snapii0zackawatztllsssaaal0kl0.png

Ok it's a successful atack.
So, now we are all in complete agreement that it is a issue, we should be very
careful, and those who are able to fix it should start. ;)
Comment 6 Tavis Ormandy (RETIRED) gentoo-dev 2005-09-13 05:57:26 UTC
I dont see how this could possibly be an issue, If two servers are running on 
the same physical machine, user A can simply switch to B's server and do 
whatever he likes. This is no more a security issue than user A logging in on 
vt1 and user B logging in on vt2 and then user A switching over to user B's 
terminal when he's not looking.

Unless anyone has anything to add, I think this one is INVALID.
Comment 7 Donnie Berkholz (RETIRED) gentoo-dev 2005-09-13 06:01:16 UTC
What if you consider the multiple monitors/keyboards/mice case, where they're
both simultaneously not just running, but using, X?
Comment 8 Tavis Ormandy (RETIRED) gentoo-dev 2005-09-13 06:10:29 UTC
Spyderous: why would there be a vt switch in that case?
Comment 9 Adam Jackson 2005-09-13 07:38:57 UTC
(In reply to comment #8)
> Spyderous: why would there be a vt switch in that case?

there wouldn't.  the attack can only happen when you have two users running on
the same card (though perhaps not at the same time: first user logs out, second
user logs in is also a valid attack path).
Comment 10 Aurel Wildfellner 2005-09-13 14:21:47 UTC
You don't need two running x-servers at the same time for that. It also works,
when there was a user who runs xorg before and loggs out (also shut down the
xsrver). After that an other user can logg in and see screendata from the
previos user. This is a security problem on boxes with severall users, like
temrinals in schools, universities or some office pcs.
I thought that this was clear, and at least a probleme which should be fixed.
Comment 11 SpanKY gentoo-dev 2005-09-13 15:49:00 UTC
no, the problem with this bug is that there really wasnt a whole lot of
explanation anywhere
Comment 12 Adam Jackson 2005-09-13 17:26:34 UTC
it's slightly more general than just "between restarts".
Comment 13 Tavis Ormandy (RETIRED) gentoo-dev 2005-09-14 01:01:34 UTC
Has anyone actually confirmed this works after restart?

Regardless, I'm not convinced it's a security issue, when you logout from a vt 
the screen isnt explicitly cleared, you can still use shift-pgup, etc. You also 
still require physical access, so this is the least of your worries.

I'm tempted to mark this INVALID/WONTFIX and suggest you report it to the 
freedesktop.org folks who might be interested in changing this behaviour.
Comment 14 Tavis Ormandy (RETIRED) gentoo-dev 2005-09-14 01:24:47 UTC
Okay, after discussing it with security team, if someone can confirm this works 
after an X server restart (ie, user A logs out, then user B logs in and can 
obtain uninitialized memory that can be used to discern what user A was doing), 
I'll move it into Vulnerabilities.
Comment 15 Tavis Ormandy (RETIRED) gentoo-dev 2005-09-14 08:42:30 UTC
for what it's worth, that code just creates a black window here.

Can someone who can reproduce this please check if it works after logout.
Comment 16 Tavis Ormandy (RETIRED) gentoo-dev 2005-10-03 09:24:01 UTC
ping
Comment 17 Tavis Ormandy (RETIRED) gentoo-dev 2005-10-05 10:46:21 UTC
closing as WORKSFORME, reporter you may want to report this to freedesktop.org 
if you still have concerns.