dmitri has asked for the wisdom of the Perl Monks concerning the following question:

Hello Fellow Monks!

By now, I am sure you have heard of the "732 bytes of Python code to root every major Linux distro."

(I checked it out -- it works. Don't run it on your own machine, though, as it will mangle your `su` binary).

At any rate -- I figured, we can make it smaller in Perl!

A half hour and a bunch of tokens later, I failed. My smallest version is 767 bytes. Can anyone here do better?

  • Comment on copyfail challenge: making Perl version smaller

Replies are listed 'Best First'.
Re: copyfail challenge: making Perl version smaller
by marto (Cardinal) on Apr 30, 2026 at 09:26 UTC
Re: copyfail challenge: making Perl version smaller
by Corion (Patriarch) on Apr 30, 2026 at 09:22 UTC

    My guess would be that you would get better responses if you actually posted your attempt. People familiar with the usual golfing approaches can then spot locations where you can improve the golfing.

    The actual value of golfing an exploit is very low, but I guess the PR value of having a "really low number of bytes" in the headline is high.

      > but I guess the PR value of having a "really low number of bytes" in the headline is high.

      I'm not sure about that PR value.

      The most likely way for outside attackers is to hide the exploit inside some "harmless" script/module.

      The message now is that all Python code is potentially dangerous, do we want to push to be in the same spotlight?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

        "The message now is that all Python code is potentially dangerous, do we want to push to be in the same spotlight?"

        I don't think that's the message at all. Don't blindly trust any code you don't understand or aren't as far as is reasonably practicable satisfied with the chain of trust? Don't curl things and pipe it to stuff without know what it's going to do first?

Re: copyfail challenge: making Perl version smaller
by stevieb (Canon) on Apr 30, 2026 at 09:05 UTC
    At any rate -- I figured, we can make it smaller in Perl! A half hour and a bunch of tokens later, I failed.

    You're using pronouns like some "AI" deserves one. AI is not intelligent, and tokens don't denote thought, and "we" don't include me if AI is brought in to pretend to be something that thinks for you logically.

    What a fucking disgrace if this is what golf has come to.

    -stevieb

Re: copyfail challenge: making Perl version smaller
by LanX (Saint) on Apr 30, 2026 at 16:10 UTC
    > Don't run it on your own machine, though, as it will mangle your `su` binary

    The project's site says the effect is gone after rebooting.

    And even if there was a lasting effect, what about booting Linux from a stick on an old box for testing?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery