Anyone else having similar experience? This is the first time something like that happened in a decade of using the latest stable kernel release (in my experience, it's actually been stable for all that time except for 6.10).
Depending on the OS, ping is either set setuid[1] as root, or more commonly these days, ping is granted a "capability"[2], such as CAP_NET_RAW on Linux. macOS does things a little different[3].
This allows non-root users to run stuff like ping without granting them full root access. You do not need to, nor should you, run the script as root.
% ls -l /usr/bin/ping
-rwxr-xr-x 1 root root 89768 Apr 8 09:00 /usr/bin/ping
% getcap /usr/bin/ping
/usr/bin/ping cap_net_raw=ep
~
% whoami
jake
~
% id
uid=1000(jake) gid=1000(jake) groups=1000(jake),4(adm),24(cdrom)
% ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=117 time=9.195 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=8.837 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=10.998 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 8.837/9.677/10.998/0.946 ms
Hope that helps. Happy to elaborate on any unclear points.1. https://unix.stackexchange.com/questions/382771/why-does-pin...
2. https://unix.stackexchange.com/questions/592911/how-does-pin...
3. https://apple.stackexchange.com/questions/312857/how-does-ma...
Edit: updated explanation a bit.
This attack can be stopped by disallowing any binary testdata or other non-source code to be on the build machines during a build.
You could imagine a simple process which checks out the code, then runs some kind of entropy checker over the code to check it is all unminified and uncompressed source code, before finally kicking off the build process.
autogenerated files would also not be allowed to be in the source repo - they're too long and could easily hide bad stuff. Instead the build process should generate the file during the build.