Page MenuHomeFreeBSD

netstat: strip the binary of sgid
AcceptedPublic

Authored by kevans on Oct 21 2024, 4:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 9, 2:47 AM
Unknown Object (File)
Nov 26 2024, 6:35 AM
Unknown Object (File)
Nov 24 2024, 1:21 PM
Unknown Object (File)
Nov 18 2024, 9:41 PM
Unknown Object (File)
Nov 16 2024, 12:55 AM
Unknown Object (File)
Nov 7 2024, 8:54 AM
Unknown Object (File)
Oct 28 2024, 7:42 PM
Unknown Object (File)
Oct 28 2024, 4:22 AM
Subscribers

Details

Reviewers
glebius
markj
Group Reviewers
network
Summary

Everything in the live path seems to use sysctls these days, with kvm
only being used for pulling information from core dumps. Strip the
binary of /dev/{k,}mem access to reduce the surface area with access
to kmem.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60143
Build 57027: arc lint + arc unit

Event Timeline

There are some calls setgid(getgid()) in netstat which aim to drop privileges. I guess those should be removed too?

Drop setgid(2) calls meant to drop privileges, now that we don't have privs

There are some calls setgid(getgid()) in netstat which aim to drop privileges. I guess those should be removed too?

I also found one other call to kresolve_list() that I thought could go away, but it turns out that we actually still need /dev/mem for netstat -rs. Shelving this for the time being, but reimplementing rt_stats() for the live case doesn't seem like it'd be too difficult.

This revision is now accepted and ready to land.Oct 22 2024, 5:06 PM

I intend to commit this on the 21st if nobody objects -- the one month anniversary to netstat(1) switching to sysctl for routing stats.