Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Security issue in Zsh restricted mode (zsh -r) – escape via history built‑ins



On Thu, Jan 29, 2026 at 3:16 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> Are you sure about your 'Summary'? Those
> commands look like bash commands, not zsh commands. To write and/or
> append history to a file in zsh you would use fc -W and fc -A

On a few quick tests, "fc -W" and "fc -A" will not do anything unless
SAVEHIST is set to a nonzero value.

SAVEHIST can't be changed from within the shell in restricted mode.

So, if no other common usage would be broken, this could be "fixed"
just by blocking inheritance of SAVEHIST from the environment (or
doing so only in restricted mode, which might be slightly but not a
lot more difficult).




Messages sorted by: Reverse Date, Date, Thread, Author