CVE-2021-32804 Arbitrary File Creation/Overwrite due to insufficient absolute path sanitization
Absolute path sanitization이 불충분하여 임의의 파일 생성/복사
설명
The npm package "tar" (aka node-tar) before versions 6.1.1, 5.0.6, 4.4.14, and 3.3.2 has a arbitrary File Creation/Overwrite vulnerability due to insufficient absolute path sanitization. node-tar aims to prevent extraction of absolute file paths by turning absolute paths into relative paths when the `preservePaths` flag is not set to `true`. This is achieved by stripping the absolute path root from any absolute file paths contained in a tar file. For example `/home/user/.bashrc` would turn into `home/user/.bashrc`. This logic was insufficient when file paths contained repeated path roots such as `////home/user/.bashrc`. `node-tar` would only strip a single path root from such paths. When given an absolute file path with repeating path roots, the resulting path (e.g. `///home/user/.bashrc`) would still resolve to an absolute path, thus allowing arbitrary file creation and overwrite. This issue was addressed in releases 3.2.2, 4.4.14, 5.0.6 and 6.1.1. Users may work around this vulnerability without upgrading by creating a custom `onentry` method which sanitizes the `entry.path` or a `filter` method which removes entries with absolute paths. See referenced GitHub Advisory for details. Be aware of CVE-2021-32803 which fixes a similar bug in later versions of tar.
버전 6.1.1, 5.0.6, 4.4.14, 3.3.2 이전의 npm 패키지 "tar" (일명 node-tar) 는 절대 경로의 살균이 불충분하여 임의의 파일 생성/복사 취약점을 가지고 있습니다. node-tar 는 `preservePaths` 플래그가 `true`로 설정되지 않았을 때 절대 경로의 추출을 방지하고자 합니다. 이것은 타르 파일에 포함 된 절대 파일 경로에서 절대 경로 루트를 제거하여 달성됩니다. 예를 들어 `/home/user/.bashrc`는 `home/user/.bashrc`로 바뀔 것이다. 이 논리는 `////home/user/.bashrc'와 같은 반복된 경로 루트를 포함하는 파일 경로가 불충분하다. `node-tar`는 그러한 경로로부터 하나의 경로 루트만 제거한다. 반복 경로 루트를 가진 절대 파일 경로가 주어지면, 결과 경로(예: `///home/user/.bashrc')는 여전히 절대 경로로 결정될 것이고, 따라서 임의의 파일 생성과 덮어쓰기를 허용할 것이다. 이 문제는 릴리스 3.2.2, 4.4.14, 5.0.6 및 6.1.1에서 해결되었습니다. 사용자는 절대 경로로 항목을 제거하는 `entry.path` 또는 `filter` 메서드를 초기화하는 사용자 지정 `onentry` 메서드를 생성하여 업그레이드하지 않고 이 취약점을 해결할 수 있습니다. 자세한 내용은 참조된 GitHub Advisory 를 참조하십시오. 이후 버전의 타르에서 비슷한 버그를 수정한 CVE-2021-32803에 주의하십시오.
영향 받는 제품 제품 1개
-
해결 버전 있음
npm
node-tar
영향 받는 버전
- 3.2.2 미만
- 4.0.0 이상 4.4.14 미만
- 5.0.0 이상 5.0.6 미만
- 6.0.0 이상 6.1.1 미만
해결 버전
- 3.2.2 이상
- 4.4.14 이상
- 5.0.6 이상
- 6.1.1 이상
참고 자료 6건
- cert-portal.siemens.com https://cert-portal.siemens.com/productcert/pdf/ssa-389290.pdf (새 창)
- github.com https://github.com/npm/node-tar/commit/1f036ca23f64a547bdd6c79c1a44bc62e8115da4 (새 창)
- github.com https://github.com/npm/node-tar/security/advisories/GHSA-3jfq-g458-7qm9 (새 창)
- npmjs.com https://www.npmjs.com/advisories/1770 (새 창)
- npmjs.com https://www.npmjs.com/package/tar (새 창)
- oracle.com https://www.oracle.com/security-alerts/cpuoct2021.html (새 창)