5 ms·
CVE-2021-27135: xterm flaw may allow remote code execution, CVSS 9.6
- kstrauser 6y agoSorry for the title, but the linked page’s own title wasn’t very descriptive. The short version of the problem is: > xterm through Patch #365 allows remote attackers to cause a denial of service (segmentation fault) or possibly have unspecified other impact via a crafted UTF-8 character sequence. https://access.redhat.com/security/cve/CVE-2021-27135 https://access.redhat.com/security/cve/CVE-2021-27135 has more information, explaining that “a specially crafted sequence of combining characters causes an out of bounds write leading to arbitrary code execution.”, and that: > This vulnerability can be mitigated by disabling UTF-8 support in XTerm configuration. An entry such as "XTerm.vt100.utf8: false" in Xresources will disable UTF-8. This can be set as a system default in /etc/X11/Xresources, or per-user in ~/.Xresources. > > Note that this setting can still be overridden if xterm is invoked with the "-u8" command line option, so the mitigation may not protect all use cases. Xterm doesn’t get a lot of reports, but a CVSS 9.6 is a doozy. An attack vector might look like: - Upload a package to PyPI or Node.js that emits specially crafted console output as part of its installer. - Profit. From a previous HN story (https://news.ycombinator.com/item?id=11248847 https://news.ycombinator.com/item?id=11248847) UTF-8 support is enabled by default on OpenBSD, and probably all other distros by now.
- formerly_proven 6y ago> An attack vector might look like SSHing into a host is probably sufficient and often crosses a "higher to lower" security boundary.
- syzzer 6y ago> Upload a package to PyPI or Node.js that emits specially crafted console output as part of its installer. If someone runs my installer without checking the contents, why would I need UTF-8 bugs to get code executed? (Not meant to downplay this bug, but the example made me wonder...)
- pengaru 6y agoThe host running the installer is often not the same as the one running the terminal emulator. Guess which is more likely to have keys to kingdoms?
- kstrauser 6y agoFair, so let’s skip the installation step and put the poison characters in its README so that `npm show hackerpackage` does the trick. Now installation isn’t necessary.
- kstrauser 6y agoOther attack vectors, for the purpose of illustrating that this is very important to patch: - Someone dislikes JavaScript and uses Lynx in xterm for their browsing. Make a web page that such people are likely to want to view. - Someone doesn’t like HTML email or tracking pixels, so they use Mutt in xterm. Put the crafted bytes in the subject of an email to them. - Put it in the MOTD of an SSH server. For that matter, in the version string of your server so that someone running “ssh -v attacker.example.com” sees it. This is so bad. Please go patch your systems immediately.
- JoshTriplett 6y agoIt's not quite as bad as that; it sounds like you also have to select the text. (The corresponding vulnerability in "screen", by contrast, doesn't require interaction, which makes it even more serious.) It's still extremely bad and should be patched immediately. But it doesn't appear to be a zero-interaction vulnerability, as far as I can tell from the description.
- kstrauser 6y agoI haven’t seen that yet. Do you have a link saying that you have to select text? That would help a lot in the mean time if true.
- JoshTriplett 6y agoSee https://www.openwall.com/lists/oss-security/2021/02/09/7 https://www.openwall.com/lists/oss-security/2021/02/09/7 : > To reproduce in XTerm, decode the file then try to select the line. For the original report on screen, see https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00000.html https://lists.gnu.org/archive/html/screen-devel/2021-02/msg0... (warning, contains the raw test case, may crash a text-based browser).
- craig131 6y agohttps://invisible-island.net/xterm/xterm.log.html#xterm_366 https://invisible-island.net/xterm/xterm.log.html#xterm_366 Specifically, the overflow is in the upper limit of the text selection buffer when characters are combined in UTF-8.
- hannob 6y ago> An attack vector might look like: You skipped over the step actually writing an exploit for this. This is some typical memory corruption. Exploiting these on any modern-day system isn't as straightforward as it was in the past. With ASLR and other mitigations you usually need some form of memory leak to find out about addresses. But even if you have that you need some way for your exploit to know about the leaked address. Most exploits that do this involve some form of scripting (the most common being browser-based exploits written in javascript). I have no idea how you would pull that off in a README file.
- nynx 6y agoWhen is this madness of using unsafe languages for applications that interact with outside systems going to end?
- tdhz77 6y agoAll languages are unsafe. We find bugs of “safe” languages sometimes 30 years after the exploit was introduced. Just because we don’t know doesn’t make them safe.
- burundi_coffee 6y agoI think it still makes a difference if languages are created with safety in mind.
- mnd999 6y agoIt certainly does help but as the parent says it’s not a silver bullet. The lazy unhelpful comment above adds very little to the discussion when the software in question is (in some cases decades) older than those languages.
- nynx 6y agoWhile that's true, the likelihood of a bug like this existing in an application written in a language like python, go, or rust (heck, even C++) is orders of magnitude less than the likelihood of it being in software written in C.
- gautamcgoel 6y agoHas this been patched yet?
- acidburnNSA 6y agoPatch for Ubuntu was released on Feb 24. https://www.ubuntuupdates.org/package/core/groovy/universe/updates/xterm https://www.ubuntuupdates.org/package/core/groovy/universe/u...
- rincebrain 6y agoThere's a patch available, yes. Debian and Fedora at least are shipping it.
- readflaggedcomm 6y agoI believe it's the issue fixed in patch #366 reported by Ormandy, who is in the article's mailing list links: https://invisible-island.net/xterm/xterm.log.html https://invisible-island.net/xterm/xterm.log.html So that should be easy to tell whether your system has it fixed or not, beside the Fedora and Debian links in the article.
- teddyh 6y agoYes: https://security-tracker.debian.org/tracker/CVE-2021-27135 https://security-tracker.debian.org/tracker/CVE-2021-27135
- tptacek 6y agoI don't think we need CVSS scores in titles. CVSS is a Ouija board metric. There was a similar-seeming recent vulnerability in GNU screen.
- kstrauser 6y agoI’d usually agree, but 9.6 indicates this is something you probably want to patch sooner rather than later.
- tptacek 6y agoNo, it doesn't. That's exactly the problem. You can make CVSS say whatever you want it to. You can see the problem on this very thread. Josh Triplett points out that (unlike the screen variant of the vulnerability), the xterm vulnerability requires user interaction: you have to select the text. And yet it has practically the maximum possible CVSS score. What does CVSS even mean if the difference between a zero-interaction drive-by RCE and one that requires an idiosyncratic user interaction is just 0.4 points?
- kstrauser 6y agoI completely agree with that. I think it’s still a useful shorthand for “hey, you might want to take a look at this one”.
- tptacek 6y agoOnce again: my point is that it is the opposite, because you can make lots of vulnerabilities read out this way even if they're not at all urgent --- and the opposite thing is true, very severe vulnerabilities can also get surprisingly low scores. CVSS is literally a Ouija board. I'm not just calling it that because it's unreliable or based on superstition. I'm saying that the process of arriving at a CVSS score is Ouija-like: you fill out a calculator or something, get a score that has no relation to your intuition of the severity of the vulnerability, and start applying small bits of pressure here and there to land on the score you know the vulnerability should land on. In fact: if you don't do that, you get exceptionally dumb CVSS scores for everything. It's a mess. If you want to call out the severity of a vulnerability, you should do so with objective facts. "Remote code execution" is a good tip-off. "CVSS 9.6" is not.
- rincebrain 6y agoRelated discussion from when this crash was originally found in screen and then they found a slightly modified version also worked on xterm (I can't find any nontrivial discussion of it on HN, surprisingly, but I had this article's link in my browser history from a month ago because of it): https://lists.gnu.org/archive/html/screen-devel/2021-02/msg00000.html https://lists.gnu.org/archive/html/screen-devel/2021-02/msg0... (and then https://www.openwall.com/lists/oss-security/2021/02/09/7 https://www.openwall.com/lists/oss-security/2021/02/09/7 ) It includes examples that work for crashing, so if you're browsing HN on links for some reason, I wouldn't go reading it.
- kyberias 6y agoAm I safe if I use my Digital VT100 from the 80s?
- cozzyd 6y agoNot to downplay this bug, but how many people use xterm instead of gnome-terminal or Konsole? Or are those somehow affected too?
- igetspam 6y agoLots. Xterm is everywhere. It's like using vim or emacs or bash. It's pretty much always there and always behaves the same.
- sneak 6y agoYes, but despite vim being there on tons of systems, nobody except vim users ever run it. Same for xterm. It's terrible and almost nobody uses it.
- cozzyd 6y agoSure, and so is Xeyes and ed, but that doesn't mean many people use it. I might use xterm on a remote system I vnc into that has no desktop manager but other than that I'm generally running everything in my local terminal emulator (and then often also in tmux). I'm sure I have xterm installed but I have never run it locally since like probably most people I just use the terminal emulator for my desktop environment.
- taviso 6y agoI dunno, I use xterm. It's fast, feature-rich, and every minute detail is configurable. I think gnome-terminal is based on vte, which wasn't affected. I have no clue about Konsole.
- cozzyd 6y agoWhat are some features xterm has that I'm missing out by using gnome-terminal? Not doubting, just ignorant.
- taviso 6y agoOff the top of my head, two features I don't think gnome-terminal can do: sixels, this is a terminal graphics format. You could use them to have thumbnails in ls output, or view image attachments in mutt. Tektronix mode, which is like a line-drawing mode - gnuplot supports it, so you can have really nice looking graphs and plots. There are just little quality of life improvements, like being able to dump the screen in html format, preserving colors and attributes, or easy one-click access to the alternate screen buffer. It's also easy to automate. You can use something like xtermcontrol to easily adjust anything from a script. Fonts, window size and position, etc. You can have custom key and mouse bindings too, and these are really powerful, but I'll concede the configuration format is arcane :-)
- rurban 6y agoThe patch is still handwaving, and not doing proper boundschecks. https://github.com/ThomasDickey/xterm-snapshots/commit/82ba55b8f994ab30ff561a347b82ea340ba7075c https://github.com/ThomasDickey/xterm-snapshots/commit/82ba5... Before he thought of a UTF-8 encode taking 4x the space, now he assumes 6x. This not a fix! A fix is to provide the destlen, and realloc if off bounds. Probably in a loop.