CVE-2026-33686: Code16/sharp Path Traversal Vulnerability
HIGHCVE-2026-33686 is a HIGH (CVSS 8.8) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Code16/sharp libraries in the Packagist ecosystem. The issue involves sharp is vulnerable to path traversal via unsanitized extension in fileutil. Remediation is available by upgrading affected packages to version 9.20.0.
CVE-2026-33686 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-33686
To remediate this vulnerability, upgrade all affected Code16/sharp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade code16/sharp to 9.20.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for code16/sharp
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-33686, inspect your project dependencies for Code16/sharp:
inspect dependencies for code16/sharp
Analyze the terminal output to locate any version of Code16/sharp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.20.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Code16/sharp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-33686 Affected Code16/sharp Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
code16/sharp
|
Packagist |
< 9.20.0
|
9.20.0
|
References
Frequently Asked Questions
What is CVE-2026-33686?
Which Code16/sharp versions are affected?
What version fixes CVE-2026-33686?
Is code16/sharp affected?
What is the CVSS score of CVE-2026-33686?
What CWE is associated with CVE-2026-33686?
How can I check Packagist dependencies for CVE-2026-33686?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9ffq-6457-8958",
"modified" : "2026-03-27T21:36:04Z",
"published" : "2026-03-25T20:01:04Z",
"aliases" : [ "CVE-2026-33686" ],
"summary" : "Sharp is Vulnerable to Path Traversal via Unsanitized Extension in FileUtil",
"details" : "### Summary\nA path traversal vulnerability exists in the FileUtil class of the code16/sharp package. The application fails to sanitize file extensions properly, allowing path separators to be passed into the storage layer.\n\n### Detail\nIn `src/Utils/FileUtil.php`, the `FileUtil::explodeExtension()` function extracts a file's extension by splitting the filename at the last dot. However, the extracted extension is never sanitized. While the application uses a `normalizeName()` function, this function only cleans the base filename, meaning any path separators (such as /) injected into the extension will survive and be passed into the `storeAs()` function.\n\n### Impact\nExploiting this flaw allows an authenticated attacker to manipulate file paths:\n- Files can be written outside of the intended tmp directory via path traversal. For more details on the package, visit: https://github.com/code16/sharp\n- Existing critical files (such as .env or configuration files) could potentially be overwritten. Review the CWE definition here: https://cwe.mitre.org/data/definitions/22.html (Note: This vulnerability was successfully chained with CWE-434 in a local Proof of Concept to confirm the traversal.)\n\n### Patches\nThis issue has been patched by properly sanitizing the extension using `pathinfo(PATHINFO_EXTENSION)` instead of `strrpos()`, alongside applying strict regex replacements to both the base name and the extension. The fix is available in pull request #715\n\n### Credits\nReported by [zaurgsynv](https://github.com/zaurgsynv).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "code16/sharp"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "9.20.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/code16/sharp/security/advisories/GHSA-9ffq-6457-8958"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33686"
}, {
"type" : "WEB",
"url" : "https://github.com/code16/sharp/pull/715"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/code16/sharp"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-25T20:01:04Z",
"nvd_published_at" : "2026-03-26T22:16:31Z"
}
}