Linuxfabrik Monitoring Plugins allow insecure creation of SQLite databases
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS 벡터 정보 없음
상세 설명
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.
1# Create the symlink as nagios user 2nagios@test-server:/tmp$ ln -s /root/nagios-was-here /tmp/linuxfabrik-monitoring-plugins-docker-stats.db 3# Trigger the execution nagios user 4nagios@test-server:/tmp$ sudo /usr/lib64/nagios/plugins/docker-statsCheck whether or not file was created.
1root@test-server:/# file /root/nagios-was-here 2/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 2Impact
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:
1# Use os.lstat() instead of os.stat() so we don't accidentally follow symlinks 2dir_stat = os.lstat(TMP_DIR_PATH) 3 4# Ensure the directory is a real dir and not a Symlink 5if not stat.S_ISDIR(dir_stat.st_mode): 6 # abort the execution 7 sys.exit(1) 8 9# Verify the owner10if dir_stat.st_uid != os.getuid():11 # abort the execution12 sys.exit(1)13 14# Verify the permissions15if (dir_stat.st_mode & 0o077) != 0:16 # abort the execution17 sys.exit(1)AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.