SKY-D336 · Deployment and infrastructure
Edge systemd service with broad capabilities or devices
An edge or device systemd service that grants powerful Linux capabilities such as CAP_SYS_ADMIN, allows every device with a DeviceAllow= wildcard, or starts a docker run --privileged container. These settings give a non-root process most of root's power.
- Languages
- systemd units
- Quality gate
- counted toward the gate limits (full and diff scans). Reported under security (
danger). It counts towardmax_highandmax_security; the detector never reports CRITICAL. - Finding type
- review
- Catalog name
- Systemd broad edge service privilege
Why it matters
CAP_SYS_ADMIN alone lets a process mount filesystems, change namespaces and often escape to full root. A camera daemon rarely needs it, so a bug in that daemon becomes a takeover of the device.
What Skylos flags
[Unit]Description=Camera capture [Service]User=cameraExecStart=/opt/capture/bin/capture --device /dev/video0AmbientCapabilities=CAP_SYS_ADMINDeviceAllow=/dev/video0 rwNoNewPrivileges=trueWhat Skylos leaves alone
[Unit]Description=Camera capture [Service]User=cameraExecStart=/opt/capture/bin/capture --device /dev/video0CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_MODULEDeviceAllow=/dev/video0 rwNoNewPrivileges=trueWhy Skylos leaves it alone
CAP_SYS_ADMIN still appears, but after a leading ~, which tells systemd to remove these capabilities from the service. That is a hardening setting, not a grant.
How Skylos decides
- Runs with
--danger. Reads the same*.servicefiles as SKY-D333 and needs the same[Service]section and edge context (a device, camera, GPU or robot word, or a/dev/path, somewhere in the unit). Unlike SKY-D333 to SKY-D335, it does not need the service to run as root. - Reports
AmbientCapabilities=orCapabilityBoundingSet=namingCAP_SYS_ADMIN,CAP_NET_ADMIN,CAP_SYS_MODULE,CAP_SYS_PTRACE,CAP_SYS_RAWIOorCAP_DAC_OVERRIDE. A bounding set that starts with~is skipped. - Reports
DeviceAllow=set to*,/dev/*,char-*orblock-*(or starting with one of those). - Reports an
Exec…=line that runsdocker runwith--privileged. - Reports HIGH once per unit: on the first matching capability or
DeviceAllow=line, or, when there is none, on thedocker runline.
How to fix it
Grant only the capability the program really uses (here real-time scheduling) and keep DeviceAllow= to the one device.
[Unit]Description=Camera capture [Service]User=cameraExecStart=/opt/capture/bin/capture --device /dev/video0Removed: AmbientCapabilities=CAP_SYS_ADMINAdded: AmbientCapabilities=CAP_SYS_NICEDeviceAllow=/dev/video0 rwNoNewPrivileges=trueWhen it can be wrong
- A
CapabilityBoundingSet=that lists only the dangerous capability the service needs is reported even though it narrows the set. - Other broad grants, such as
CAP_SYS_BOOT,CAP_BPForPrivateDevices=no, are not on the list and are not reported. - Units without a device context are never checked.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
Put the marker on a comment line directly above the reported line. systemd reads
#only at the start of a line.INI # skylos: ignore[SKY-D336] vendor SDK mounts a debugfs nodeAmbientCapabilities=CAP_SYS_ADMIN[tool.skylos] ignore = ["SKY-D336"]turns the rule off for the project.