Skip to content

Conversation

@stoeckmann
Copy link
Contributor

Avoid fixed and thus predictable temporary file names. Especially avoid just opening already existing ones.

Proof of Concept:

  1. Create a FIFO named /etc/shadow.edit as root, which should be readable by normal users
mkfifo /etc/shadow.edit
  1. Wait for content of FIFO as regular user
cat /etc/shadow.edit
  1. Run vipw as root in another terminal
vipw -s

You can see the content of /etc/shadow as regular user.

Copy link
Collaborator

@alejandro-colomar alejandro-colomar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.

Reviewed-by: Alejandro Colomar <[email protected]>

@ikerexxe , @hallyn , Any comments?

@alejandro-colomar
Copy link
Collaborator

BTW, I guess I should backport this to the stable release 4.19.1.

Avoid fixed and thus predictable temporary file names. Especially avoid
just opening already existing ones.

Reviewed-by: Alejandro Colomar <[email protected]>
Signed-off-by: Tobias Stoeckmann <[email protected]>
@alejandro-colomar
Copy link
Collaborator

Since there have been no comments, I'll merge. I'll cherry-pick for the stable release 4.19.1. Thanks!

@alejandro-colomar alejandro-colomar merged commit a5b3d56 into shadow-maint:master Jan 9, 2026
12 checks passed
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Jan 9, 2026
Regression fixes:

-  chpasswd(8):
   -  Don't reject leading '!' in password hashes or a hash consisting
      of "*".  These were accidentally rejected in 4.19.0.
      See <shadow-maint#1483>
      and <shadow-maint#1486>.

Security bug fixes:

-  vipw(8):
   -  Avoid predictable names for temporary files.
      This allowed anyone to read the contents of /etc/shadow.
      See <shadow-maint#1485>.

Other changes:

   -  Set SIGCHLD before fork(2).  This prevents a possible race
      condition, although this is only for making the code more robust;
      we believe that the code was correct.

Signed-off-by: Alejandro Colomar <[email protected]>
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Jan 9, 2026
Regression fixes:

-  chpasswd(8):
   -  Don't reject leading '!' in password hashes or a hash consisting
      of "*".  These were accidentally rejected in 4.19.0.
      See <shadow-maint#1483>
      and <shadow-maint#1486>.

Security bug fixes:

-  vipw(8):
   -  Avoid predictable names for temporary files.
      This allowed anyone to read the contents of /etc/shadow.
      See <shadow-maint#1485>.

Other changes:

   -  Set SIGCHLD before fork(2).  This prevents a possible race
      condition, although this is only for making the code more robust;
      we believe that the code was correct.

Signed-off-by: Alejandro Colomar <[email protected]>
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Jan 9, 2026
Regression fixes:

-  chpasswd(8):
   -  Don't reject leading '!' in password hashes or a hash consisting
      of "*".  These were accidentally rejected in 4.19.0.
      See <shadow-maint#1483>
      and <shadow-maint#1486>.

Security bug fixes:

-  vipw(8):
   -  Avoid predictable names for temporary files.
      This allowed anyone to read the contents of /etc/shadow.
      See <shadow-maint#1485>.

Other changes:

-  vipw(8):
   -  Set SIGCHLD before fork(2).  This prevents a possible race
      condition, although this is only for making the code more robust;
      we believe that the code was correct.

Signed-off-by: Alejandro Colomar <[email protected]>
alejandro-colomar added a commit to alejandro-colomar/shadow that referenced this pull request Jan 9, 2026
Regression fixes:

-  chpasswd(8):
   -  Don't reject leading '!' in password hashes or a hash consisting
      of "*".  These were accidentally rejected in 4.19.0.
      See <shadow-maint#1483>
      and <shadow-maint#1486>.

Security bug fixes:

-  vipw(8):
   -  Avoid predictable names for temporary files.
      This allowed anyone to read the contents of /etc/shadow.
      See <shadow-maint#1485>.

Other changes:

-  vipw(8):
   -  Set SIGCHLD before fork(2).  This prevents a possible race
      condition, although this is only for making the code more robust;
      we believe that the code was correct.
      See <shadow-maint#1484>.

Closes: <shadow-maint#1487>
Signed-off-by: Alejandro Colomar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants