rpm-software-management / rpm

The RPM package manager
http://rpm.org
Other
494 stars 360 forks source link

Make 'rpm -V' more resistent against rpmdb manipulations #196

Closed robert-scheck closed 4 years ago

robert-scheck commented 7 years ago

https://github.com/x0rz/EQGRP/blob/33810162273edda807363237ef7e7c5ece3e4100/Linux/doc/old/etc/user.mission.generic.COMMON.old refers to "DIZZYTACHOMETER", which is a tool to manipulate the rpmdb in order to avoid rpm -V reporting manipulated/changed/replaced binaries/files of installed RPM packages. While this is indeed nothing really new (on a technical level, didn't personally see such a tool described in the wild), it still would be IMHO handy to make rpm -V in the future more resistent against rpmdb manipulations – however that would finally look like.

robert-scheck commented 7 years ago

Hmmm ... its not clear what exploit is used (from just reading the file at the URL you gave).

I think "DIZZYTACHOMETER" doesn't exploit anything itself, but is just hiding e.g. a rootkit installation by manipulating the rpmdb based on already existing write permissions gained before. I didn't find the binary nor any source for "DIZZYTACHOMETER", but the way of usage makes me assuming "regular" rpmdb manipulations, not a RPM related security flaw.

The provision in RPM for careful rootkit forensics is to use "rpm -Vp ..." from a CDROM (or other offline/immutable media).

Immutable media…something that is harder and harder to get when looking to Fedora or RHEL (last with CDN). Sometimes (e.g. at EPEL as 3rd party repository) the RPM package has been already orphaned and thus removed from the repository when it comes to a verification case.

This isn't an easy problem to solve.

Right, and I don't expect a quick solution. Just wild ideas: Blockchains for rpmdb? Optionally trusted (digital) timestamping for rpmdb? But yes, maybe also a further verification tool that somehow handles the situation that offline media is going away. I do not have a specific idea how this could be solved, finally.

ffesti commented 4 years ago

There is not much one can do on a compromised system as even the tools themselves may be compromised. But there is support for Integrity Measurement Architecture (IMA) and the Linux Extended Verification Module (EVM) in rpm since 4.13 which puts signatures to the security.ima extended file attribute of all (non config) files. Together with storing the keys in the TPM and checking the kernel signature at boot time this much better than anything RPM can hope to achieve with software only.

Closing.

pmatilai commented 4 years ago

Just FWIW, #811 is also a step into this direction.