uutils / uutils/shadow

hardening: sanitize the process's own environment, not only children's

Open
#314 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
15
Forks
8
Avg merge
4h 15m
Merged PRs (30d)
80

Description

harden_process() clears core dumps, raises the file-size limit and applies Landlock, but leaves the process's own environment as the caller set it. In-process PAM and NSS modules therefore run with the caller's LD_*-free but otherwise arbitrary variables (PAM_*, locale, TZ, anything a module reads). Children get a clean environment where they are spawned; the tool itself does not.

docs/SECURITY-HARDENING.md lists this under Not yet implemented and pointed at #249, which was closed on 2026-09-04 without doing it.

What it would take: at the top of harden_process(), replace the environment with the sanitized set sanitized_env() already computes (PATH to a fixed value, TERM, LANG/LC_* kept), the way sudo-rs does, and drop the caller's copy. Setuid tools already ignore LD_* through the loader, so the visible change is confined to what PAM and NSS modules see. Needs a decision on which variables PAM conversations legitimately need (LANG for messages at least), and a test in the deployment suite that a variable set by the caller is not visible to a PAM module.

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 harden_process() and sanitized_env(), then read docs/SECURITY-HARDENING.md and the sudo-rs approach referenced by the issue. Resolve which variables PAM conversations require, apply the existing sanitized set to the process environment, and add the deployment-suite test showing caller variables are not visible to a PAM module.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
authentication, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.