
pfSense CE 2.9.0-DEVELOPMENT - Medium - Remote - SQLi - voucher_expire WHERE
abraxaslabs.tech · github.com/abraxas · @abraxas_null · [email protected] · pfsense-voucher-expire-sqli
Class: SQLi Reach: Remote
pfSense CE 2.9.0-DEVELOPMENT (9363ac5) - pfsense.org
voucher.inc captiveportal_read_db("WHERE username = '{$voucher}'") then first-row sessionid into captiveportal_remove_entries. Unauth login INSERT uses SQLite3::escapeString.
| ID | no CVE yet |
| Class | SQLi |
| Reach | Remote (authenticated WebGUI unless noted) |
| CWE | CWE-89 |
| CVSS | Medium: 6.5 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| Product | pfSense CE |
| Affected | 2.9.0-DEVELOPMENT (9363ac5b8651a1c7a333180425ce7719070f95f9) |
| Auth | WebGUI session with page-status-captiveportal-expire / page-services-captiveportal-vouchers |
| License | GNU Affero GPL v3.0 |
| Lab | 127.0.0.1 only |
I pinned public master 9363ac5. The lab is a PHP gadget of the pinned sink, loopback HTTP on 127.0.0.1:19280.
Series write-up: https://abraxaslabs.tech/research/pfsense-ce-leftovers
| Method | Sink | Privilege |
|---|---|---|
| POST voucher expire token | captiveportal_read_db WHERE username = '{$voucher}' | Integrity: Lab-proven: UNION selected another sessionid and stacked-UPDATE rewrote that row. CONTROL expire only deleted A. Unauth login path stayed escaped. |
| same leftover | same sink | Recon: Inferred: UNION can read other session columns from captiveportal{zone}.db. |
| same leftover | same sink | Availability: Lab-proven: disconnect of the injected first row; can delete/rewrite another session on that zone DB. |
Requires: page-status-captiveportal-expire / page-services-captiveportal-vouchers. CSRF-magic on POST unless noted. WebGUI PHP-FPM is root.
Requires: page-status-captiveportal-expire / page-services-captiveportal-vouchers. CSRF-magic on POST unless noted. WebGUI PHP-FPM is root. CSRF-magic on POST unless noted. WebGUI PHP-FPM is root.
Unauth login escape. voucher_auth still escapeshellarg. No shell. No other-zone DB. No GUI cookie.
No Diagnostics: Command unless that page is also granted.
cd lab
./run.sh
Loopback 127.0.0.1:19280. Compose project pfsense-voucher-expire-sqli. Witness PFSENSE-VOUCHER-EXPIRE-SQLI-WITNESS. Loopback only: 127.0.0.1:19280. Compose project pfsense-voucher-expire-sqli. Witness PFSENSE-VOUCHER-EXPIRE-SQLI-WITNESS. PHP gadget of the pinned lines. Stack tears down after the run.
Last line:
SUCCESS PFSENSE-VOUCHER-EXPIRE-SQLI control-expire-only-a=yes control-login-escaped=yes trigger-rewrite-b=yes PFSENSE-VOUCHER-EXPIRE-SQLI-WITNESS
Bind parameters. Stop concatenating voucher into SQL.
9363ac5b8651a1c7a333180425ce7719070f95f9