linux提权总结

ernel, Operating System & Device Information:

CommandResult
uname -aPrint all available system information
uname -rKernel release
uname -nSystem hostname
hostnameAs above
uname -mLinux kernel architecture (32 or 64 bit)
cat /proc/versionKernel information
cat /etc/*-releaseDistribution information
cat /etc/issueAs above
cat /proc/cpuinfoCPU information
df -aFile system information

 

Users & Groups:

CommandResult
cat /etc/passwdList all users on the system
cat /etc/groupList all groups on the system
for i in $(cat /etc/passwd 2>/dev/null| cut -d":" -f1 2>/dev/null);do id $i;done 2>/dev/nullList all uid’s and respective group memberships
cat /etc/shadowShow user hashes – Privileged command
grep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}'List all super user accounts
fingerUsers currently logged in
pinkyAs above
usersAs above
who -aAs above
wWho is currently logged in and what they’re doing
lastListing of last logged on users
lastlogInformation on when all users last logged in
lastlog –u %username%Information on when the specified user last logged in
lastlog |grep -v "Never"Entire list of previously logged on users

 

User & Privilege Information:

CommandResult
whoamiCurrent username
idCurrent user information
cat /etc/sudoersWho’s allowed to do what as root – Privileged command
sudo -lCan the current user perform anything as root
sudo -l 2>/dev/null | grep -w 'nmap\|perl\|'awk'\|'find'\|'bash'\|'sh'\|'man'\
|'more'\|'less'\|'vi'\|'vim'\|'nc'\|'netcat'\|python\
|ruby\|lua\|irb' | xargs -r ls -la 2>/dev/null
Can the current user run any ‘interesting’ binaries as root and if so also display the binary permissions etc.

 

Environmental Information:

CommandResult
envDisplay environmental variables
setAs above
echo $PATHPath information
historyDisplays command history of current user
pwdPrint working directory, i.e. ‘where am I’
cat /etc/profileDisplay default system variables
cat /etc/shellsDisplay available shells

 

Interesting Files:

CommandResult
find / -perm -4000 -type f 2>/dev/nullFind SUID files
find / -uid 0 -perm -4000 -type f 2>/dev/nullFind SUID files owned by root
find / -perm -2000 -type f 2>/dev/nullFind GUID files
find / -perm -2 -type f 2>/dev/nullFind world-writeable files
find / ! -path "*/proc/*" -perm -2 -type f -print 2>/dev/nullFind world-writeable files excluding those in /proc
find / -perm -2 -type d 2>/dev/nullFind word-writeable directories
find /home –name *.rhosts -print 2>/dev/nullFind rhost config files
find /home -iname *.plan -exec ls -la {} \; -exec cat {} 2>/dev/null \;Find *.plan files, list permissions and cat the file contents
find /etc -iname hosts.equiv -exec ls -la {} 2>/dev/null \; -exec cat {} 2>/dev/null \;Find hosts.equiv, list permissions and cat the file contents
ls -ahlR /root/See if you can access other user directories to find interesting files
cat ~/.bash_historyShow the current users’ command history
ls -la ~/.*_historyShow the current users’ various history files
ls -la /root/.*_historyCan we read root’s history files
ls -la ~/.ssh/Check for interesting ssh files in the current users’ directory
find / -name "id_dsa*" -o -name "id_rsa*" -o -name "known_hosts" -o -name "authorized_hosts" -o -name "authorized_keys" 2>/dev/null |xargs -r ls -laFind SSH keys/host information
ls -la /usr/sbin/in.*Check Configuration of inetd services
grep -l -i pass /var/log/*.log 2>/dev/nullCheck log files for keywords (‘pass’ in this example) and show positive matches
find /var/log -type f -exec ls -la {} \; 2>/dev/nullList files in specified directory (/var/log)
find /var/log -name *.log -type f -exec ls -la {} \; 2>/dev/nullList .log files in specified directory (/var/log)
find /etc/ -maxdepth 1 -name *.conf -type f -exec ls -la {} \; 2>/dev/nullList .conf files in /etc (recursive 1 level)
ls -la /etc/*.confAs above
find / -maxdepth 4 -name *.conf -type f -exec grep -Hn password {} \; 2>/dev/nullFind .conf files (recursive 4 levels) and output line number where the word ‘password’ is located
lsof -i -nList open files (output will depend on account privileges)
head /var/mail/rootCan we read roots mail

 

Service Information:

CommandResult
ps aux | grep rootView services running as root
ps aux | awk '{print $11}'|xargs -r ls -la 2>/dev/null |awk '!x[$0]++'Lookup process binary path and permissions
cat /etc/inetd.confList services managed by inetd
cat /etc/xinetd.confAs above for xinetd
cat /etc/xinetd.conf 2>/dev/null | awk '{print $7}' |xargs -r ls -la 2>/dev/nullA very ‘rough’ command to extract associated binaries from xinetd.conf and show permissions of each
ls -la /etc/exports 2>/dev/null; cat /etc/exports 2>/dev/nullPermissions and contents of /etc/exports (NFS)

 

Jobs/Tasks:

CommandResult
crontab -l -u %username%Display scheduled jobs for the specified user – Privileged command
ls -la /etc/cron*Scheduled jobs overview (hourly, daily, monthly etc)
ls -aRl /etc/cron* | awk '$1 ~ /w.$/' 2>/dev/nullWhat can ‘others’ write in /etc/cron* directories
topList of current tasks

 

Networking, Routing & Communications:

CommandResult
/sbin/ifconfig -aList all network interfaces
cat /etc/network/interfacesAs above
arp -aDisplay ARP communications
routeDisplay route information
cat /etc/resolv.confShow configured DNS sever addresses
netstat -antpList all TCP sockets and related PIDs (-p Privileged command)
netstat -anupList all UDP sockets and related PIDs (-p Privileged command)
iptables -LList rules – Privileged command
cat /etc/servicesView port numbers/services mappings

 

Programs Installed:

CommandResult
dpkg -lInstalled packages (Debian)
rpm -qaInstalled packages (Red Hat)
sudo -VSudo version – does an exploit exist?
httpd -vApache version
apache2 -vAs above
apache2ctl (or apachectl) -MList loaded Apache modules
mysql --versionInstalled MYSQL version details
psql -VInstalled Postgres version details
perl -vInstalled Perl version details
java -versionInstalled Java version details
python --versionInstalled Python version details
ruby -vInstalled Ruby version details
find / -name %program_name% 2>/dev/null (i.e. nc, netcat, wget, nmap etc)Locate ‘useful’ programs (netcat, wget etc)
which %program_name% (i.e. nc, netcat, wget, nmap etc)As above
dpkg --list 2>/dev/null| grep compiler |grep -v decompiler 2>/dev/null && yum list installed 'gcc*' 2>/dev/null| grep gcc 2>/dev/nullList available compilers
cat /etc/apache2/envvars 2>/dev/null |grep -i 'user\|group' |awk '{sub(/.*\export /,"")}1'Which account is Apache running as

 

Common Shell Escape Sequences:

CommandProgram(s)
:!bashvi, vim
:set shell=/bin/bash:shellvi, vim
!bashman, more, less
find / -exec /usr/bin/awk 'BEGIN {system("/bin/bash")}' \; find
awk 'BEGIN {system("/bin/bash")}'awk
--interactivenmap
perl -e 'exec "/bin/bash";'Perl

转载自:http://www.rebootuser.com/?p=1623#.VzPhuda1nCI

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值