/

CVE-2026-57155

Severity:

CRITICAL RISK

(9.9)

Path Traversal (CWE-22) in OPNsense GeoIP Alias Importer

CVE-2026-57155

Deferred

Vulnerability type

Category:

Path Traversal and Arbitrary File Write

CWE:

CWE-22, CWE-73, CWE-78

Impact:

Root Privilege Escalation and Remote Code Execution

Severity:

CRITICAL RISK

(9.9)

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

A path traversal and arbitrary file write vulnerability in the OPNsense GeoIP alias importer allows a privileged user to influence where extracted archive content is stored. Under affected configurations, this may enable files to be written with root privileges and could lead to command execution and complete firewall compromise.

A path traversal and arbitrary file write vulnerability in the OPNsense GeoIP alias importer allows a privileged user to influence where extracted archive content is stored. Under affected configurations, this may enable files to be written with root privileges and could lead to command execution and complete firewall compromise.

Affected context

The issue occurs in OPNsense Firewall Alias GeoIP import processing when an administrator or other account with Firewall Alias Edit privilege can configure a user-controlled GeoIP source. Risk is present when archive metadata is used to construct output paths without validating country-code values, allowing writes to locations outside the intended GeoIP alias directory.

The issue occurs in OPNsense Firewall Alias GeoIP import processing when an administrator or other account with Firewall Alias Edit privilege can configure a user-controlled GeoIP source. Risk is present when archive metadata is used to construct output paths without validating country-code values, allowing writes to locations outside the intended GeoIP alias directory.

Exploit preconditions

  • Attack surface: Firewall Alias GeoIP import functionality
  • Required access: An account with Firewall Alias Edit privilege
  • Attacker-controlled input: A configurable GeoIP source URL and archive contents
  • Trigger point: Processing of ZIP or gzip-based GeoIP data
  • Why exploitation is possible: An unvalidated country-code value influences output filenames, enabling path traversal and root-owned file writes
  • Additional condition: A writable target must interact with a privileged system component, such as scheduled log-processing or command-execution functionality
  • Attack surface: Firewall Alias GeoIP import functionality
  • Required access: An account with Firewall Alias Edit privilege
  • Attacker-controlled input: A configurable GeoIP source URL and archive contents
  • Trigger point: Processing of ZIP or gzip-based GeoIP data
  • Why exploitation is possible: An unvalidated country-code value influences output filenames, enabling path traversal and root-owned file writes
  • Additional condition: A writable target must interact with a privileged system component, such as scheduled log-processing or command-execution functionality

Why this happens

The underlying bug is a failure to treat archive-derived metadata as untrusted path input. The importer uses a country-code value to construct filenames without adequately constraining the resulting path to the intended GeoIP alias directory. This maps primarily to CWE-22, Improper Limitation of a Pathname to a Restricted Directory. It also relates to CWE-73 because an external source controls the file destination, and CWE-78 where written content can later be interpreted by a command-execution mechanism.

The underlying bug is a failure to treat archive-derived metadata as untrusted path input. The importer uses a country-code value to construct filenames without adequately constraining the resulting path to the intended GeoIP alias directory. This maps primarily to CWE-22, Improper Limitation of a Pathname to a Restricted Directory. It also relates to CWE-73 because an external source controls the file destination, and CWE-78 where written content can later be interpreted by a command-execution mechanism.

Potential impact

  • Attacker-controlled files may be written with root privileges
  • Existing firewall or operating-system files may be overwritten
  • Scheduled system processing may execute attacker-controlled commands
  • The firewall configuration and protected network perimeter may be compromised
  • Sensitive data may be exposed or altered
  • Compromised systems may be used for lateral movement
  • Attacker-controlled files may be written with root privileges
  • Existing firewall or operating-system files may be overwritten
  • Scheduled system processing may execute attacker-controlled commands
  • The firewall configuration and protected network perimeter may be compromised
  • Sensitive data may be exposed or altered
  • Compromised systems may be used for lateral movement

General mitigation guidance

Mitigation generally focuses on enforcing strict path and archive-boundary

controls before any privileged write occurs.

