Failure to Sanitize Special Elements into a Different Plane (Special Element Injection) in octoprint/octoprint
Description
Failure to Sanitize Special Elements into a Different Plane (Special Element Injection) in GitHub repository octoprint/octoprint prior to 1.8.3.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
OctoPrint prior to 1.8.3 allowed path traversal via specially crafted language packs, enabling arbitrary file write.
Vulnerability
Overview
CVE-2022-3607 is a special element injection vulnerability in OctoPrint, the popular 3D printer web interface. The flaw resides in the language pack handling mechanism, where uploaded ZIP or tar archives were not properly sanitized for path traversal sequences. Prior to version 1.8.3, the validation only checked archive member names against simple patterns like starting with '/' or containing '..', but failed to resolve paths relative to the extraction target directory [1][4]. This allowed an attacker to craft an archive with entries that escape the intended language pack folder.
Exploitation
To exploit this vulnerability, an attacker must have the ability to upload a language pack—typically an authenticated user with plugin or system administration privileges. By providing a malicious archive containing file paths such as ../../etc/octoprint/config.yaml or absolute paths like /tmp/malicious, the attacker could write files to arbitrary locations on the server's filesystem [4]. The fix introduced in commit 3cca3a4 adds proper path resolution using os.path.abspath and os.path.join to ensure all extracted files remain within the target directory, and also validates that tar entries are regular files or directories [4].
Impact
Successful exploitation allows an attacker to write arbitrary files to the OctoPrint server. This could lead to overwriting critical configuration files, injecting malicious code into startup scripts, or placing a web shell, ultimately resulting in remote code execution with the privileges of the OctoPrint process [1][3]. The vulnerability is rated with a CVSS score of 8.8 (High) due to the high impact on confidentiality, integrity, and availability.
Mitigation
The vulnerability was fixed in OctoPrint version 1.8.3, released on 2022-10-19. Users are strongly advised to update to this version or later. No workarounds are documented; the only mitigation is to apply the patch [1][4]. The issue was reported via huntr.dev and is also tracked in the PySec advisory database [3].
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
OctoPrintPyPI | < 1.8.3 | 1.8.3 |
Affected products
2- octoprint/octoprint/octoprintv5Range: unspecified
Patches
13cca3a43f3d0🔒️ Close a sanity check hole in language packs
1 file changed · +16 −4
src/octoprint/server/api/languages.py+16 −4 modified@@ -174,7 +174,8 @@ def deleteInstalledLanguagePack(locale, pack): def _unpack_uploaded_zipfile(path, target): with zipfile.ZipFile(path, "r") as zip: # sanity check - map(_validate_archive_name, zip.namelist()) + for info in zip.infolist(): + _validate_zip_info(info, target) # unpack everything zip.extractall(target) @@ -183,16 +184,27 @@ def _unpack_uploaded_zipfile(path, target): def _unpack_uploaded_tarball(path, target): with tarfile.open(path, "r") as tar: # sanity check - map(_validate_archive_name, tar.getmembers()) + for info in tar.getmembers(): + _validate_tar_info(info, target) # unpack everything tar.extractall(target) -def _validate_archive_name(name): - if name.startswith("/") or ".." in name: +def _validate_archive_name(name, target): + if not os.path.abspath(os.path.join(target, name)).startswith(target + os.path.sep): raise InvalidLanguagePack(f"Provided language pack contains invalid name {name}") +def _validate_zip_info(info, target): + _validate_archive_name(info.filename, target) + + +def _validate_tar_info(info, target): + _validate_archive_name(info.name, target) + if not (info.isfile() or info.isdir()): + raise InvalidLanguagePack("Provided language pack contains invalid file type") + + class InvalidLanguagePack(Exception): pass
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
5- github.com/advisories/GHSA-rj5f-vm79-5j84ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2022-3607ghsaADVISORY
- github.com/octoprint/octoprint/commit/3cca3a43f3d085e9bbe5a5840c8255bb1b5d052eghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/octoprint/PYSEC-2022-42975.yamlghsaWEB
- huntr.dev/bounties/2d1db3c9-93e8-4902-a55b-5ea53c22aa11ghsaWEB
News mentions
0No linked articles in our index yet.