/

CVE-2022-51024

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Kavita Cover Upload API

CVE-2022-51024

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthorized Arbitrary File Read

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal vulnerability in Kavita allows unauthenticated attackers to access files outside the intended cover-upload temporary directory. The issue becomes risky when user-controlled filename values are used in filesystem operations without sufficient path canonicalization and boundary enforcement.

Affected context

The vulnerability occurs in Kavita's image cover-upload API when a request-controlled filename is incorporated into a local filesystem path. Deployments are at risk when the resulting path is not reliably confined to the designated temporary directory and the endpoint is reachable without authentication.

Exploit preconditions

  • Attack surface: HTTP GET requests to the cover-upload image API
  • Required access: Network access to the exposed endpoint; authentication may not be required
  • Trigger point: Processing of a user-controlled filename during file retrieval
  • Why exploitation is possible: Relative path components can cause filesystem resolution outside the intended upload directory when canonicalization and directory-boundary checks are insufficient

Why this happens

The underlying bug is improper limitation of a user-influenced filesystem path. The application uses a filename value to construct or resolve a local path without ensuring that the canonical result remains within the permitted directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • Attackers may read sensitive application configuration files
  • Exposed files could contain credentials, tokens, or internal service details
  • Confidentiality of application and host data may be reduced
  • Retrieved configuration information could support follow-on attacks

General mitigation guidance

Mitigation generally focuses on reducing trust in client-supplied path components and enforcing a strict filesystem boundary.

Common defensive patterns include:

  • Accepting opaque file identifiers rather than raw filenames where practical
  • Resolving paths canonically before access and verifying they remain under an approved directory
  • Rejecting path separators, relative components, and unexpected filename formats
  • Using allowlisted extensions and server-side generated names
  • Applying least-privilege permissions to the application process and stored files
  • Returning generic errors without revealing filesystem details

How teams detect issues like this

Organizations can look for path traversal risks through:

  • Static analysis rules identifying user input used in file-path construction
  • Code review checks for canonicalization followed by directory-boundary validation
  • Tests covering encoded, normalized, and platform-specific path variations
  • Web-server and application logs showing unusual filename values or repeated file-read errors
  • Policy enforcement that restricts filesystem access to approved application directories

Automated security review tools may help identify unsafe path handling patterns during development.

Sources

SourceLink
github.comgithub.com/Kareadita/Kavita/commit/88b5ebeb6
github.comgithub.com/projectdiscovery/nuclei-templates/blob/main/http/vulnerabilities/other/kavita-lfi.yaml
huntr.comhuntr.com/bounties/2eef332b-65d2-4f13-8c39-44a8771a6f18
vulncheck.comvulncheck.com/advisories/kavita-0.5.4.1-unauthenticated-path-traversal-via-cover-upload-endpoint

Frequently asked

questions

Yes. An attacker may exploit the issue through the exposed HTTP endpoint when the service is network-reachable and the endpoint processes attacker-controlled filename values.

The described behavior does not require authentication, although network controls, reverse proxies, or other deployment restrictions may limit exposure.

Treat filenames as untrusted input, use server-side identifiers where possible, and verify after canonicalization that every resolved path remains inside the intended directory.

Combine allowlisted filename handling, filesystem least privilege, targeted path-traversal tests, code review rules, and monitoring for suspicious path-related requests.

Find out what's already
exploitable in your codebase.