Common defensive patterns include:

  • Treating archive filenames and metadata as untrusted input
  • Allowing only canonical, expected country-code formats
  • Resolving candidate paths and verifying they remain beneath a fixed destination directory
  • Rejecting absolute paths, traversal components, symbolic-link escapes, and unexpected suffixes
  • Using controlled temporary directories and non-privileged extraction stages
  • Separating downloaded content from trusted system configuration and executable locations
  • Restricting which accounts can configure external import sources
  • Applying least privilege to import jobs and scheduled maintenance processes
  • Validating generated files before they can be consumed by interpreters or command-execution services

Mitigation generally focuses on enforcing strict path and archive-boundary

controls before any privileged write occurs.

Common defensive patterns include:

  • Treating archive filenames and metadata as untrusted input
  • Allowing only canonical, expected country-code formats
  • Resolving candidate paths and verifying they remain beneath a fixed destination directory
  • Rejecting absolute paths, traversal components, symbolic-link escapes, and unexpected suffixes
  • Using controlled temporary directories and non-privileged extraction stages
  • Separating downloaded content from trusted system configuration and executable locations
  • Restricting which accounts can configure external import sources
  • Applying least privilege to import jobs and scheduled maintenance processes
  • Validating generated files before they can be consumed by interpreters or command-execution services

How teams detect issues like this

Organizations can look for this vulnerability class through:

  • Static analysis rules that flag path construction from archive metadata or external URLs
  • Code review checks for missing canonicalization and destination-boundary validation
  • Tests covering absolute paths, traversal sequences, symbolic links, unusual separators, and malformed metadata
  • Monitoring for unexpected writes beneath system directories by firewall services
  • File-integrity monitoring on configuration, logging, and scheduled-task locations
  • Policy enforcement that restricts external import sources and privileged file creation
  • Automated security review tools that identify archive extraction and command-injection data flows

Organizations can look for this vulnerability class through:

  • Static analysis rules that flag path construction from archive metadata or external URLs
  • Code review checks for missing canonicalization and destination-boundary validation
  • Tests covering absolute paths, traversal sequences, symbolic links, unusual separators, and malformed metadata
  • Monitoring for unexpected writes beneath system directories by firewall services
  • File-integrity monitoring on configuration, logging, and scheduled-task locations
  • Policy enforcement that restricts external import sources and privileged file creation
  • Automated security review tools that identify archive extraction and command-injection data flows

Sources

SourceLink
github.comgithub.com/opnsense/core/commit/c46aced9c47d956167e294911113bc334fea5f48
github.comgithub.com/opnsense/core/commit/e7fbfaa7f5e070da667e3f243da11fd3d4b731fa
github.comgithub.com/opnsense/core/security/advisories/GHSA-wjqq-rfmm-v5h3
hackerask.comhackerask.com/posts/opnsense

Frequently asked

questions

Exploitation generally requires an account with Firewall Alias Edit privilege and

the ability to configure a GeoIP source or otherwise influence imported archive

content.

Not necessarily. The key requirement is authorized access to the relevant

OPNsense configuration function; whether that access is remote depends on the

firewall's management exposure and authentication controls.

Ensure archive-derived names are strictly validated, canonicalize resolved paths,

and reject any result that escapes the intended extraction directory. Privileged

writes should occur only after validation and in a constrained location.

Combine least-privilege service design, secure archive extraction libraries,

destination-boundary checks, file-integrity monitoring, and tests for traversal

and downstream command-execution data flows.

Exploitation generally requires an account with Firewall Alias Edit privilege and

the ability to configure a GeoIP source or otherwise influence imported archive

content.

Not necessarily. The key requirement is authorized access to the relevant

OPNsense configuration function; whether that access is remote depends on the

firewall's management exposure and authentication controls.

Ensure archive-derived names are strictly validated, canonicalize resolved paths,

and reject any result that escapes the intended extraction directory. Privileged

writes should occur only after validation and in a constrained location.

Combine least-privilege service design, secure archive extraction libraries,

destination-boundary checks, file-integrity monitoring, and tests for traversal

and downstream command-execution data flows.

Find out what's already
exploitable in your codebase.