Time of Check Time of Use (TOCTOU) Affecting chownr package, versions <1.1.0


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.04% (6th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDnpm:chownr:20180731
  • published31 Jul 2018
  • disclosed31 Jul 2018
  • creditJeff Epler

Introduced: 31 Jul 2018

CVE-2017-18869  (opens in a new tab)
CWE-264  (opens in a new tab)

How to fix?

Upgrade chownr to version 1.1.0 or higher.

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)

References

CVSS Scores

version 3.1