CVE-2020-7668: Path Traversal in github.com/unknwon/cae

github.com/unknwon/cae Updated 02 Oct 2025

Summary

14/04/2021
Yes i
High
7.5

CVE-2020-7668: Path Traversal in github.com/unknwon/cae. Affects github.com/unknwon/cae versions < 1.0.1. Fixed in 1.0.1. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The package github.com/unknwon/cae is a Go package that provides functionality for working with archives, including tz and zip formats. It offers methods for creating, opening, extracting, and manipulating files within these archives. However, a vulnerability has been discovered in the package that allows for path traversal attacks. This means that an attacker can manipulate file paths in a way that allows them to write or overwrite files outside of the intended target directory.

Vulnerability Detail

The vulnerability in github.com/unknwon/cae is due to improper path sanitization. When handling archives that contain relative file paths, the package fails to properly validate and sanitize these paths. As a result, an attacker can craft a malicious archive that includes file paths that traverse outside of the target directory. This can lead to unauthorized access, data leakage, or even remote code execution if the overwritten files are executable. The vulnerability affects versions 0.0.0 to 1.0.0 of the package.

How To Fix

Latest published version: v1.0.2 as of 23 Oct 2026

go get github.com/unknwon/cae@v1.0.2

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.0.1

This is the first release that contains the fix.

go get github.com/unknwon/cae@v1.0.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version is not immediately possible, a temporary workaround is to manually validate and sanitize file paths before extracting or manipulating them. This can be done by checking if the path is within the intended target directory and rejecting any paths that attempt to traverse outside of it. Here is an example of how to implement this workaround in Go:

import (
	"github.com/unknwon/cae"
	"path/filepath"
)

func extractArchive(archivePath string, targetDir string) error {
	archive, err := cae.Open(archivePath)
	if err != nil {
		return err
	}

	for _, file := range archive.Files() {
		filePath := filepath.Join(targetDir, file.Path)
		if !isWithinTargetDir(filePath, targetDir) {
			return fmt.Errorf("Invalid file path: %s", filePath)
		}

		// Extract or manipulate the file
	}

	return nil
}

func isWithinTargetDir(filePath string, targetDir string) bool {
	absFilePath, err := filepath.Abs(filePath)
	if err != nil {
		return false
	}

	absTargetDir, err := filepath.Abs(targetDir)
	if err != nil {
		return false
	}

	return strings.HasPrefix(absFilePath, absTargetDir)
}

Conclusion

The vulnerability in github.com/unknwon/cae allows for path traversal attacks, which can lead to unauthorized access, data leakage, or remote code execution. Users of the package should update to version 1.0.1 to fix the vulnerability. If immediate updating is not possible, a temporary workaround is available. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/unknwon/cae →

Share this vulnerability

FAQ

Path traversal is a type of vulnerability that allows an attacker to access files or directories outside of the intended scope. In this case, the vulnerability in github.com/unknwon/cae allows an attacker to write or overwrite files outside of the target directory.

The consequences of this vulnerability can vary depending on the specific use case. In general, it can lead to unauthorized access to sensitive files, data leakage, or even remote code execution if the overwritten files are executable.

Versions 0.0.0 to 1.0.0 of github.com/unknwon/cae are affected by this vulnerability.

To fix this vulnerability, update to version 1.0.1 of github.com/unknwon/cae. This version includes proper path sanitization to prevent path traversal attacks.

Yes, a temporary workaround is to manually validate and sanitize file paths before extracting or manipulating them. Check if the path is within the intended target directory and reject any paths that attempt to traverse outside of it.

References

Related vulnerabilities

Recent vulnerabilities recorded for github.com/unknwon/cae.

How To Fix

Latest published version: v1.0.2 as of 23 Oct 2026

go get github.com/unknwon/cae@v1.0.2

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.0.1

This is the first release that contains the fix.

go get github.com/unknwon/cae@v1.0.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback