Skip to content
Path traversal Write-up Advanced

Chasing the OPNsense RCE: The Story Behind My First CVEs

The GeoIP alias importer in OPNsense wrote files using an unvalidated country code from a downloaded CSV, allowing path traversal. An authenticated user with only the Firewall: Alias: Edit privilege could write arbitrary files as root and escalate to remote code execution by abusing newsyslog.

hackerask.com

Published on hackerask.com

I think every security researcher remembers their first CVE. For me, that milestone did not arrive as a single, low-impact bug.

The author, on hackerask.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

A low-privileged firewall user could achieve arbitrary file write as root and escalate to root remote code execution, though the command execution waits for the next hourly newsyslog cronjob.

What the attacker needed

Authenticated user with Firewall: Alias: Edit; attacker-controlled HTTP server; target directories must already exist; wait for hourly newsyslog cronjob

The fix

The GeoIP importer should validate the country code and prevent path traversal before using it in a file path; the text says all disclosed issues were patched in version 26.1.11.

How it was found

  1. Store an attacker-controlled URL as the GeoIP source via the alias set API.
  2. Reconfigure the alias so the URL is written into filter_geoip.conf.
  3. Trigger the GeoIP update, which runs geoip.py as root and downloads the malicious archive.
  4. The importer writes files using the traversal path from the CSV, creating a newsyslog config and an oversized log file.
  5. On the next hourly newsyslog run, the injected command executes as root.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A firewall admin can set a GeoIP alias to download a country database. The importer trusted a country code from that database and used it as a filename without checking it. By putting a path like ../../etc/... in that field, an attacker could write files anywhere as root and then get a root shell.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.