Live data from Hacker News

Abusing url handling in iTerm2 and Hyper for code execution

vin01.github.io

11–20 of 58 posts

Re: Abusing url handling in iTerm2 and Hyper for code execution

#11
post #3

> Any links using those schemes when clicked, would open the MacOS terminal to perform the corresponding action. I'm unclear which of these are being described: 1: when printed and clicked, they may be handled by the terminal, and the terminal's handling allows more behaviors than it should, allowing code execution 2: when printed, these urls are automatically executed by the shell, allowing code execution Neither ar…

It is the first one, they need to be printed and clicked.

Re: Abusing url handling in iTerm2 and Hyper for code execution

#12
post #5

Earlier quoted context omitted.

It sure is a good thing we never run anything in our terminals without fully vetting all output. curl -s -L https://raw.githubusercontent.com/Groxx/rickrollrc/master/roll.sh | bash

I can't believe curl | sh is still the recommended way to install oh-my-zsh

Getting it out of a repository wouldn't make any more vetting appear as if by magic.

And if you're facing an attacker sophisticated enough to send different contents to a browser and to curl, then you're probably not going to find their backdoor in the first place. And it would be stupid of them to depend on that trick, so this becomes an extremely niche case not worth worrying about.

And multiply that sophistication by a hundred times because this is on github servers.

The "what if the file is truncated" issue is the only realistic one, and competent installers like this one define functions and don't run them until the last line.

Re: Abusing url handling in iTerm2 and Hyper for code execution

#13
post #3

> Any links using those schemes when clicked, would open the MacOS terminal to perform the corresponding action. I'm unclear which of these are being described: 1: when printed and clicked, they may be handled by the terminal, and the terminal's handling allows more behaviors than it should, allowing code execution 2: when printed, these urls are automatically executed by the shell, allowing code execution Neither ar…

Think you can see the full url one mouse over in some terminals (and rebind what clicks do to disable opening)

Re: Abusing url handling in iTerm2 and Hyper for code execution

#14

Earlier quoted context omitted.

I can't believe curl | sh is still the recommended way to install oh-my-zsh

Getting it out of a repository wouldn't make any more vetting appear as if by magic. And if you're facing an attacker sophisticated enough to send different contents to a browser and to curl, then you're probably not going to find their backdoor in the first place. And it would be stupid of them to depend on that trick, so this becomes an extremely niche case not worth worrying about. And multiply that sophistication…

> sophisticated enough to send different contents to a browser and to curl

Checking the Accept header (or User-Agent or a bunch of other things) is very difficult :)

Re: Abusing url handling in iTerm2 and Hyper for code execution

#16
At the very end of the article,

> Upgrade to iTerm2 3.5.0

I had just gotten the upgrade notification for 3.5.0 a few minutes ago. I scrolled through the release notes a bit and got to the "AI" section and I would like very much to get off this ride. I am grumpy and a terminal should be a terminal.

Features of iTerm2 I don't use and don't think belong in a terminal emulator:

  - tmux integration
  - shell integration
  - ssh integration
  - password manager integration
  - hooks
  - syntax highlighting *that's baked into the terminal*
  - installing its own python runtimes (?!)
  - ~blindly~ opening URLs when rendering a certain escape sequence [0]
[0] https://gitlab.com/gnachman/iterm2/-/issues/10994 the discussion in there makes it seem like it's okay because many schemes that aren't http[s] cause the browser to open a dialog box

Features of iTerm2 I use:

  - fullscreen without using MacOS's spaces implementation of fullscreen

.... This got away from me and went from grumpy muttering to a snarky rant. I like iTerm2, it's just starting to feel like somebody else's terminal, that's all.

Edit: tried to cross out "blindly" above, it does ask you whether you want to open the URL, though it offers to always allow it for that host which seems like it might be iffy, but at least if I never click "always allow", I'll be notified if anything tries to inject this OSC sequence.

Re: Abusing url handling in iTerm2 and Hyper for code execution

#17

At the very end of the article, > Upgrade to iTerm2 3.5.0 I had just gotten the upgrade notification for 3.5.0 a few minutes ago. I scrolled through the release notes a bit and got to the "AI" section and I would like very much to get off this ride. I am grumpy and a terminal should be a terminal. Features of iTerm2 I don't use and don't think belong in a terminal emulator: - tmux integration - shell integration - ss…

Give wezterm a try: https://wezfurlong.org/wezterm/index.html

It is cross OS (learn once and use the same terminal in Windows, macOS and Linux), actively developed and written in rust

Re: Abusing url handling in iTerm2 and Hyper for code execution

#18

At the very end of the article, > Upgrade to iTerm2 3.5.0 I had just gotten the upgrade notification for 3.5.0 a few minutes ago. I scrolled through the release notes a bit and got to the "AI" section and I would like very much to get off this ride. I am grumpy and a terminal should be a terminal. Features of iTerm2 I don't use and don't think belong in a terminal emulator: - tmux integration - shell integration - ss…

Give wezterm a try: https://wezfurlong.org/wezterm/index.html It is cross OS (learn once and use the same terminal in Windows, macOS and Linux), actively developed and written in rust

While it is nice to have options, I still think iTerm2 is one of the best terminal emulators for OS X out there. It has also most likely been audited more thoroughly than newer options out there. There was a security audit sponsored by Mozilla in 2019 [1].

1. https://blog.mozilla.org/security/2019/10/09/iterm2-critical...

Re: Abusing url handling in iTerm2 and Hyper for code execution

#19

At the very end of the article, > Upgrade to iTerm2 3.5.0 I had just gotten the upgrade notification for 3.5.0 a few minutes ago. I scrolled through the release notes a bit and got to the "AI" section and I would like very much to get off this ride. I am grumpy and a terminal should be a terminal. Features of iTerm2 I don't use and don't think belong in a terminal emulator: - tmux integration - shell integration - ss…

Honestly I never understood the need to replace macOS Terminal. I'm heavy terminal user, that's my most used application by far. But macOS Terminal is absolutely fine for my needs and I never felt the need for any additional features.

Re: Abusing url handling in iTerm2 and Hyper for code execution

#20

Earlier quoted context omitted.

Getting it out of a repository wouldn't make any more vetting appear as if by magic. And if you're facing an attacker sophisticated enough to send different contents to a browser and to curl, then you're probably not going to find their backdoor in the first place. And it would be stupid of them to depend on that trick, so this becomes an extremely niche case not worth worrying about. And multiply that sophistication…

> sophisticated enough to send different contents to a browser and to curl Checking the Accept header (or User-Agent or a bunch of other things) is very difficult :)

GP likely meant differentiating `curl` and `curl | bash`.

https://web.archive.org/web/20240520142212/https://www.idont...

Post reply on HN