/

CVE-2021-48011

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in Servor Web File Serving

CVE-2021-48011

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read and Directory Enumeration

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Servor versions 1.0.0 through 4.0.2 contain a path traversal vulnerability in static file and directory-listing handlers. An unauthenticated remote attacker may escape the configured serving root by submitting URL-encoded traversal segments, potentially reading arbitrary files or listing directories when the vulnerable endpoints are exposed.

Servor versions 1.0.0 through 4.0.2 contain a path traversal vulnerability in static file and directory-listing handlers. An unauthenticated remote attacker may escape the configured serving root by submitting URL-encoded traversal segments, potentially reading arbitrary files or listing directories when the vulnerable endpoints are exposed.

Affected context

The vulnerability occurs in Servor deployments that expose static-file serving or directory-listing functionality and process URL paths through decoding before constructing filesystem paths. Risk is higher when the service runs with access to sensitive files outside its intended document root and when those endpoints are reachable without authentication.

The vulnerability occurs in Servor deployments that expose static-file serving or directory-listing functionality and process URL paths through decoding before constructing filesystem paths. Risk is higher when the service runs with access to sensitive files outside its intended document root and when those endpoints are reachable without authentication.

Exploit preconditions

  • Attack surface: HTTP static-file and directory-listing endpoints
  • Required access: Network connectivity to an exposed Servor instance; authentication is generally not required
  • Trigger point: URL path processing in serveStaticFile or serveDirectoryListing
  • Why exploitation is possible: URL decoding converts encoded dot segments into traversal components before path construction, allowing the resulting path to resolve outside the configured serving root
  • Attack surface: HTTP static-file and directory-listing endpoints
  • Required access: Network connectivity to an exposed Servor instance; authentication is generally not required
  • Trigger point: URL path processing in serveStaticFile or serveDirectoryListing
  • Why exploitation is possible: URL decoding converts encoded dot segments into traversal components before path construction, allowing the resulting path to resolve outside the configured serving root

Why this happens

The underlying bug is improper neutralization of path elements used to construct filesystem paths. Servor decodes attacker-controlled URL input before passing it to path-joining logic, without reliably enforcing that the normalized result remains within the intended root directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

The underlying bug is improper neutralization of path elements used to construct filesystem paths. Servor decodes attacker-controlled URL input before passing it to path-joining logic, without reliably enforcing that the normalized result remains within the intended root directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • An attacker may read sensitive files accessible to the service process.
  • An attacker could enumerate directories outside the configured serving root.
  • Exposed configuration files, credentials, or source code may be disclosed.
  • The vulnerability may support follow-on compromise if retrieved files contain secrets or operational details.
  • An attacker may read sensitive files accessible to the service process.
  • An attacker could enumerate directories outside the configured serving root.
  • Exposed configuration files, credentials, or source code may be disclosed.
  • The vulnerability may support follow-on compromise if retrieved files contain secrets or operational details.

General mitigation guidance

Mitigation generally focuses on enforcing the serving-root boundary after complete URL decoding and path normalization.

Common defensive patterns include:

  • Resolve requested paths against a fixed document root and verify that the final canonical path remains within that root.
  • Reject traversal components and ambiguous encoded separators using consistent, centralized path validation.
  • Prefer framework or filesystem APIs designed for confined file serving rather than assembling paths manually.
  • Disable directory listing when it is not required.
  • Run the service with least-privilege filesystem access and prevent access to sensitive directories.
  • Treat URL paths as untrusted input regardless of whether the request reaches an authenticated route.

Mitigation generally focuses on enforcing the serving-root boundary after complete URL decoding and path normalization.

Common defensive patterns include:

  • Resolve requested paths against a fixed document root and verify that the final canonical path remains within that root.
  • Reject traversal components and ambiguous encoded separators using consistent, centralized path validation.
  • Prefer framework or filesystem APIs designed for confined file serving rather than assembling paths manually.
  • Disable directory listing when it is not required.
  • Run the service with least-privilege filesystem access and prevent access to sensitive directories.
  • Treat URL paths as untrusted input regardless of whether the request reaches an authenticated route.

How teams detect issues like this

Organizations commonly detect path traversal risks through:

  • Static analysis for URL decoding followed by filesystem path joins or file access.
  • Code review checks for missing canonicalization and root-containment validation.
  • Dynamic testing with encoded and normalized traversal variants against file-serving endpoints.
  • Web application firewall or gateway policies that identify traversal patterns, while recognizing that filtering should not replace server-side validation.
  • Monitoring for requests that attempt to access paths outside the expected document root and for unusual directory-enumeration activity.

Organizations commonly detect path traversal risks through:

  • Static analysis for URL decoding followed by filesystem path joins or file access.
  • Code review checks for missing canonicalization and root-containment validation.
  • Dynamic testing with encoded and normalized traversal variants against file-serving endpoints.
  • Web application firewall or gateway policies that identify traversal patterns, while recognizing that filtering should not replace server-side validation.
  • Monitoring for requests that attempt to access paths outside the expected document root and for unusual directory-enumeration activity.

Sources

SourceLink
github.comgithub.com/lukejacksonn/servor
github.comgithub.com/lukejacksonn/servor/commit/ec7d824ea6903c0fb97a452045bbb8335198cbab
github.comgithub.com/lukejacksonn/servor/pull/70
vulncheck.comvulncheck.com/advisories/servor-1.0.0-through-4.0.2-unauthenticated-path-traversal-via-url-encoded-dot-segments

Frequently asked

questions

Yes. An attacker may exploit it remotely when a vulnerable Servor instance exposes the affected static-file or directory-listing functionality over the network.

Typically no. The described issue allows unauthenticated requests, although network controls or deployment-specific access restrictions may limit exposure.

Enforce canonical path resolution and verify that every resolved path remains beneath the configured serving root after decoding and normalization. Also restrict the service account's filesystem permissions.

Treat all URL paths as untrusted, use constrained file-serving APIs, test encoded traversal variants, disable unnecessary directory listings, and include path-boundary checks in code review and automated security testing.

Yes. An attacker may exploit it remotely when a vulnerable Servor instance exposes the affected static-file or directory-listing functionality over the network.

Typically no. The described issue allows unauthenticated requests, although network controls or deployment-specific access restrictions may limit exposure.

Enforce canonical path resolution and verify that every resolved path remains beneath the configured serving root after decoding and normalization. Also restrict the service account's filesystem permissions.

Treat all URL paths as untrusted, use constrained file-serving APIs, test encoded traversal variants, disable unnecessary directory listings, and include path-boundary checks in code review and automated security testing.

Find out what's already
exploitable in your codebase.