CVE-2021-3907: Directory Traversal in manifest path extraction in github.com/cloudflare/cfrpki
Summary
CVE-2021-3907: Directory traversal in manifest path extraction in github.com/cloudflare/cfrpki. Affects github.com/cloudflare/cfrpki versions < 1.4.3. Fixed in 1.4.3. How to fix ↓
Also tracked for
- cfrpki · Debian:11
The same CVE-2021-3907 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The package under scrutiny is github.com/cloudflare/cfrpki, which is written in Go. It is a library that provides functionality for managing and validating PKI (Public Key Infrastructure) resources. The package includes the ExtractPathManifest function, which is responsible for extracting the path of a manifest file. However, this function is vulnerable to directory traversal attacks, allowing an attacker to reference arbitrary locations on the filesystem by including relative directory components ("..") in the file path.
Vulnerability Detail
The vulnerability in github.com/cloudflare/cfrpki's ExtractPathManifest function allows an attacker to traverse directories and access files outside the intended scope. By including relative directory components in the file path, an attacker can bypass file path restrictions and potentially access sensitive files on the filesystem. This could lead to unauthorized access, information disclosure, or even remote code execution depending on the specific circumstances. The vulnerability has been assigned the CVE identifier CVE-2021-3907.
How To Fix
Latest published version: v1.5.10 as of 23 Oct 2026
go get github.com/cloudflare/cfrpki@v1.5.10
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.4.3
This is the first release that contains the fix.
go get github.com/cloudflare/cfrpki@v1.4.3
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating the package is not immediately feasible, a temporary workaround can be implemented by manually validating and sanitizing file paths before passing them to the ExtractPathManifest function. This can be done by checking for any relative directory components ("..") in the file path and rejecting or modifying the path accordingly. Here is an example of how this can be done in Go:
import (
"github.com/cloudflare/cfrpki/validator/pki"
"path/filepath"
)
func SanitizeFilePath(filePath string) (string, error) {
absPath, err := filepath.Abs(filePath)
if err != nil {
return "", err
}
if filepath.Clean(absPath) != absPath {
return "", fmt.Errorf("Invalid file path")
}
return absPath, nil
}
Conclusion
In conclusion, the github.com/cloudflare/cfrpki package is vulnerable to a directory traversal attack in its ExtractPathManifest function. This vulnerability allows an attacker to access arbitrary files on the filesystem. To fix this vulnerability, it is recommended to update the package to version 1.4.3 or later. If immediate update is not possible, a temporary workaround can be implemented by manually validating and sanitizing file paths. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for github.com/cloudflare/cfrpki →
FAQ
The vulnerability allows an attacker to access arbitrary files on the filesystem, potentially leading to unauthorized access, information disclosure, or remote code execution.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your Gopkg.lock file and the playground will analyze it for open-source vulnerabilities, including this one.
Yes, updating the github.com/cloudflare/cfrpki package to version 1.4.3 or later will fix this vulnerability. It is recommended to always use the latest version of the package to ensure you have the latest security patches.
Yes, a temporary workaround is to manually validate and sanitize file paths before passing them to the ExtractPathManifest function. This can be done by checking for relative directory components ("..") in the file path and rejecting or modifying the path accordingly.
This vulnerability was discovered by Koen van Hove.
References
Related vulnerabilities
Recent vulnerabilities recorded for github.com/cloudflare/cfrpki.