SECURITY 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Security concerns
  2. -----------------
  3. Trust and assumptions
  4. ---------------------
  5. Dinit does assume that most input it receives is trusted and not produced maliciously. This
  6. includes:
  7. - service descriptions, including service names
  8. - "environment" file
  9. - commands received via the control socket
  10. Since it is trusted, Dinit will do no or minimal validation/sanitisation on these. Tools which
  11. allow creation or modification of these inputs should do so with care. (The control socket is
  12. treated with a little more care, in an attempt to guard against buggy or partially compromised
  13. clients, but untrusted applications/users should *not* be granted access to the socket).
  14. Dinit when run as system manager (naturally) also trusts and relies on the general integrity of
  15. the system on which it runs. It cannot defend against a fully compromised system and does not
  16. attempt to do so. It does *not* trust or rely on aspects of the system that are (or should not
  17. be) controlled by non-administrative users. In other words, Dinit should be secure but does not
  18. by itself aim to provide *additional system* security (except by having features to run services
  19. more securely).
  20. Dinit does not expect user identities to change during operation. If a service is configured to
  21. run as user xyz, the numeric ID of user xyz may be determined when the service is loaded rather
  22. than when the service is started. If the same ID is re-assigned to a different user, Dinit might
  23. run the service as that other user, create logfiles owned by that other user, etc.
  24. Specific concerns and details
  25. -----------------------------
  26. Dinit is designed to allow control by one system user. In the case of a system instance, this is
  27. the root user. Of course, the unix model allows users to change identity and so regular users can
  28. control a system dinit instance using sudo or su, for example.
  29. Essential security is enforced by the system, not by Dinit itself. The socket used to control
  30. dinit is owned by a particular user (the user who starts dinit) and the permissions on this socket
  31. are set so that only the owning user can connect to the socket. According to the Linux unix(7)
  32. manual page, "older" BSDs do not honour socket permissions; on such systems, presumably the
  33. permissions on the containing directory at least are checked (so it is necessary to place the
  34. socket in a directory that is inaccessible to non-root users to ensure secure operation). This
  35. does not appear to be a concern for the various current *BSD systems that I have looked at.
  36. In general it should be assumed that a process that is able to open the control socket (or
  37. otherwise obtain an open connection to the socket) will be able to execute arbitrary code as root
  38. (or rather, as the user which dinit is running as). That said, errors or missing checks in the
  39. control protocol handling which could cause unspecified or undefined behaviour are considered a
  40. security concern (since they potentially allow minor flaws in clients to become arbitrary code
  41. execution within the dinit daemon).
  42. Dinit service descriptions may specify output files (sockets, logfiles) and these are opened
  43. without (or with minimal) checks. A malicious user in control of a service description could cause
  44. arbitrary system files to be overwritten.
  45. Reporting security issues
  46. -------------------------
  47. Bearing the above in mind, any security issues in Dinit should be reported via email to:
  48. davmac@davmac.org
  49. I will endeavour to respond promptly, but please allow a reasonable time frame before wider
  50. disclosure.