Summary
nfpm has incorrect default permissions
When building packages directly from source control, file permissions on the checked-in files are not maintained.
Details
When building packages directly from source control, file permissions on the checked-in files are not maintained. When nfpm packaged the files (without extra config for enforcing its own permissions) files could go out with bad permissions (chmod 666 or 777).
PoC
Create a default nfpm structure.
Within the test folder, create 3 files named chmod-XXX.sh. Each script has file
permissions set corresponding with their file names (chmod-777.sh = chmod 777). Below each
file and permissions can be seen.
$ ls -lart test
total 24
-rwxrwxrwx 1 user group 11 May 19 13:15 chmod-777.sh
-rw-rw-rw- 1 user group 11 May 19 13:16 chmod-666.sh
drwxr-xr-x 5 user group 160 May 19 13:19 .
-rw-rw-r-- 1 user group 11 May 19 13:19 chmod-664.sh
drwxr-xr-x 10 user group 320 May 19 13:29 ..
Below is the snippet nfpm configuration file of the contents of the package. The test folder
and files has no extra config for enforcing permissions.
contents:
- src: foo-binary
dst: /usr/bin/bar
- src: bar-config.conf
dst: /etc/foo-binary/bar-config.conf
type: config
- src: test
dst: /etc/test/scripts
The next step is to create a deb package.
$ nfpm package -p deb # Create dep package
using deb packager...
created package: foo_1.0.0_arm64.deb
When on a Ubuntu VM, install the foo package which was created
$ sudo dpkg -i foo_1.0.0_arm64.deb # Installing deb package within Ubuntu
Selecting previously unselected package foo.
(Reading database ... 67540 files and directories currently installed.)
Preparing to unpack foo_1.0.0_arm64.deb ...
Unpacking foo (1.0.0) ...
Setting up foo (1.0.0) ...
Looking at /etc/test/scripts and viewing the permissions. Permissions are passed exactly the same as the source.
$ ls -lart /etc/test/scripts
total 20
-rwxrwxrwx 1 root root 11 May 22 12:15 chmod-777.sh
-rw-rw-rw- 1 root root 11 May 22 12:16 chmod-666.sh
-rw-rw-r-- 1 root root 11 May 22 12:19 chmod-664.sh
drwxr-xr-x 3 root root 4096 May 22 13:00 ..
drwxr-xr-x 2 root root 4096 May 22 13:00 .
Impact
Vulnerability is https://cwe.mitre.org/data/definitions/276.html
https://www.first.org/cvss/calculator/3.0#CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Anyone using nfpm for creating packages and not checking/setting file permissions before packaging could result in bad permissions for files/folders.
CVE-2023-32698 has a CVSS score of 7.1 (High). The vector is requires local access, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.29.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
To prevent world-writable files from making it into the packages, add the ability to override the default permissions of packaged files using a umask config option in the packaging spec file. This feature in nfpm would allow applying a global umask across any files being packaged, therefore, with the correct configuration, preventing world-writable files without needing to list permissions on each and every file in the package
Frequently Asked Questions
- What is CVE-2023-32698? CVE-2023-32698 is a high-severity security vulnerability in github.com/goreleaser/nfpm/v2 (go), affecting versions >= 2.0.0, < 2.29.0. It is fixed in 2.29.0.
- How severe is CVE-2023-32698? CVE-2023-32698 has a CVSS score of 7.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which packages are affected by CVE-2023-32698?
github.com/goreleaser/nfpm/v2(go) (versions >= 2.0.0, < 2.29.0)github.com/goreleaser/nfpm(go) (versions >= 0.1.0, <= 1.10.3)
- Is there a fix for CVE-2023-32698? Yes. CVE-2023-32698 is fixed in 2.29.0. Upgrade to this version or later.
- Is CVE-2023-32698 exploitable, and should I be worried? Whether CVE-2023-32698 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2023-32698 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2023-32698? Upgrade
github.com/goreleaser/nfpm/v2to 2.29.0 or later.