Skip to main content

SKY-D335 · Deployment and infrastructure

Root edge systemd service without basic sandboxing

Medium

An edge or device systemd service that runs as root without three common systemd safety settings: NoNewPrivileges=true, ProtectSystem=full or strict, and PrivateTmp=true. Each one takes a power away from the process that it almost never needs.

Languages
systemd units
Quality gate
counted toward the gate limits (full and diff scans). Reported under security (danger) at MEDIUM. It counts toward max_security.
Finding type
review
Catalog name
Systemd edge service missing sandboxing
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Without them, a compromised root daemon can rewrite system binaries and configuration, gain new privileges through setuid programs, and read or plant files in the shared /tmp. With them, the same bug does much less damage.

What Skylos flags

object-detector.service · INIReported on line 7
[Unit]Description=Jetson object detectorAfter=nvargus-daemon.service [Service]User=rootExecStart=/opt/detector/bin/detector --engine /opt/detector/model.engineRestart=always [Install]WantedBy=multi-user.target

What Skylos leaves alone

object-detector.service · INI
[Unit]Description=Jetson object detectorAfter=nvargus-daemon.service [Service]User=detectorSupplementaryGroups=videoExecStart=/opt/detector/bin/detector --engine /opt/detector/model.engineRestart=always [Install]WantedBy=multi-user.target

Why Skylos leaves it alone

The same service without the three settings, but running as its own user. The rule only checks services that run as root, so it stays quiet.

How Skylos decides

  1. Runs with --danger. Reads the same *.service files 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).
  2. Needs the service to run as root: no User= in [Service], or the last User= is empty, 0 or root.
  3. Checks the last value of each setting in [Service]: NoNewPrivileges and PrivateTmp must be 1, true, yes or on; ProtectSystem must be full or strict (yes does not count).
  4. Reports MEDIUM on the ExecStart= line (line 1 when there is none), naming the settings that are missing.

How to fix it

When the service must stay root, add the three settings. Running it as its own user, as in the not-flagged example, clears this rule and SKY-D333 together.

object-detector.service · INI · the fix, against the flagged file
[Unit]Description=Jetson object detectorAfter=nvargus-daemon.service [Service]User=rootExecStart=/opt/detector/bin/detector --engine /opt/detector/model.engineRestart=alwaysAdded: NoNewPrivileges=trueAdded: ProtectSystem=strictAdded: PrivateTmp=true [Install]WantedBy=multi-user.target

When it can be wrong

  • ProtectSystem=yes is reported as missing: it only protects /usr and /boot, and the rule asks for full or strict.
  • Settings added in a drop-in file (object-detector.service.d/*.conf) are not read; only *.service files are scanned.
  • Stronger settings that make these three redundant, such as a RootDirectory= jail, are not recognised.
  • DynamicUser=yes without User= counts as root, and any unit that mentions /dev/ counts as a device service, as for SKY-D333.

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 ExecStart=. systemd reads # only at the start of a line.

    INI
    # skylos: ignore[SKY-D335] sandboxed by the vendor drop-inExecStart=/opt/detector/bin/detector --engine /opt/detector/model.engine
  • [tool.skylos] ignore = ["SKY-D335"] turns the rule off for the project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.