Time of Check Time of Use (TOCTOU)

Affecting chownr package, versions <1.1.0

Do your applications use this vulnerable package? Test your applications

Overview

chownr is a package that takes the same arguments as fs.chown()

Affected versions of this package are vulnerable to Time of Check Time of Use (TOCTOU). Affected versions of this package are vulnerable toTime of Check Time of Use (TOCTOU) attacks.

It does not dereference symbolic links and changes the owner of the link, which can trick it into descending into unintended trees if a non-symlink is replaced by a symlink at a critical moment:

      fs.lstat(pathChild, function(er, stats) {
        if (er)
          return cb(er)
        if (!stats.isSymbolicLink())
          chownr(pathChild, uid, gid, then)

Remediation

Upgrade chownr to version 1.1.0 or higher.

References

CVSS Score

4.4
medium severity
  • Attack Vector
    Local
  • Attack Complexity
    Low
  • Privileges Required
    None
  • User Interaction
    Required
  • Scope
    Unchanged
  • Confidentiality
    None
  • Integrity
    Low
  • Availability
    Low
CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:L
Credit
Jeff Epler
CWE
CWE-264
Snyk ID
npm:chownr:20180731
Disclosed
31 Jul, 2018
Published
31 Jul, 2018