Skip to content

Suggest and use less -U when showing script for review#22

Merged
lykhvar merged 1 commit intovet-run:mainfrom
dgl:less-u
Jul 25, 2025
Merged

Suggest and use less -U when showing script for review#22
lykhvar merged 1 commit intovet-run:mainfrom
dgl:less-u

Conversation

@dgl
Copy link
Contributor

@dgl dgl commented Jul 25, 2025

Without -U it is possible to use characters like backspace (^H) to hide the real script.

For example:

$ printf '#!/bin/sh\necho i am evil #\b\b\b\b\b\b\b\b\b\b\bhello world\n' > evil.sh
$ less evil.sh
[shows "hello world"]
$ sh evil.sh
i am evil

(I've previously covered some of this in research like https://dgl.cx/term. There's no security reporting instructions in the repo, so I'm reporting publicly with a fix, as this doesn't seem critical.)

Without -U it is possible to use characters like backspace (^H) to hide
the real script.
@dgl
Copy link
Contributor Author

dgl commented Jul 25, 2025

Note I've just used less -U here, it would be nice to expand tabs, but that would require version detection for less or something, see gwsw/less#335.

@dgl
Copy link
Contributor Author

dgl commented Jul 25, 2025

See also https://news.ycombinator.com/item?id=44671221 and https://github.com/jwilk/unfaithful-less for a more elaborate demo of confusing less.

@lykhvar
Copy link
Contributor

lykhvar commented Jul 25, 2025

Thanks for your contribution — the fix is spot-on. I'm merging this right away.

Regarding tab expansion, I've opened issue #26 to track your suggestion — we can continue the discussion there.

@lykhvar lykhvar merged commit c7d94b4 into vet-run:main Jul 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants