Closed MrSorcus closed 5 years ago
FWIW, using coreutils.override { singleBinary = false; }
fixes a number of those tools being detected as 'INFECTED'.
I think in general this tool is not particularly suited for NixOS as-is, interpret the results with copious quantities of salt :).
Using #33152 and this nix expression:
(modify local path to an appropriate location)
with import /home/will/nixpkgs {};
mkShell {
nativeBuildInputs = [
(coreutils.override { singleBinary = false; })
binutils
chkrootkit
];
}
Results in much better output. Also, consider using the -q flag to be less noisy:
$ cd /path/containing/above/default-dot-nix
$ sudo nix-shell
$ chkrootkit -q
This is a false-positive based on some strings found in the inspected binary.
Looking at chkrootkit
source the check for 'basename' is:
chk_basename () {
STATUS=${NOT_INFECTED}
CMD=`loc basename basename $pth`
if [ "${EXPERT}" = "t" ]; then
expertmode_output "${strings} -a ${CMD}"
expertmode_output "${ls} -l ${CMD}"
return 5
fi
if ${strings} -a ${CMD} | ${egrep} "${GENERIC_ROOTKIT_LABEL}" > /dev/null 2>&1
then
STATUS=${INFECTED}
fi
[ "$SYSTEM" != "OSF1" ] &&
{
if ${ls} -l ${CMD} | ${egrep} "^...s" > /dev/null 2>&1
then
STATUS=${INFECTED}
fi
}
return ${STATUS}
}
where
# Many trojaned commands have this label
GENERIC_ROOTKIT_LABEL="^/bin/.*sh$|bash|elite$|vejeta|\.ark|iroffer"
And since
$ strings /nix/store/y9kxbzvm78zzc9ab3i3rmlxlkgnd7bcw-coreutils-8.30/bin/basename | egrep '/bin/sh'
/bin/sh
If no command is given, run '"$SHELL" -i' (default: '/bin/sh -i').
chkrootkit considers basename as 'infected' (ie here it just means it contains the '/bin/sh' string somewhere in the coreutils binary).
Issue description
Why there is some packages has
INFECTED
? I think that is because some binaries patched for correct working with nix-store, but i'm not sure...Steps to reproduce
# chkrootkit
Technical details
"x86_64-linux"
Linux 4.9.71, NixOS, 17.09.2476.53e6d671a96 (Hummingbird)
yes
yes
nix-env (Nix) 1.11.16
"nixos-17.09.2476.53e6d671a96"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs