So I set my password to

sudo rm -rf --no-preserve-root /
  • allywilson@lemmy.ml
    link
    fedilink
    arrow-up
    7
    ·
    3 hours ago

    I wonder if base64’ing something like this makes it safe for input, but dangerous for some backends?

    c3VkbyBybSAtcmYgLS1uby1wcmVzZXJ2ZS1yb290IC8=

    • Godort@lemmy.ca
      link
      fedilink
      arrow-up
      6
      ·
      2 hours ago

      It would have to be a really strange situation where the backend would be decoding and then running just the password field as a bash command. Very likely not to be the case.

      To make it more likely to work, you want to take a page from SQL injection and make sure you include something at the start of the command to terminate whatever was there first and end with a comment character to ignore anything after.

      In addition you probably want to drop the ‘sudo’ in this case, as it’s far more likely that whatever is running this would be running as root rather than a user account with sudo with password disabled.

      You’d want something more like

      && rm -rf --no-preserve-root / #

      JiYgcm0gLXJmIC0tbm8tcHJlc2VydmUtcm9vdCAvICM