News for hackers. Stuff that matters.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @01:41PM (#26524680)
Sorry 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 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) UTF-8 support is enabled by default on OpenBSD, and probably all other distros by now.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by hannob on Saturday March 20, 2021 @03:14PM (#26525344)
> 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @02:34PM (#26525025)
Other 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by JoshTriplett on Saturday March 20, 2021 @02:46PM (#26525114)
It'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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @02:51PM (#26525165)
I 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.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by JoshTriplett on Saturday March 20, 2021 @03:03PM (#26525271)
See 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/msg0... (warning, contains the raw test case, may crash a text-based browser).

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by craig131 on Saturday March 20, 2021 @03:17PM (#26525368)
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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by formerly_proven on Saturday March 20, 2021 @02:28PM (#26524981)
> An attack vector might look like

SSHing into a host is probably sufficient and often crosses a "higher to lower" security boundary.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @02:30PM (#26524993)
Very true. There are a million ways to get text displayed on someone’s terminal.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @03:41PM (#26525587)
Which, of course, as we now know, isn't enough to trigger this vulnerability.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by syzzer on Saturday March 20, 2021 @02:31PM (#26524997)
> 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...)

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by pengaru on Saturday March 20, 2021 @02:36PM (#26525037)
The 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?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @02:39PM (#26525061)
Fair, 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.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by rincebrain on Saturday March 20, 2021 @02:40PM (#26525063)
Related 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/msg0... (and then 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by rurban on Sunday March 21, 2021 @05:47PM (#26534411)
The patch is still handwaving, and not doing proper boundschecks. 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @02:37PM (#26525043)
I 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @02:42PM (#26525076)
I’d usually agree, but 9.6 indicates this is something you probably want to patch sooner rather than later.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @02:57PM (#26525219)
No, 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?

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by Arnavion on Saturday March 20, 2021 @03:20PM (#26525401)
In what universe is selecting text in a terminal an "idiosyncratic user interaction" ?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @03:21PM (#26525407)
You have to select exactly the right text, and that text will never look like "select this right now" --- if you've seen the characters we're talking about, it's like Zalgo text. Selection in an xterm is not the ordinary response to these strings.

This is a little like Clickjacking, where you'd expect a bounty hunter to come at you with "this very severe bug can be triggered simply by clicking", and you respond "well, we should fix that, but users never click in those places, so we're going to send you a t-shirt" and the bounty hunter responds "no, clicking is a fundamental user interaction, you should send me $5000".

And my point isn't even that this is a dumb bug (certainly, it's not as dumb as CJ usually is). It's that there is absolutely no fucking way it is a 9.6 on a 10.0 scale of severity. Shellshock, ffs, has the same NVD CVSS as this bug. Shellshock doesn't even care what terminal you're using.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by Arnavion on Saturday March 20, 2021 @03:27PM (#26525449)
>if you've seen the characters we're talking about, it's like Zalgo text. Selection in an xterm is not the ordinary response to these strings.

Yeah, with all due respect, you're not in touch with what ordinary responses are.

When people see zalgo like the infamous SO regex post, selecting it is the first thing they do.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @03:34PM (#26525528)
That's what the bug bounty person says about their CJ bug. Meanwhile: NVD has given this the same score as Shellshock, which is dispositive of how bad CVSS is.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by Arnavion on Saturday March 20, 2021 @03:43PM (#26525597)
In fact, it is dispositive about exactly the opposite. But let's agree to disagree.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @03:48PM (#26525629)
Shellshock was a universal RCE in anything that ran bash with control over environment variables --- which included a huge subset of all web services, often on any code path in which bash was just incidentally run. Not only that, but the vulnerability was exploited in bash; it wasn't memory corruption, there were no system-specific offsets to limit the scope of exploits, nor could you have preemptively hardened a system against it with ASLR or W^X.

NVD gives Shellshock the same CVSS as this vulnerability, which requires a user in xterm to see a bunch of international UTF-8 characters and select them precisely enough to make a memory corruption exploit encoded in those characters run --- and do that without any feedback from the target, because what you're interacting with here is xterm, not a network service you can talk directly to, or a Javascript runtime.

I do not agree to disagree. The CVSS here is simply wrong.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @03:02PM (#26525259)
I completely agree with that. I think it’s still a useful shorthand for “hey, you might want to take a look at this one”.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @03:03PM (#26525268)
Once 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @03:15PM (#26525356)
I understand what you’re saying and generally agree. We get incoming bug bounty reports like “drop everything, here’s a 9.8 you need to fix right now!” that turns out be a misunderstanding.

But in the case where multiple vendors have scores like:

- Amazon: Important (https://alas.aws.amazon.com/AL2/ALAS-2021-1619.html)

- Ubuntu: 9.8 (https://ubuntu.com/security/CVE-2021-27135)

- Red Hat: 9.6 (https://access.redhat.com/security/cve/CVE-2021-27135)

…it starts to look like there’s consensus that not only is there an RCE, but it’s really easy to exploit. I think that’s where CVSS starts to come in handy. An RCE is bad, but one that’s trivial to actually use is extra bad. And yes, CVSS absolutely has some Ouija properties, but it’s the most commonly used metric I’ve seen for communicating how bad a vulnerability actually is. In this case, it wasn’t just the reporter who said it was bad but all the affected vendors agreeing with them.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @03:20PM (#26525397)
Ubuntu is just taking the score from NVD. Redhat has applied the first Ouija input to it, adjusting it to "user interaction required". That changed the score from a 9.8 --- 0.2 points from the maximum possible CVSS score --- all the way down to... 9.6.

I can't think of a better illustration of how bad CVSS is.

Once again: my point isn't that the vulnerability is unimportant (though: it's not nearly as important as it likely seems) or that it doesn't belong on the HN front page (it is a very, very funny vulnerability). It's simply that we should not be editorializing CVSS scores into titles, or taking CVSS scores seriously when they occur organically in titles.

CVSS is very, very bad. It is the CISSP of security metrics.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kstrauser on Saturday March 20, 2021 @03:24PM (#26525427)
That ending made me LOL. Well phrased.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by edoceo on Saturday March 20, 2021 @04:27PM (#26525858)
I had to look it up: Certified Information Systems Security Professional
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by gautamcgoel on Saturday March 20, 2021 @02:33PM (#26525024)
Has this been patched yet?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by readflaggedcomm on Saturday March 20, 2021 @02:51PM (#26525158)
I 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

So that should be easy to tell whether your system has it fixed or not, beside the Fedora and Debian links in the article.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by acidburnNSA on Saturday March 20, 2021 @02:49PM (#26525137)
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by teddyh on Saturday March 20, 2021 @03:06PM (#26525291)
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by rincebrain on Saturday March 20, 2021 @02:49PM (#26525150)
There's a patch available, yes. Debian and Fedora at least are shipping it.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by kyberias on Saturday March 20, 2021 @02:46PM (#26525113)
Am I safe if I use my Digital VT100 from the 80s?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by egberts on Saturday March 20, 2021 @03:32PM (#26525504)
Yes. UTF-8 was not a thing during VT-100’s lifetime.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by mnd999 on Saturday March 20, 2021 @02:52PM (#26525169)
Depends - does it supports UTF-8?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by toast0 on Saturday March 20, 2021 @03:02PM (#26525258)
A fixed function terminal from the 80s certainly doesn't support a variable byte character encoding from the 90s.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by cozzyd on Saturday March 20, 2021 @03:11PM (#26525326)
Not to downplay this bug, but how many people use xterm instead of gnome-terminal or Konsole? Or are those somehow affected too?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by taviso on Saturday March 20, 2021 @03:21PM (#26525405)
I 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by cozzyd on Saturday March 20, 2021 @04:07PM (#26525746)
What are some features xterm has that I'm missing out by using gnome-terminal? Not doubting, just ignorant.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by taviso on Saturday March 20, 2021 @04:28PM (#26525865)
Off 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 :-)

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by cozzyd on Saturday March 20, 2021 @04:49PM (#26525977)
sixels does look really useful! Fortunately it looks like vte will have it available soon: https://gitlab.gnome.org/GNOME/vte/-/issues/253
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by igetspam on Saturday March 20, 2021 @03:15PM (#26525357)
Lots. Xterm is everywhere. It's like using vim or emacs or bash. It's pretty much always there and always behaves the same.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by cozzyd on Saturday March 20, 2021 @04:04PM (#26525728)
Sure, 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by sneak on Saturday March 20, 2021 @03:17PM (#26525378)
Yes, 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.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by nynx on Saturday March 20, 2021 @02:31PM (#26525007)
When is this madness of using unsafe languages for applications that interact with outside systems going to end?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by toast0 on Saturday March 20, 2021 @03:23PM (#26525417)
You would need a dedicated team (starting with a dedicated person), willing to rewrite so much existing C code in a less unsafe language.

And they would need to be willing to spend a lot of time on making sure the new implementation was just the same as the old version, and can compile and run on all the same platforms and what not.

I don't think it would be easy to get funding for that, so your dedicated team is going to have to be independently wealthy, or not spend a lot of time on it.

If rust is your selected less unsafe language, as I understand it, it doesn't have as full platform support as gcc or clang, so that's a challenge (which gets easier over time as non-x86 and non-arm die out). Other languages have other challenges, but I don't think there's a clear winner here, which is part of the issue.

The new utilities will be judged on functionality (should be exactly the same), and cpu/memory/binary size which should all be the same or less. It's hard to guarantee that.

Not a whole lot of people want to develop with that framework. You don't see a whole lot of Show HN: I made a replica of X, with no changes to functionality. Everyone always wants to change things.

Anyway: be the change you want to see and all that. Pick a small package, reimplement it in rust (or whatever), and see if you can get it in distributions or convince the upstream to switch to your implementation. Then tell us how it went, and repeat with another package, etc.

Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tptacek on Saturday March 20, 2021 @05:22PM (#26526147)
How about we just start with xterm and go from there?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by toast0 on Saturday March 20, 2021 @08:26PM (#26527132)
Not me thanks. Terminals are a lot of weird code (even with a fixed width charcter set)
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by ris on Saturday March 20, 2021 @03:28PM (#26525461)
We're patiently awaiting your rust-rewrite of xterm. When can we expect the first release?
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by tdhz77 on Saturday March 20, 2021 @02:35PM (#26525032)
All 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.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by pjmlp on Saturday March 20, 2021 @03:13PM (#26525340)
Indeed, however given that 70% of exploits are caused by memory corruption bugs, like in this case, the IT world would be much safer if we only had to deal with the remaing 30%.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by nynx on Saturday March 20, 2021 @02:38PM (#26525050)
While 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.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by glnz on Saturday March 20, 2021 @02:45PM (#26525103)
Why does Python have a safe reputation around here? Everything is constantly rewritten by corporate sponsored developers and it is usually easy to find invalid accesses.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by nynx on Saturday March 20, 2021 @02:49PM (#26525135)
Personally, I dislike python. However, it's indisputably safer than C.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by Ar-Curunir on Saturday March 20, 2021 @02:53PM (#26525182)
All languages are unsafe the same way all diseases are fatal.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by burundi_coffee on Saturday March 20, 2021 @02:37PM (#26525044)
I think it still makes a difference if languages are created with safety in mind.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by mnd999 on Saturday March 20, 2021 @02:40PM (#26525064)
It 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.
Re:CVE-2021-27135: xterm flaw may allow remote code executio... by geofft on Saturday March 20, 2021 @02:43PM (#26525079)
Sometimes kids get badly injured climbing on a tiny playground structure, but we don't say "All climbing is unsafe" and stick toddlers halfway up El Capitan.