News for hackers. Stuff that matters.
Re:Darktile – GPU rendered terminal emulator designed for ti... by pama on Sunday August 29, 2021 @09:05PM (#28351932)
I’m curious: how do people verify the security of such low-level pieces of infrastructure?
Re:Darktile – GPU rendered terminal emulator designed for ti... by Seirdy on Sunday August 29, 2021 @09:14PM (#28351987)
Imperfect, incomplete, yet useful measures I take including building with some of Clang's sanitizers and running the program through a bubblewrap wrapper for filesystem sandboxing paired with a seccomp filter that allows a limited list of safer syscalls (including some W^X enforcement).
Re:Darktile – GPU rendered terminal emulator designed for ti... by leetrout on Monday August 30, 2021 @12:18AM (#28352778)
Is there a blog or webpage that summarizes all of this in one place?
Re:Darktile – GPU rendered terminal emulator designed for ti... by vidarh on Monday August 30, 2021 @08:36AM (#28354986)
With the caveat this may be useful to guard against exploitation of bugs, not against a malicious terminal (which can e.g. quietly wait for a user to ssh or su and intercept the password, and then execute code on the background).

Not to dissuade people from hardening them as I'm all for that.

(I'm sure you're aware since you pointed out these measures are incomplete. Just spelling it out.)

Re:Darktile – GPU rendered terminal emulator designed for ti... by Seirdy on Monday August 30, 2021 @12:56PM (#28357819)
bubblewrap and/or selinux can prevent the terminal from making network connections. but yeah, this is better for bugs.
Re:Darktile – GPU rendered terminal emulator designed for ti... by vidarh on Monday August 30, 2021 @05:15PM (#28360946)
You can stop it doing all kinds, but if you do, then it's not usable as a general purpose terminal. That's the problem.

A terminal needs to be able to spawn an unconstrained shell or other process linked to a pty that it controls the IO with.

That ability can equally be used for malicious purposes.

E.g. if the user can use the terminal to ssh anywhere, then the terminal itself can too.

There certainly can be situations were a constrained terminal could be useful too, though

Re:Darktile – GPU rendered terminal emulator designed for ti... by Seirdy on Tuesday August 31, 2021 @12:29PM (#28370071)
Not necessarily; it could simply connect to a tmux session.
Re:Darktile – GPU rendered terminal emulator designed for ti... by vidarh on Tuesday August 31, 2021 @01:05PM (#28370628)
In which case the terminal can use the tmux session to carry out its evil deeds.

Keep in mind that the terminal app is what reads keyboard events and passes them on to what it runs, and the terminal app reads the output back from the attached application (or tmux session) to render them to the screen. It has full control to monitor what you do, and to inject additional commands (and hide the responses) to whatever you connect it to.

Anything you can do in the terminal, the terminal can also do without your permission unless you do far more complicated filtering.

EDIT: I think what might not be clear here is how a terminal operates. It'll differ by operating system and winding system, but on Linux what you have is this:

    X server ----[keyboard events]----------> terminal ------[pty w/keyboard events]----> [app/shell/tmux session]
                  <---[rendering instructions]----/               <----[pty w/output]------------------/
The terminal is always a middleman, and can send whatever it wants to the app/shell/tmux session or whatever else you connect to it. It could "just" send your keypresses, or it can do macro expansions, or it could just randomly take over the endpoint on the other side.

You could conceivably still lock this down, but it would involve writing something that either replicates the keyboard event pipeline of the terminal to verify that what is sent over the pty matches the inbound keyboard events, or applying heuristics to what is sent to block things that seems odd, so it's potentially possible to do "something" useful here. E.g. something that blocks and pops up a warning if the pty "keyboard events" suddently contains the string "curl" when that string hasn't been seen in the keyboard events from the X server for example could be useful, but bubblewrap certainly can't do anything like that.

It'd be quite interesting to write a tool that wraps an app and allows you to script monitoring and/or munging of what goes over its sockets, though...

Re:Darktile – GPU rendered terminal emulator designed for ti... by dec0dedab0de on Sunday August 29, 2021 @09:27PM (#28352048)
Wait until it has a following, and everyone knows who the developers are. Then if something is malicious, you atleast know who to blame. It's really the same as anything else.
Re:Darktile – GPU rendered terminal emulator designed for ti... by pama on Sunday August 29, 2021 @09:43PM (#28352116)
It seems like an exploitable strategy, as long as people only know the developers online. The main problem with terminals compared to other infrastructure is that they often control pretty much everything and people become superusers in them.
Re:Darktile – GPU rendered terminal emulator designed for ti... by tadfisher on Sunday August 29, 2021 @09:15PM (#28351992)
The security of a terminal emulator? Did you post on the wrong article, perhaps?
Re:Darktile – GPU rendered terminal emulator designed for ti... by reilly3000 on Sunday August 29, 2021 @09:16PM (#28351997)
I suppose a bad actor could log keystrokes or terminal output and phone home. I can't think of anything more ring 0 than one's terminal. If you're especially evil you could register a domain that looks like an apt repo url and drop your payload during updates, so anybody inspecting traffic would probably miss it.
Re:Darktile – GPU rendered terminal emulator designed for ti... by tadfisher on Monday August 30, 2021 @01:15PM (#28358132)
I feel like the shell itself would be a much more lucrative target.
Re:Darktile – GPU rendered terminal emulator designed for ti... by reilly3000 on Monday August 30, 2021 @06:10PM (#28361485)
As in being able to execute arbitrary commands (silently)?
Re:Darktile – GPU rendered terminal emulator designed for ti... by tadfisher on Monday August 30, 2021 @09:10PM (#28362895)
Yes, and it could "keylog" over remote connections as well.
Re:Darktile – GPU rendered terminal emulator designed for ti... by pama on Monday August 30, 2021 @09:50PM (#28363115)
Very few admins would switch from bash (possibly zsh), and bash has tons of eyes looking over its codebase. Terminals are interchangeable and could direct the shell in ways that can be invisible to the user.
Re:Darktile – GPU rendered terminal emulator designed for ti... by tadfisher on Thursday September 02, 2021 @06:39PM (#28398260)
All the security review in the world won't stop a vulnerability elsewhere from replacing `sudo` with an alias in your `.bash_profile`.
Re:Darktile – GPU rendered terminal emulator designed for ti... by pama on Friday September 03, 2021 @01:33PM (#28407048)
Agreed. A malicious terminal could do all that and more. And it won’t have to edit your bashrc, though it certainly could.
Re:Darktile – GPU rendered terminal emulator designed for ti... by yjftsjthsd-h on Monday August 30, 2021 @01:46AM (#28353079)
Display something in terminal (curl, cat a download file, whatever will display untrusted content) -> control code (https://www.xfree86.org/4.8.0/ctlseqs.html) / escape code (https://en.m.wikipedia.org/wiki/ANSI_escape_code) -> bug (or worse, feature) -> arbitrary code execution
Re:Darktile – GPU rendered terminal emulator designed for ti... by vidarh on Monday August 30, 2021 @08:39AM (#28355018)
A terminal needs to be able to read what you type, and execute arbitrary programs as you.

If it is malicious, you're screwed. If it has bugs you might be screwed just viewing a malicious text file.