config: replace commit and rollback import UCI config through fixed /tmp files as root #45

Closed
opened 2026-11-12 21:31:57 +00:00 by christianmanivong · 0 comments
Owner

Prio: P3

Found in netOrk's security sweep of 2026-11-12 (NetOrk/netork#2446).

config_mixin.commit_config() in replace mode writes the candidate with printf … > /tmp/napalm_candidate.uci, then runs uci import < /tmp/napalm_candidate.uci && uci commit and rm -f in separate commands, all as root; rollback() does the same with /tmp/napalm_rollback.uci. The names are fixed: a local account can pre-place the file (or a symlink), or swap it between the write and the import, and have its own configuration imported and committed.

Fix: one command per import: f=$(umask 077 && mktemp), write the config to "$f", uci import < "$f" && uci commit, then rm -f "$f".

Prio: P3 Found in netOrk's security sweep of 2026-11-12 (NetOrk/netork#2446). `config_mixin.commit_config()` in replace mode writes the candidate with `printf … > /tmp/napalm_candidate.uci`, then runs `uci import < /tmp/napalm_candidate.uci && uci commit` and `rm -f` in separate commands, all as root; `rollback()` does the same with `/tmp/napalm_rollback.uci`. The names are fixed: a local account can pre-place the file (or a symlink), or swap it between the write and the import, and have its own configuration imported and committed. **Fix:** one command per import: `f=$(umask 077 && mktemp)`, write the config to `"$f"`, `uci import < "$f" && uci commit`, then `rm -f "$f"`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-openwrt#45