CVE-2022-35920: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in sanic-org sanic
Sanic is an opensource python web server/framework. Affected versions of sanic allow access to lateral directories when using `app.static` if using encoded `%2F` URLs. Parent directory traversal is not impacted. Users are advised to upgrade. There is no known workaround for this issue.
AI Analysis
Technical Summary
CVE-2022-35920 is a medium-severity path traversal vulnerability affecting the Sanic web server/framework, an open-source Python framework widely used for building asynchronous web applications. The vulnerability arises from improper limitation of pathnames to restricted directories (CWE-22) when serving static files via the `app.static` method. Specifically, the affected versions of Sanic (versions >= 22.0.0 and < 22.6.1, >= 21.0.0 and < 21.12.2, and all versions below 20.12.7) fail to correctly handle encoded URL characters, notably the encoded forward slash `%2F`. This allows an attacker to craft specially encoded URLs that bypass directory restrictions and access lateral directories adjacent to the intended static directory. Notably, parent directory traversal (i.e., using `../`) is not impacted, limiting the scope of traversal to lateral directories only. The vulnerability does not require authentication or user interaction to exploit, but it does require that the Sanic application is configured to serve static content via `app.static`. There are no known exploits in the wild at this time, and no workaround exists other than upgrading to a patched version of Sanic (versions 22.6.1, 21.12.2, or later). This vulnerability could allow unauthorized disclosure of files outside the intended static directory, potentially exposing sensitive information or configuration files if present in lateral directories accessible to the web server process. The issue stems from insufficient sanitization and validation of URL-encoded input paths when resolving static file requests, which is a common web security concern but requires careful handling in asynchronous frameworks like Sanic.
Potential Impact
For European organizations using Sanic to serve static content, this vulnerability could lead to unauthorized information disclosure. Attackers could retrieve files from lateral directories, which may include sensitive configuration files, credentials, or internal documentation, depending on the server's directory structure and permissions. This could compromise confidentiality and potentially aid further attacks such as privilege escalation or lateral movement within the network. While the vulnerability does not allow parent directory traversal, lateral directory access still poses a significant risk if sensitive files are stored in sibling directories. The impact is heightened in sectors with strict data protection requirements, such as finance, healthcare, and government, where exposure of sensitive data could lead to regulatory penalties under GDPR and damage to reputation. Since Sanic is popular for high-performance asynchronous Python applications, organizations relying on it for web services or APIs may face service disruption if attackers exploit this flaw to access or leak critical files. However, the lack of known exploits and the medium severity rating suggest the immediate risk is moderate but should not be underestimated given the potential for information leakage.
Mitigation Recommendations
Upgrade Sanic to a patched version: specifically, versions 22.6.1, 21.12.2, or later, which address this vulnerability. Review and restrict the directory structure used for serving static files to ensure no sensitive files reside in lateral directories accessible to the web server process. Implement strict access controls and file permissions on the server to limit the web server's read access only to necessary directories. Use web application firewalls (WAFs) with custom rules to detect and block requests containing encoded path traversal sequences such as '%2F'. Audit and sanitize all user inputs and URLs, especially those used in static file serving, to prevent exploitation of encoding-based bypasses. Monitor web server logs for suspicious requests containing encoded characters or unusual access patterns to lateral directories. Consider isolating static content serving to dedicated subdomains or containers with minimal privileges to reduce the blast radius of any potential exploitation.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Belgium, Italy, Spain
CVE-2022-35920: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in sanic-org sanic
Description
Sanic is an opensource python web server/framework. Affected versions of sanic allow access to lateral directories when using `app.static` if using encoded `%2F` URLs. Parent directory traversal is not impacted. Users are advised to upgrade. There is no known workaround for this issue.
AI-Powered Analysis
Technical Analysis
CVE-2022-35920 is a medium-severity path traversal vulnerability affecting the Sanic web server/framework, an open-source Python framework widely used for building asynchronous web applications. The vulnerability arises from improper limitation of pathnames to restricted directories (CWE-22) when serving static files via the `app.static` method. Specifically, the affected versions of Sanic (versions >= 22.0.0 and < 22.6.1, >= 21.0.0 and < 21.12.2, and all versions below 20.12.7) fail to correctly handle encoded URL characters, notably the encoded forward slash `%2F`. This allows an attacker to craft specially encoded URLs that bypass directory restrictions and access lateral directories adjacent to the intended static directory. Notably, parent directory traversal (i.e., using `../`) is not impacted, limiting the scope of traversal to lateral directories only. The vulnerability does not require authentication or user interaction to exploit, but it does require that the Sanic application is configured to serve static content via `app.static`. There are no known exploits in the wild at this time, and no workaround exists other than upgrading to a patched version of Sanic (versions 22.6.1, 21.12.2, or later). This vulnerability could allow unauthorized disclosure of files outside the intended static directory, potentially exposing sensitive information or configuration files if present in lateral directories accessible to the web server process. The issue stems from insufficient sanitization and validation of URL-encoded input paths when resolving static file requests, which is a common web security concern but requires careful handling in asynchronous frameworks like Sanic.
Potential Impact
For European organizations using Sanic to serve static content, this vulnerability could lead to unauthorized information disclosure. Attackers could retrieve files from lateral directories, which may include sensitive configuration files, credentials, or internal documentation, depending on the server's directory structure and permissions. This could compromise confidentiality and potentially aid further attacks such as privilege escalation or lateral movement within the network. While the vulnerability does not allow parent directory traversal, lateral directory access still poses a significant risk if sensitive files are stored in sibling directories. The impact is heightened in sectors with strict data protection requirements, such as finance, healthcare, and government, where exposure of sensitive data could lead to regulatory penalties under GDPR and damage to reputation. Since Sanic is popular for high-performance asynchronous Python applications, organizations relying on it for web services or APIs may face service disruption if attackers exploit this flaw to access or leak critical files. However, the lack of known exploits and the medium severity rating suggest the immediate risk is moderate but should not be underestimated given the potential for information leakage.
Mitigation Recommendations
Upgrade Sanic to a patched version: specifically, versions 22.6.1, 21.12.2, or later, which address this vulnerability. Review and restrict the directory structure used for serving static files to ensure no sensitive files reside in lateral directories accessible to the web server process. Implement strict access controls and file permissions on the server to limit the web server's read access only to necessary directories. Use web application firewalls (WAFs) with custom rules to detect and block requests containing encoded path traversal sequences such as '%2F'. Audit and sanitize all user inputs and URLs, especially those used in static file serving, to prevent exploitation of encoding-based bypasses. Monitor web server logs for suspicious requests containing encoded characters or unusual access patterns to lateral directories. Consider isolating static content serving to dedicated subdomains or containers with minimal privileges to reduce the blast radius of any potential exploitation.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2022-07-15T00:00:00.000Z
- Cisa Enriched
- true
Threat ID: 682d9849c4522896dcbf6761
Added to database: 5/21/2025, 9:09:29 AM
Last enriched: 6/22/2025, 12:07:46 AM
Last updated: 8/11/2025, 10:49:25 PM
Views: 18
Related Threats
CVE-2025-53948: CWE-415 Double Free in Santesoft Sante PACS Server
HighCVE-2025-52584: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-46269: CWE-122 Heap-based Buffer Overflow in Ashlar-Vellum Cobalt
HighCVE-2025-54862: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumCVE-2025-54759: CWE-79 Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') in Santesoft Sante PACS Server
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
External Links
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.