### Summary The SQLite databases are created at predictable (static) paths in `/tmp`. Any user can therefore create a symlink at these paths in /tmp pointing to arbitrary files. The monitoring scripts then follows these symlinks and then creates their database at the symlink target. This becomes really dangerous for the scripts which can be executed as root with sudo. With this, an attacker can write to abitrary paths. ### PoC The docker-stats check command here as an example. Because writing to /tmp is the default behaviour, the other check commands which use a SQLite database are also very likely affected. ``` # Create the symlink as nagios user nagios@test-server:/tmp$ ln -s /root/nagios-was-here /tmp/linuxfabrik-monitoring-plugins-docker-stats.db # Trigger the execution nagios user nagios@test-server:/tmp$ sudo /usr/lib64/nagios/plugins/docker-stats ``` Check whether or not file was created. ``` root@test-server:/# file /root/nagios-was-here /root/nagios-was-here: SQLite 3.x database, last written using SQLite version 3046001, file counter 2, database pages 3, cookie 0x2, schema 4, UTF-8, version-valid-for 2 ``` ### Impact In it's basic form, this vulnerbility can lead to a denial of service, impacting users who use the provided sudoers file and who didn't take any special precautions like systemd's `PrivateTemp`. It requires that an attacker already compromised the nagios account (which is quite a high barrier to be honest). If any application on the server relies on a SQLite database, there are scenarios where this vulnerability allows for content in existing SQLite databases to be modified. An attacker could let the symlink point to an existing SQLite database and create in /tmp a specially-crafted SQLite Rollback Journal (`.db-journal`) or Write-Ahead-Log (`.db-wal`), which is then applied to the database. ### Fix A proposed fix would be to create a separate directory inside /tmp per user (e.g.,` /tmp/linuxfabrik-monitoring-plugins-{os.geteuid()}`). After creating this directory (or using an already existing one), check the following: ``` # Use os.lstat() instead of os.stat() so we don't accidentally follow symlinks dir_stat = os.lstat(TMP_DIR_PATH) # Ensure the directory is a real dir and not a Symlink if not stat.S_ISDIR(dir_stat.st_mode): # abort the execution sys.exit(1) # Verify the owner if dir_stat.st_uid != os.getuid(): # abort the execution sys.exit(1) # Verify the permissions if (dir_stat.st_mode & 0o077) != 0: # abort the execution sys.exit(1) ```
### Summary The SQLite databases are created at predictable (static) paths in `/tmp`. Any user can therefore create a symlink at these paths in /tmp pointing to arbitrary files. The monitoring scripts then follows these symlinks and then creates their database at the symlink target. This becomes really dangerous for the scripts which can be executed as root with sudo. With this, an attacker can write to abitrary paths. ### PoC The docker-stats check command here as an example. Because writing to /tmp is the default behaviour, the other check commands which use a SQLite database are also very likely affected. ``` # Create the symlink as nagios user nagios@test-server:/tmp$ ln -s /root/nagios-was-here /tmp/linuxfabrik-monitoring-plugins-docker-stats.db # Trigger the execution nagios user nagios@test-server:/tmp$ sudo /usr/lib64/nagios/plugins/docker-stats ``` Check whether or not file was created. ``` root@test-server:/# file /root/nagios-was-here /root/nagios-was-here: SQLite 3.x database, last written using SQLite version 3046001, file counter 2, database pages 3, cookie 0x2, schema 4, UTF-8, version-valid-for 2 ``` ### Impact In it's basic form, this vulnerbility can lead to a denial of service, impacting users who use the provided sudoers file and who didn't take any special precautions like systemd's `PrivateTemp`. It requires that an attacker already compromised the nagios account (which is quite a high barrier to be honest). If any application on the server relies on a SQLite database, there are scenarios where this vulnerability allows for content in existing SQLite databases to be modified. An attacker could let the symlink point to an existing SQLite database and create in /tmp a specially-crafted SQLite Rollback Journal (`.db-journal`) or Write-Ahead-Log (`.db-wal`), which is then applied to the database. ### Fix A proposed fix would be to create a separate directory inside /tmp per user (e.g.,` /tmp/linuxfabrik-monitoring-plugins-{os.geteuid()}`). After creating this directory (or using an already existing one), check the following: ``` # Use os.lstat() instead of os.stat() so we don't accidentally follow symlinks dir_stat = os.lstat(TMP_DIR_PATH) # Ensure the directory is a real dir and not a Symlink if not stat.S_ISDIR(dir_stat.st_mode): # abort the execution sys.exit(1) # Verify the owner if dir_stat.st_uid != os.getuid(): # abort the execution sys.exit(1) # Verify the permissions if (dir_stat.st_mode & 0o077) != 0: # abort the execution sys.exit(1) ```
Update linuxfabrik-lib to 4.2.0 if you use the affected versions. Test the change in a non-production environment first.
Local check
hol-guard supply-chain scanLinuxfabrik Monitoring Plugins allow insecure creation of SQLite databases affects linuxfabrik-lib (pip). Severity is low. ### Summary The SQLite databases are created at predictable (static) paths in `/tmp`. Any user can therefore create a symlink at these paths in /tmp pointing to arbitrary files. The monitoring scripts then follows these symlinks and then creates their database at the symlink target. This becomes really dangerous for the scripts which can be executed as root with sudo. With this, an attacker can write to abitrary paths. ### PoC The docker-stats check command here as an example. Because writing to /tmp is the default behaviour, the other check commands which use a SQLite database are also very likely affected. ``` # Create the symlink as nagios user nagios@test-server:/tmp$ ln -s /root/nagios-was-here /tmp/linuxfabrik-monitoring-plugins-docker-stats.db # Trigger the execution nagios user nagios@test-server:/tmp$ sudo /usr/lib64/nagios/plugins/docker-stats ``` Check whether or not file was created. ``` root@test-server:/# file /root/nagios-was-here /root/nagios-was-here: SQLite 3.x database, last written using SQLite version 3046001, file counter 2, database pages 3, cookie 0x2, schema 4, UTF-8, version-valid-for 2 ``` ### Impact In it's basic form, this vulnerbility can lead to a denial of service, impacting users who use the provided sudoers file and who didn't take any special precautions like systemd's `PrivateTemp`. It requires that an attacker already compromised the nagios account (which is quite a high barrier to be honest). If any application on the server relies on a SQLite database, there are scenarios where this vulnerability allows for content in existing SQLite databases to be modified. An attacker could let the symlink point to an existing SQLite database and create in /tmp a specially-crafted SQLite Rollback Journal (`.db-journal`) or Write-Ahead-Log (`.db-wal`), which is then applied to the database. ### Fix A proposed fix would be to create a separate directory inside /tmp per user (e.g.,` /tmp/linuxfabrik-monitoring-plugins-{os.geteuid()}`). After creating this directory (or using an already existing one), check the following: ``` # Use os.lstat() instead of os.stat() so we don't accidentally follow symlinks dir_stat = os.lstat(TMP_DIR_PATH) # Ensure the directory is a real dir and not a Symlink if not stat.S_ISDIR(dir_stat.st_mode): # abort the execution sys.exit(1) # Verify the owner if dir_stat.st_uid != os.getuid(): # abort the execution sys.exit(1) # Verify the permissions if (dir_stat.st_mode & 0o077) != 0: # abort the execution sys.exit(1) ```
AI coding agents often install or upgrade packages automatically in pip. A low vulnerability in a dependency can be pulled into a project through a normal install or update without a human reviewing the change, expanding the blast radius from a single package to every agent workspace that depends on it.
| Package | Affected range | Fixed version |
|---|---|---|
| linuxfabrik-libpip | <4.2.0 | 4.2.0 |
Fixed versions are reported by the source feed; confirm compatibility before updating.
Reported by GitHub Security Advisories (ghsa).
HOL Guard can help your team review package activity against supported protection paths.
Explore HOL GuardUpdate linuxfabrik-lib to 4.2.0 if you use the affected versions. Test the change in a non-production environment first.
Local check
hol-guard supply-chain scanLinuxfabrik Monitoring Plugins allow insecure creation of SQLite databases affects linuxfabrik-lib (pip). Severity is low. ### Summary The SQLite databases are created at predictable (static) paths in `/tmp`. Any user can therefore create a symlink at these paths in /tmp pointing to arbitrary files. The monitoring scripts then follows these symlinks and then creates their database at the symlink target. This becomes really dangerous for the scripts which can be executed as root with sudo. With this, an attacker can write to abitrary paths. ### PoC The docker-stats check command here as an example. Because writing to /tmp is the default behaviour, the other check commands which use a SQLite database are also very likely affected. ``` # Create the symlink as nagios user nagios@test-server:/tmp$ ln -s /root/nagios-was-here /tmp/linuxfabrik-monitoring-plugins-docker-stats.db # Trigger the execution nagios user nagios@test-server:/tmp$ sudo /usr/lib64/nagios/plugins/docker-stats ``` Check whether or not file was created. ``` root@test-server:/# file /root/nagios-was-here /root/nagios-was-here: SQLite 3.x database, last written using SQLite version 3046001, file counter 2, database pages 3, cookie 0x2, schema 4, UTF-8, version-valid-for 2 ``` ### Impact In it's basic form, this vulnerbility can lead to a denial of service, impacting users who use the provided sudoers file and who didn't take any special precautions like systemd's `PrivateTemp`. It requires that an attacker already compromised the nagios account (which is quite a high barrier to be honest). If any application on the server relies on a SQLite database, there are scenarios where this vulnerability allows for content in existing SQLite databases to be modified. An attacker could let the symlink point to an existing SQLite database and create in /tmp a specially-crafted SQLite Rollback Journal (`.db-journal`) or Write-Ahead-Log (`.db-wal`), which is then applied to the database. ### Fix A proposed fix would be to create a separate directory inside /tmp per user (e.g.,` /tmp/linuxfabrik-monitoring-plugins-{os.geteuid()}`). After creating this directory (or using an already existing one), check the following: ``` # Use os.lstat() instead of os.stat() so we don't accidentally follow symlinks dir_stat = os.lstat(TMP_DIR_PATH) # Ensure the directory is a real dir and not a Symlink if not stat.S_ISDIR(dir_stat.st_mode): # abort the execution sys.exit(1) # Verify the owner if dir_stat.st_uid != os.getuid(): # abort the execution sys.exit(1) # Verify the permissions if (dir_stat.st_mode & 0o077) != 0: # abort the execution sys.exit(1) ```
AI coding agents often install or upgrade packages automatically in pip. A low vulnerability in a dependency can be pulled into a project through a normal install or update without a human reviewing the change, expanding the blast radius from a single package to every agent workspace that depends on it.
| Package | Affected range | Fixed version |
|---|---|---|
| linuxfabrik-libpip | <4.2.0 | 4.2.0 |
Fixed versions are reported by the source feed; confirm compatibility before updating.
Reported by GitHub Security Advisories (ghsa).
HOL Guard can help your team review package activity against supported protection paths.
Explore HOL Guard