端口安全
一篇老文章,回炉改造一下:端口渗透总结
端口介绍
端口 | 服务 |
---|---|
20 | ftp数据端口 |
21 | ftp控制端口 |
22 | ssh |
23 | telnet |
25 | smtp |
53 | dns |
67-68 | dhcp |
69 | tftp小型文件传输 |
80-89 | Web |
109-110 | pop2、pop3 |
137 | NetBIOS Name Service NetBIOS名称服务 |
139 | NetBIOS Session Service 提供Samba |
143 | imap |
161 | snmp |
210 | Oracle XDB FTP |
389 | ldap |
443 | Web |
465 | smtps |
512-514 | Linux R |
546 | dhcp failover双机热备 |
873 | rsync |
993 | imaps |
995 | pop3s |
1080 | 代理 |
1090-1099 | JBoss |
1158 | Oracle EMCTL |
1352 | Lotus |
1433-1434 | MSSQL |
1521 | Oracle |
2049 | nfs |
2181 | zookeeper |
2222 | ssh |
2888 | zookeeper集群内通讯 |
3306-3308 | MySQL |
3389 | rdp Windows远程连接 |
3700 | GlassFish IIOP |
3888 | zookeeper选举Leader |
4040 | |
4100 | SysBase监听端口 |
4200 | SysBase备份端口 |
4444-4445 | |
4848 | GlassFish控制台 |
5000 | SysBase、DB2 |
5006 | |
5432 | PostgreSQL |
5601 | Kibana |
5632 | PyAnyWhere |
5900-5905 | VNC (最后一位代表桌面ID) |
6379 | Redis |
7001 | WebLogic控制台 |
7077 | |
7180-7182 | |
8000-8099 | Axis2、Tomcat、JBoss、GlassFish、Jenkins、Resin、Jetty、zabbix |
8019 | ZKFC |
8020 | 高可用的HDFS RPC |
8088 | Yarn Web UI |
8480 | |
8485 | JournalNode的RPC |
8888 | Web |
9000 | 非高可用的HDFS RPC |
9080-9090 | WebSphere控制台与应用 |
9083 | Hive metastore默认监听 |
9092 | Kafka集群节点间通信 |
9200 | elasticsearch |
9300 | elasticsearch |
9418 | |
10000 | |
10020 | |
11211 | memcache |
18080 | |
19888 | |
27017 | MongoDB |
50070 | HDFS Web UI |
50010-50090 | Hadoop |
60010 | HBase master的Web UI |
60030 | HBase regionServer的Web UI |
端口扫描
常见的端口扫描列表:
20-25,53,67-69,80-89,109-110,137-139,143,161,210,389,443,465,512-514,546,873,993-995,1080,1090-1099,1158,1352,1433-1434,1521,2049,2181,2222,2888,3306-3308,3389,3690,3700,3888,4040,4100,4200,4444-4445,4848,5000,5006,5432,5601,5632,5900-5905,6379,7001,7077,7180-7182,8000-8099,8480,8485,8888,9000,9080-9090,9092,9200,9300,9418,10000,10020,11211,18080,19888,27017-27019,50010-50090,50470,50475,60000,60010,60020,60030
端口扫描思路
- 主机存活性扫描:利用nmap进行主机存活性探测;
- 存活性主机端口开放扫描:利用masscan对上一步判断存活的主机进行全端口开放性扫描;
- 利用网络服务探测端口:利用如:shodan等网络服务探测主机端口;
- 端口服务扫描:利用nmap对开放的端口进行服务探测;
- 扫描结果入库:对扫描后的结果提取我们需要的字段存入数据库中进行展示;
- 其它方式
主机入侵检测获取端口开放信息:此信息不精致,因为针对外部攻击者主机开放的端口并不一定全部对外开放;
masscan
- ubuntu/debian 安装 masscan
sudo apt-get install git gcc make libpcap-dev
git clone https://github.com/robertdavidgraham/masscan
cd masscan
make
- centos7 安装 masscan
# 下载地址:https://pkgs.org/download/masscan
# 利用下载的RPM包直接进行安装
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/m/masscan-1.0.3-5.el7.x86_64.rpm
yum install libpcap-devel.x86_64 -y
rpm -ivh masscan-1.0.3-5.el7.x86_64.rpm
# yum进行安装
vim /etc/yum.repos.d/nux-misc.repo
[nux-misc]
name=Nux Misc
baseurl=http://li.nux.ro/download/nux/misc/el7/x86_64/
enabled=0
gpgcheck=1
gpgkey=http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
# 安装
yum --enablerepo=nux-misc install masscan
- mac安装masscan
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
brew install masscan
- masscan扫描
def port_masscan():
command = "masscan -p20-25,53,67-69,80-89,109-111,137-139,143,161,210,389,443,465,512-514,546,873,993-995," \
"1080,1090-1099,1158,1352,1433-1434,1521,2049,2181,2222,2888,3306-3308,3389,3690,3700,3888,4040,4100,4200," \
"4444-4445,4848,5000,5006,5432,5601,5632,5900-5905,6379,7001,7077,7180-7182,8000-8099,8480,8485,8888,9000," \
"9080-9090,9092,9200,9300,9418,10000,10020,11211,18080,19888,27017-27019,50010-50090,50470,50475,60000,60010,60020,60030 " \
"--rate=50 -iL tmp/ip_tmp.txt -oX tmp/output.xml "
os.popen(command)
nmap
- centos7安装nmap
yum install nmap.x86_64 -y
- nmap常用命令
nmap -sS -sV -p1-65535 --max-scan-delay 10 --max-retries 2 -T4 --min-rate 300 --open
- nmap扫描
import nmap
nm = nmap.PortScanner()
def port_scan(ip,port):
try:
nm.scan(ip,str(port),arguments='-sV -Pn -T4 --max-rate 1000 --max-retries 1 --max-rtt-timeout 100ms --open')
service = nm[ip]['tcp'][int(port)]['product']
version = nm[ip]['tcp'][int(port)]['version']
print ip,port,service,version
except Exception as e:
print e
zmap
不推荐使用
- centos7安装zmap
yum install zmap.x86_64 -y
端口常见攻击方式
暴力破解法
hydra满足常见的服务暴力破解,但是需要注意的是现在很多服务都默认支持爆破防御。
端口漏洞法
持续更新
端口+服务+版本 | 漏洞详情 |
---|---|