Re:Tinystatus: A tiny status page generated by a Python script
by trulyrandom on Thursday September 05, 2024 @11:43AM
(#41457661)
On Linux, "net.ipv4.ping_group_range" is typically used to allow unprivileged users to do ICMP echo requests. Setting the setuid bit or granting a capability are both very old ways of doing this.
Re:Tinystatus: A tiny status page generated by a Python script
by runjake on Thursday September 05, 2024 @12:12PM
(#41457992)
This is new to me.
So, here's what I see on Ubuntu 24.04 LTS:
$ sudo sysctl -a | grep net.ipv4.ping
net.ipv4.ping_group_range = 1 0
The man page[1] states: ping_group_range (two integers; default: see below; since Linux 2.6.39)
Range of the group IDs (minimum and maximum group IDs,
inclusive) that are allowed to create ICMP Echo sockets.
>>The default is "1 0", which means no group is allowed to
create ICMP Echo sockets.<<
This would seem to indicate this isn't being used -- at least on Ubuntu? What am I missing?
Re:Tinystatus: A tiny status page generated by a Python script
by gertlex on Thursday September 05, 2024 @11:28AM
(#41457528)
Further, I'm not sure you can do command injection, as the the `host` variable is treated as a single token in the shell call. `host = "google.com; wget exploit"` won't run `wget exploit`.
Happy to learn if there's a more nefarious trick that gets around this, though.
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.
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.