oracle / oracle/ktls-utils

Privilege dropping

Open
#136 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
50
Forks
36
Avg merge
3d 22h
Merged PRs (30d)
2

Description

tlshd currently requires being executed as root: https://github.com/oracle/ktls-utils/blob/4d4045b9e34e83e66327cd0668013ab7bb78cd18/src/tlshd/config.c#L226

This is a lot of privilege, which OWASP describes as its second top risk: https://owasp.org/Top10/2025/A02_2025-Security_Misconfiguration/.

It'd be great if tlshd could run with fewer privileges.

Some ideas to reduce privilege:

  1. Allow running as a non-privileged user, and document that the process must have CAP_NET_ADMIN, which is sufficient for the privileged netlink operations.
  2. Hardening with namespaces/seccomp/landlock/etc.
    • The main goal being to limit CAP_NET_ADMIN, e.g. syscall filtering.
    • Implementation: systemd sandboxing. I have a working example.
    • systemd's RestrictAddressFamilies to AF_NETLINK prevent the process interfering with AF_INET or AF_UNIX.
    • SystemCallFilter to @system-service likely restricts some privileged syscalls.
  3. Run each TLS handshake as an unprivileged user, in a privileged parent/unprivileged child model, similar to http://www.citi.umich.edu/u/provos/ssh/privsep.html * The benefit is that an unprivileged process is the one doing the parsing of the untrusted packets.
    • This might involve tlshd_service_socket doing a setuid/setgid to an unprivileged user, and then passing the handshake params to the parent (via SCM_RIGHTS), and having the parent call tlshd_genl_put_handshake_parms (which I guess is the thing that actually needs privilege). O
    • This could be fiddly.

I think a sweet spot is (1) and (2).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/tlshd/config.c at the root check, then inspect tlshd_service_socket and tlshd_genl_put_handshake_parms to identify which operations require privilege. Review the proposed systemd sandboxing approach and capability requirements before choosing an implementation path. Done means an agreed privilege-reduction design is implemented, its required capabilities or restrictions are documented, and tlshd still performs TLS handshakes.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
operating-systems, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.