I already mentioned this in another comment, but everyone should enable bracket paste mode in their shell to defend against this.
echo "hello"
echo "lol" ; sudo sl -rf /
(In case it's not obvious, the # trick will not help you.)Pray for no escape, bang, or control sequences.
(Alternatively: "r! cat <paste> <ctrl>-D" will read into a vim session.)
Examine the output, trim the unwanted / dangerous bits, and run (or save to a file/script).
Since I run what are ... generously ... considered "bash one-liners" all the time, that key sequence is locked into my muscle memory. It's a convenient way to invoke an editor immediately and run code from it.
Alternatively, call a utility that can read the clipboard directly. For Xorg:
:r! xsel -b
For Wayland: :r! wl-pasteI do this frequently on Android via Termux, ssh'ing to remote hosts.