GNU bug report logs - #32772
chmod: use O_PATH to avoid TOCTOU bug

Previous Next

Package: coreutils;

Reported by: Jeff Epler <jepler <at> gmail.com>

Date: Wed, 19 Sep 2018 15:05:02 UTC

Severity: wishlist

Tags: patch

Merged with 11108, 18280

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 32772 <at> debbugs.gnu.org (full text, mbox):

From: Jeff Epler <jepler <at> gmail.com>
To: eggert <at> cs.ucla.edu
Cc: 32772 <at> debbugs.gnu.org
Subject: Re: bug#32772: TOCTOU bug in chmod
Date: Wed, 19 Sep 2018 19:47:57 -0500
[Message part 1 (text/plain, inline)]
Thanks for the correction, I should have not suggested a fix off the top of
my head.

On Wed, Sep 19, 2018 at 2:57 PM Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> Jeff Epler wrote:
> > Changing to lchmodat should resolve the problem
>
> No, that would just introduce the opposite bug: chmod is supposed to
> follow a
> symlink, and using lchmod would let an attacker provoke a race that would
> cause
> chmod to not follow a symlink that it should.
>
> A better way to fix this problem on GNU/Linux is to use O_PATH, not
> lchmod. I
> don't know of any way to fix it on other platforms that lack O_PATH.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 119 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.