Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2022-51024 Overview
Kavita versions 0.5.2 before 0.5.4.1 contain an unauthenticated path traversal vulnerability in the cover upload endpoint. Attackers can send a crafted GET request to /api/image/cover-upload with a filename parameter containing ../ sequences. This allows reading arbitrary files outside the intended temp directory, including sensitive configuration files such as appsettings.json. The flaw is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). Exploitation evidence was first observed by the Shadowserver Foundation on 2023-10-18.
Critical Impact
Unauthenticated remote attackers can read arbitrary files from the Kavita server, including configuration files containing database connection strings, JWT signing secrets, and other credentials.
Affected Products
- Kavita 0.5.2
- Kavita 0.5.3
- Kavita versions prior to 0.5.4.1
Discovery Timeline
- 2023-10-18 - Exploitation evidence first observed by the Shadowserver Foundation
- 2026-10-22 - CVE-2022-51024 published to NVD
- 2026-10-22 - Last updated in NVD database
Technical Details for CVE-2022-51024
Vulnerability Analysis
Kavita is an open-source digital library server for managing comics, manga, and books. The /api/image/cover-upload endpoint accepts a filename parameter intended to reference files within a temporary upload directory. The endpoint fails to sanitize or canonicalize the user-supplied filename before resolving it against the filesystem. The endpoint is also exposed without requiring authentication, which widens the attack surface to any network-reachable client.
An attacker can supply a value such as ../appsettings.json to escape the intended directory and retrieve files from the Kavita installation root. The appsettings.json file typically contains the token signing key, database connection string, and other application secrets. Disclosure of these secrets can enable follow-on account takeover and authenticated access to the application.
Root Cause
The root cause is missing input validation on the filename parameter combined with direct path concatenation. The code does not reject or normalize ../ traversal sequences and does not confirm that the resolved path remains within the expected base directory. The endpoint is also decorated to allow anonymous access, so no authentication check mitigates the flaw.
Attack Vector
Exploitation requires only network access to the Kavita web interface. An attacker sends an HTTP GET request to /api/image/cover-upload with a traversal payload in the filename query parameter. The server returns the contents of the targeted file in the HTTP response. A public Nuclei template documenting the pattern is available in the projectdiscovery nuclei-templates repository.
// Security Hotfix (#1415) - API/Controllers/AccountController.cs excerpt
+ [AllowAnonymous]
[HttpPost("reset-password")]
public async Task<ActionResult> UpdatePassword(ResetPasswordDto resetPasswordDto)
{
+ // TODO: Log this request to Audit Table
_logger.LogInformation("{UserName} is changing {ResetUser}'s password", User.GetUsername(), resetPasswordDto.UserName);
- var user = await _userManager.Users.SingleAsync(x => x.UserName == resetPasswordDto.UserName);
- if (resetPasswordDto.UserName != User.GetUsername() && !(User.IsInRole(PolicyConstants.AdminRole) || User.IsInRole(PolicyConstants.ChangePasswordRole)))
+ var user = await _userManager.Users.SingleOrDefaultAsync(x => x.UserName == resetPasswordDto.UserName);
+ if (user == null) return Ok(); // Don't report BadRequest as that would allow brute forcing to find accounts on system
+
+ if (resetPasswordDto.UserName == User.GetUsername() && !(User.IsInRole(PolicyConstants.ChangePasswordRole) || User.IsInRole(PolicyConstants.AdminRole)))
+ return Unauthorized("You are not permitted to this operation.");
+
+ if (resetPasswordDto.UserName != User.GetUsername() && !User.IsInRole(PolicyConstants.AdminRole))
return Unauthorized("You are not permitted to this operation.");
Source: Kavita Security Hotfix commit 88b5ebeb6
Detection Methods for CVE-2022-51024
Indicators of Compromise
- HTTP GET requests to /api/image/cover-upload containing ../ or URL-encoded %2e%2e%2f sequences in the filename parameter.
- Requests referencing sensitive filenames such as appsettings.json, kavita.db, or files under config/.
- Access to the cover-upload endpoint from unauthenticated or unexpected source IP addresses.
- Response bodies from the endpoint containing JSON configuration content rather than image data.
Detection Strategies
- Deploy the Kavita LFI Nuclei template against internal Kavita instances to confirm patched status.
- Write web application firewall rules that block path traversal patterns in query parameters on all Kavita endpoints.
- Correlate repeated /api/image/cover-upload requests with varying filename values to identify fuzzing or enumeration attempts.
Monitoring Recommendations
- Forward Kavita web server access logs to a centralized log platform and alert on traversal payloads targeting the API.
- Monitor outbound data volumes from Kavita hosts to detect bulk file exfiltration following successful exploitation.
- Track process and file read activity on the Kavita server for anomalous access to configuration and database files.
How to Mitigate CVE-2022-51024
Immediate Actions Required
- Upgrade Kavita to version 0.5.4.1 or later immediately.
- Restrict network exposure of the Kavita web interface to trusted networks or place it behind an authenticating reverse proxy.
- Rotate any secrets stored in appsettings.json, including JWT signing keys and database credentials, if the server was internet-exposed.
- Review web server logs for prior exploitation attempts referencing the cover-upload endpoint.
Patch Information
The vendor addressed the issue in Kavita 0.5.4.1. The remediation is tracked in the Kavita Security Hotfix commit 88b5ebeb6 and the Huntr bug bounty report. Additional context is available in the VulnCheck advisory for Kavita.
Workarounds
- Block requests to /api/image/cover-upload at the reverse proxy or WAF until upgrading is possible.
- Enforce request filtering that strips or rejects ../, ..\\, and URL-encoded equivalents from query parameters.
- Run Kavita as a low-privilege user and restrict filesystem permissions so configuration files are readable only by the service account.
# Example nginx reverse proxy rule to block traversal payloads on the vulnerable endpoint
location /api/image/cover-upload {
if ($args ~* "(\.\./|\.\.\\|%2e%2e)") {
return 403;
}
proxy_pass http://kavita_backend;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

