23-Year-Old X11 Server Security Vulnerability Discovered
An anonymous reader writes "The recent report of X11/X.Org security in bad shape rings more truth today. The X.Org Foundation announced today that they've found a X11 security issue that dates back to 1991. The issue is a possible stack buffer overflow that could lead to privilege escalation to root and affects all versions of the X Server back to X11R5. After the vulnerability being in the code-base for 23 years, it was finally uncovered via the automated cppcheck static analysis utility."
There's a scanf used when loading BDF fonts that can overflow using a carefully crafted font. Watch out for those obsolete early-90s bitmap fonts.
...looking elsewhere.
Amazing how an automated tool can spot something like this after so many years.
Privilege escalation is to the server credential. Modern X11 is never run as root. This is sensationalism.
When was the last time you installed a "specially crafted" bdf font from anywhere?
There are *much* worse actual security problems than this one, which in practice, wasn't much of a problem in its day several decades ago, and isn't a problem now...
What's good is that the tools keep improving, and exposing problems...
I sure wish Slashdot's editors would actually apply their brains to submissions, rather than cluttering up slashdot with things that aren't important; there will be security reports that actually matter for people to pay attention to....
plenty of other vulnerabilities wide open :-)
There's a scanf used when loading BDF fonts that can overflow using a carefully crafted font. Watch out for those obsolete early-90s bitmap fonts.
And watch out for scanf(). There's a reason Microsoft brought scanf_s() and others, which the official C11 standard adopted later too.
Root isn't the only kind of vulnerability. Seizing control of peoples' UIs is a pretty big deal(especially as far as phishing or keylogging goes).
...of the specifics, but can someone tell me why it's even possible for something like a fucking font to cause a security issue? I'm not a coder, it's not something I can wrap my head around. I can sometimes get the gist of what a bit of code is doing when I look at it, but that's beside the point. It just seems to me so many things that should not be able to pose a security risk somehow get manipulated into being such risks, and it just blows my mind how it's even possible.
considering my browsing history, and a good chunk of personal information, to include my music collection is not root, someone with access to my non-privliedged user can do a fuckton of damage still.
If this was closed source, this bug would probably still be undiscovered.
It was designed assuming X11 (and Linux itself) had big security holes to begin with.
In fact, after acclimating to the Qubes desktop architecture the whole monolithic kernel + X server arrangement looks like a raft full of holes waiting to exploited. Both the X11 layer *and* the Linux kernel need to be demoted to providing features only, not relied upon for overall system security.
Did you actually even bother checking this? No, most modern X11 servers run as root so they can* have hardware access to GLX and DRM. But, please tell me, which distro or OS do you run that runs your X11 server as non-root? Because I'd love to use a system like that.
*Technically, privilege separation is quite possible on these points, which has been done in OpenBSD AFAIK, but very few people use OpenBSD and I think the whole point of your post was about what the vast majority of people use. Otherwise, you're just quibbling over the point without stating it that most people don't run a "modern" X11 server.
Eurohacker European paranoia, gun rights, and h
My Debian unstable installation would beg to differ.
$ ps aux /usr/bin/X :0 vt7 -br -nolisten tcp -auth /var/run/xauth/A:0-86aX4a
[...]
root 24768 6.1 0.4 183832 34716 tty7 Ss+ Jan08 14:15
Privilege escalation is to the server credential. Modern X11 is never run as root. This is sensationalism.
The X.Org Security Advisory thinks otherwise:
including the Xorg server which is often run with root privileges or as setuid-root in order to access hardware
You may not be vulnerable, but someone (possibly Younger You) is.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NetBSD Security Advisory 2014-001
Topic: Stack buffer overflow in libXfont
Version: NetBSD-current: source prior to Tue 7th, 2014
NetBSD 6.1: affected
NetBSD 6.0 - 6.0.2: affected
NetBSD 5.1 - 5.1.2: affected
NetBSD 5.2: affected
Severity: privilege escalation
Fixed: NetBSD-current: Tue 7th, 2014
NetBSD-6-0 branch: Tue 7th, 2014
NetBSD-6-1 branch: Tue 7th, 2014
NetBSD-6 branch: Tue 7th, 2014
NetBSD-5-2 branch: Tue 7th, 2014
NetBSD-5-1 branch: Tue 7th, 2014
NetBSD-5 branch: Tue 7th, 2014
Teeny versions released later than the fix date will contain the fix.
Please note that NetBSD releases prior to 5.1 are no longer supported.
It is recommended that all users upgrade to a supported release.
Abstract
A stack buffer overflow in parsing of BDF font files in libXfont was
found that can easily be used to crash X programs using libXfont,
and likely could be exploited to run code with the privileges of
the X program (most nostably, the X server, commonly running as root).
This vulnerability has been assigned CVE-2013-6462
Technical Details
- From the X.org advisory:
Scanning of the libXfont sources with the cppcheck static analyzer
included a report of:
[lib/libXfont/src/bitmap/bdfread.c:341]: (warning)
scanf without field width limits can crash with huge input data.
Evaluation of this report by X.Org developers concluded that a BDF font
file containing a longer than expected string could overflow the buffer
on the stack. Testing in X servers built with Stack Protector resulted
in an immediate crash when reading a user-provided specially crafted font.
As libXfont is used to read user-specified font files in all X servers
distributed by X.Org, including the Xorg server which is often run with
root privileges or as setuid-root in order to access hardware, this bug
may lead to an unprivileged user acquiring root privileges in some systems.
This bug appears to have been introduced in the initial RCS version 1.1
checked in on 1991/05/10, and is thus believed to be present in every X11
release starting with X11R5 up to the current libXfont 1.4.6.
(Manual inspection shows it is present in the sources from the X11R5
tarballs, but not in those from the X11R4 tarballs.)
Solutions and Workarounds
Workaround: restrict access to the X server.
Solutions: a fix is included in the following versions:
xorg: xsrc/external/mit/libXfont/dist/src/bitmap/bdfread.c
HEAD 1.3
netbsd-6 1.1.1.2.2.1
netbsd-6-1 1.1.1.2.6.1
netbsd-6-0 1.1.1.2.4.1
netbsd-5 1.1.1.1.2.2
netbsd-5-2 1.1.1.1.2.1.4.1
netbsd-5-1 1.1.1.1.2.1.2.1
xfree: xsrc/xfree/xc/lib/font/bitmap/bdfread.c
HEAD 1.4
netbsd-6 1.2.8.1
netbsd-6-1 1.2.14.1
netbsd-6-0 1.2.10.1
netbsd-5 1.2.2.1
netbsd-5-2 1.2.12.1
netbsd-5-1 1.2.6.1
To obtain fixed binaries, fetch the appropriate xbase.tgz from a daily
build later than the fix dates, i.e.
http://nyftp.netbsd.org/pub/NetBSD-daily////binary/sets/xbase.tgz
with a date 20
CLI paste? paste.pr0.tips!
Modern X11 servers do run as root. OpenBSD an XQuartz are the exception. Solaris kinda drops privileges, but keeps the root as saved uid. Linux distro's (Fedora, OpenSuSE, Debian, ubuntu, slackware, ...), FBSD, NBSD, hell, even Minix, all run it all as root.
Unix based file ownership and X not running as root despite somehow a font(?) can take over a UI (kek) this is not a story but it is amusing. If anything this submission is scareware. If I was running at a default administrator level on a Microsoft operating system Windows environment I would be very afraid. But I'm not.
> Modern X11 is never run as root
On Arch, at least, X is still run as root. I don't know about other distributions, but I would guess it is quite common. Also, because most of us like to actually use graphics for games and stuff, we run binary drivers. Can nVidia's drivers and Catalyst run with a non-root X? Neither supports KMS, so it seems the answer would be no.
I know Win7 is a different codebase, but just yesterday on my work Win7 machine I started getting an error about installing fonts in Adobe Reader when trying to start Access. The error was about installing a font I've never heard of. Also, not long before that error occurred, one column in one query returned the results in a chinese character set.
I'm running OpenBSD on my VAX. Go ahead. Try to exploit a buffer overflow on my home VAX cluster. If you can, then you deserve a prize because you've learned VAX machine code.
Karma: Excellent. 15 moderator points expire sometime.
I am pretty sure the Xserver which runs on the user's end and accepts connections from X clients like like xterm and gnome.
Or has the terminology changed?
You think that giving an unknown untity read, write, and execute access to all of your files and executables is sensationalist? It may not be as bad as getting root, but it is certainly a problem. And given that there are numerous ways of embedding fonts in file formats such as Flash and PDFs, it may be possible to get hit by this just by browsing the web. That doesn't even begin to describe all the damage it could do by downloading custom malware that keeps the door open for authors to upload new malware, especially after the potential exploit scans all of the processes running on the machine running as root and determines which version is running for each process. Cross-reference that with a list of known vulnerabilities for that software version, use your custom server process to upload and execute the new exploit and you've got root. Yeah, it's work, but I imagine getting your foot in the door is the hardest part and that's exactly what this vulnerability could easily do.
Interesting...there could be a bug there somewhere.
or like up say...apache...or the database or real users... who cares about root anyway - when the stuff doing actual work and has access to data is run by other users. escalation is escalation
On certain non-x86 architectures X can be run without the kernel aperture driver in the OpenBSD. I have no idea how Linux has implemented these things, though.
Number of ./ ignorants like you is staggering.
Privilege escalation is to the server credential. Modern X11 is never run as root. This is sensationalism.
This is why I run X9 still... I wasn't convinced that the bugs in X11 have been worked out yet -- and I was right!
Did you actually bother to check on multiple platforms? It's only on FreeBSD that the X server runs on root
drink@alexander:~$ cat
Ubuntu 13.10 \n \l
drink@alexander:~$ ps auxw | grep X /usr/bin/X -core :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
root 1267 2.3 1.1 348276 96612 tty7 Ss+ Jan05 105:36
hmm.
"You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
...unknown untity...
is this some sort of mysterious zombie boob?
Any truly epic pwnage these days chains together a string of vulnerabilities like this that aren't earth shattering on their own.
I'm under the impression that with KMS the display-side of X no longer needs root, but that there's something about input handling that still does. As you say, non-KMS drivers would still need root.
I would expect that privilege separation could be used here, a small root stub to do the root-only things, and the rest of the server running with dropped privileges. In that situation, could the server even run as "nobody"? After all, content comes through the socket.
The living have better things to do than to continue hating the dead.
... by the developers. That a bug or vulnerability is found and announced in certain moment, be in closed or open source programs, don't ensure that the bad guys (working for the NSA or other places) haven't found and been exploiting it for some time already. That the bug can be found in automated ways (in this case was static source analysis, but could be checking for undocumented open ports or sql injection) makes almost certain that it could had been exploited before.
Does that matter? With code pages marked as read-only and data pages marked as no execute is it even possible to turn such a buffer overflow into an exploit other than DoS any more?
SJW n. One who posts facts.
I find this interesting since most of us gave Microsoft flack for so many years because of their terrible vulnerabilities. Turns out that nearly 90% of all Windows updates are for patching security issues with the UI. That is why Microsoft is convincing admins to use Server 2012 with just Server Core and PowerShell simply because it makes the whole system more secure. Who needs more than a console anyway? If you ask me you can get plenty of work done with vim, lynx, and entertain yourself with 0verkill. ;-)
*plays the Apogee theme song music*
i dont run x as root. i accidentally type 'startx' in the login box nearly every damn day >
Really? A quick look at Solaris11, Scientific Linux, and Fedora all say root. If I had my IRIX box up and running I'd bet it would say root too (granted, it's XSGI, not XOrg, so this probably doesn't apply). My HP-UX and AIX boxes don't appear to be running any form of X
From SL 6.4: /etc/issue
[armanox@dionysus ~]$ cat
Scientific Linux release 6.4 (Carbon)
Kernel \r on an \m
[armanox@dionysus ~]$ ps auxw | grep X /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-Ms7KTS/database -nolisten tcp vt1 /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-Ms7KTS/database -nolisten tcp vt1
root 2413 1.1 0.8 150984 34360 tty1 Ss+ 04:05 8:04
armanox 14804 0.0 0.0 103252 848 pts/2 S+ 15:52 0:00 grep X
[armanox@dionysus ~]$ ps -ef | grep X
root 2413 2410 1 04:05 tty1 00:08:04
armanox 14825 14767 0 15:53 pts/2 00:00:00 grep X
[armanox@dionysus ~]$
and Fedora 18: /etc/issue
[armanox@hecate ~]$ cat
Fedora release 18 (Spherical Cow)
Kernel \r on an \m (\l)
[armanox@hecate ~]$ ps -ef | grep X /usr/bin/abrt-watch-log -F Backtrace /var/log/Xorg.0.log -- /usr/bin/abrt-dump-xorg -xD /usr/bin/Xorg :0 -background none -verbose -auth /var/run/gdm/auth-for-gdm-nsglUa/database -seat seat0 -nolisten tcp vt1
root 596 1 0 00:13 ? 00:00:00
root 935 797 0 00:13 tty1 00:00:18
armanox 25526 1866 0 11:54 pts/1 00:00:00 grep --color=auto X
[armanox@hecate ~]$
Solaris on Sparc: /usr/bin/Xorg :0 -nolisten tcp -br -novtswitch -auth /tmp/gdm-auth-cookies-pEay
Last login: Mon Jan 6 17:28:37 2014 from lab-files-001.l
Oracle Corporation SunOS 5.11 11.0 November 2011
admin@solarisvmsrv1:~$ ps -ef | grep X
root 1308 1303 0 Nov 06 vt/7 102:15
admin 41176 41171 0 11:35:42 pts/1 0:00 grep X
admin@solarisvmsrv1:~$
I'm starting to think GNU is the problem with "GNU/Linux" these days.
It's kinda funny, but all my XServers run on Windows these days, and only run once in a blue moon, so I can access that one or two stubborn applications that requires X. Not that it makes it less of an issue.
If only 3 people(they wont live forever) understand and maintain the underlining technology of x11 isn't it about time to replace it with wayland(which is community driven unlike mir) as soon as possible. I don't understand why nvidia and amd wont develop drivers for wayland and leave the x11 headache behind.
The vulnerability is interesting. I'd be more interested in someone writing a tool to exam fonts for any that exploit this flaw and then seeing how many trace back to the NSA
But, please tell me, which distro or OS do you run that runs your X11 server as non-root? Because I'd love to use a system like that.
It's possible on almost any Linux distribution if you're using a KMS-based (modern open-source) driver. Actually has been like that for a couple years now. There are some lingering permissions problems (need write access to the tty it's running on, a few other device nodes, and the log files -- most of these are solved by using SGID to a dedicated group rather than SUID to root, the rest require minor patches or config changes) but the big hurdles are gone.
It's not the default anywhere because it's mildly fiddly to setup and requires that you're using the open source Intel, ATI, or Nouveau drivers. Probably has some problems with using a display manager (KDM, GDM, XDM, etc.) too, as those login to the already-running X server rather than starting a new one for the user.
Obama.
The fact it uses bitmapped fonts and can't do modern rendering and use the gpu and handle font hinting unless run as root is an epic failure and showing its age. The geeks who started Linux after 2003 had no clue how much of a hog x was on a 32 meg system. It would take 80% of your freaking ram! Somehow it is popular now to love xorg yet its ugly past keeps rearing its head.
http://saveie6.com/
You are kind of correct. The Xserver is actually run under the user's ID. Now there may be a listener like gdm that may run as root, but the X11Server is actually the client and runs as the user and the clients are actually apps that run on the server, like xterm and gnome.
Did you actually even bother checking this? No, most modern X11 servers run as root so they can* have hardware access to GLX and DRM. But, please tell me, which distro or OS do you run that runs your X11 server as non-root? Because I'd love to use a system like that.
I think you and I have different definitions of "modern": XQuartz, OpenBSD, KMS all perform privilege separation.
It's actually trivial to do privilege separation of FreeBSD and NetBSD as well, if you are willing to apply patches, but there are known bugs in their non-POSIX saved IDs implementations that are problematic in this case. Linux has similar credentials implementation problems surrounding supplementary groups.
In terms of tty ownership, there are POSIX calls which can be used to take and drop ownership pretty trivially, if they are used in the correct order, and the non-root credential you run as doesn't have to be the same as the logged in user, nor does the XServer need to have write access to its own configuration files.
Trojanning authentication dialogs and so on are still an issue in the case that the buffer overflow is used, in the absence of a font server, and with local write access to the fonts directory, using this bug, but the advisory is a serious exageration at best; if they have write access to your fonts directory, you're pretty much already screwed.
X is no longer shipped with the default installation since 10.8 (Mountain Lion).
Just like they did for the floppy disk, Firewire, optical disks, and so on. It is most likely going to disappear within a year or two.
Bet systemd will have similar problems. Minimally complex code and programs are the unix way.
Through exploiting Xorg then it can likely exploit more *important* things like credit card numbers, bank account information, and so on and so forth. The likelihood is very high that the exploited X server is going to host an input of some great importance.
If the user is very fastidious in sorting every single little thing into distinct AppVMs, then the attack surface can be meaningfully reduced. However such a fastidious user is unlikely to do activities that would cause bitmap fonts to be read in from an untrusted source.
Qubes OS is a fascinating tool to help the careful be more effective in their effort, but the practical reality is that the people most afflicted by these attacks would not create a more secure environment in Qubes than a normal environment.
XML is like violence. If it doesn't solve the problem, use more.
Does that matter? With code pages marked as read-only and data pages marked as no execute is it even possible to turn such a buffer overflow into an exploit other than DoS any more?
Yes it is. The technique is referred to as "return oriented programming". That is why you need strong ASLR to make DEP/NX effective. Windows and OS X (IIRC) are the only OSes with strong and complete ASLR.
Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
I wonder how long the douche-bags at the NSA have known about this one.
Brave Sir Robin ran away. ("No!") Bravely ran away away. ("I didn't!")
You can use the "return to" exploit paradigm instead (that may be be return-to-libc or something else, all that matters is that you return to somewhere executable.)
Also FatPhil on SoylentNews, id 863
Anybody who uses Linux, Unix, *BSD, Solaris
I.e. push a different address onto the stack before you return, basically changing it to an unconditional jump?
Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
Interestingly, it's been X11 since 1985/6, according to Wikipedia. If this was a Google product, we would be on ~X190 by now, going off of Chrome's numbering.
Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
How can you know what the X Windows System is and not know that Linux runs it?
Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
Hundreds of free-software supporters are presently struggling with whether to cover their eyes and exclaim "LALALALALA" or whether to immediately start their "but Windows..." misdirection campaign.
I also run startx (will xinit) from terminal as a non-root user and my X server still runs as root (this is on arch linux). Seems strange to me as well.
Thats idiotic... If the old fonts had built in exploits, you might have noticed by now (not so sure anymore) ..
Nasty software however, can generate a malicious file and attempt to load it as a font...
I hope my VPS hosting provider doesn't run X...