@@ -10,15 +10,12 @@ import (
10
10
)
11
11
12
12
func fasthttpClient () {
13
- userInput := "user Controlled input "
13
+ userInput := "127.0.0.1:8909 "
14
14
userInputByte := []byte ("user Controlled input" )
15
- // #SSRF
16
- response , _ := fasthttp .DialDualStack ("127.0.0.1:8909" )
17
- response , _ = fasthttp .Dial ("google.com:80" )
18
- response , _ = fasthttp .DialTimeout ("google.com:80" , 5 )
19
- response , _ = fasthttp .DialDualStackTimeout ("google.com:80" , 5 )
20
- resByte := make ([]byte , 1000 )
21
- _ , _ = response .Read (resByte )
15
+ fasthttp .DialDualStack (userInput ) // $ SsrfSink=userInput
16
+ fasthttp .Dial (userInput ) // $ SsrfSink=userInput
17
+ fasthttp .DialTimeout (userInput , 5 ) // $ SsrfSink=userInput
18
+ fasthttp .DialDualStackTimeout (userInput , 5 ) // $ SsrfSink=userInput
22
19
23
20
res := & fasthttp.Response {}
24
21
req := & fasthttp.Request {}
@@ -39,53 +36,56 @@ func fasthttpClient() {
39
36
uri .Parse (userInputByte , userInputByte ) // $ UriPred=userInputByte UriPred=userInputByte UriSucc=uri
40
37
req .SetURI (uri ) // $ ReqSucc=req ReqPred=uri UriSucc=uri
41
38
42
- fasthttp .Get (resByte , "http://127.0.0.1:8909" ) // $ SSRF="http://127.0.0.1:8909"
43
- fasthttp .GetDeadline (resByte , "http://127.0.0.1:8909" , time.Time {}) // $ SSRF="http://127.0.0.1:8909"
44
- fasthttp .GetTimeout (resByte , "http://127.0.0.1:8909" , 5 ) // $ SSRF="http://127.0.0.1:8909"
45
- fasthttp .Post (resByte , "http://127.0.0.1:8909" , nil ) // $ SSRF="http://127.0.0.1:8909"
46
- fasthttp .Do (req , res ) // $ ReqSucc=req
47
- fasthttp .DoRedirects (req , res , 2 ) // $ ReqSucc=req
48
- fasthttp .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req
49
- fasthttp .DoTimeout (req , res , 5 ) // $ ReqSucc=req
39
+ resByte := make ([]byte , 1000 )
40
+ userInput = "http://127.0.0.1:8909"
41
+ fasthttp .Get (resByte , userInput ) // $ SsrfSink=userInput
42
+ fasthttp .GetDeadline (resByte , userInput , time.Time {}) // $ SsrfSink=userInput
43
+ fasthttp .GetTimeout (resByte , userInput , 5 ) // $ SsrfSink=userInput
44
+ fasthttp .Post (resByte , userInput , nil ) // $ SsrfSink=userInput
45
+ fasthttp .Do (req , res ) // $ ReqSucc=req SsrfSink=req
46
+ fasthttp .DoRedirects (req , res , 2 ) // $ ReqSucc=req SsrfSink=req
47
+ fasthttp .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SsrfSink=req
48
+ fasthttp .DoTimeout (req , res , 5 ) // $ ReqSucc=req SsrfSink=req
50
49
51
50
hostClient := & fasthttp.HostClient {
52
51
Addr : "localhost:8080" ,
53
52
}
54
- hostClient .Get (resByte , "http://127.0.0.1:8909" ) // $ SSRF="http://127.0.0.1:8909"
55
- hostClient .GetDeadline (resByte , "http://127.0.0.1:8909" , time.Time {}) // $ SSRF="http://127.0.0.1:8909"
56
- hostClient .GetTimeout (resByte , "http://127.0.0.1:8909" , 5 ) // $ SSRF="http://127.0.0.1:8909"
57
- hostClient .Post (resByte , "http://127.0.0.1:8909" , nil ) // $ SSRF="http://127.0.0.1:8909"
58
- hostClient .Do (req , res ) // $ ReqSucc=req
59
- hostClient .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req
60
- hostClient .DoRedirects (req , res , 2 ) // $ ReqSucc=req
61
- hostClient .DoTimeout (req , res , 5 ) // $ ReqSucc=req
53
+ hostClient .Get (resByte , userInput ) // $ SsrfSink=userInput
54
+ hostClient .GetDeadline (resByte , userInput , time.Time {}) // $ SsrfSink=userInput
55
+ hostClient .GetTimeout (resByte , userInput , 5 ) // $ SsrfSink=userInput
56
+ hostClient .Post (resByte , userInput , nil ) // $ SsrfSink=userInput
57
+ hostClient .Do (req , res ) // $ ReqSucc=req SsrfSink =req
58
+ hostClient .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SsrfSink =req
59
+ hostClient .DoRedirects (req , res , 2 ) // $ ReqSucc=req SsrfSink =req
60
+ hostClient .DoTimeout (req , res , 5 ) // $ ReqSucc=req SsrfSink =req
62
61
63
62
var lbclient fasthttp.LBClient
64
63
lbclient .Clients = append (lbclient .Clients , hostClient )
65
- lbclient .Do (req , res ) // $ ReqSucc=req
66
- lbclient .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req
67
- lbclient .DoTimeout (req , res , 5 ) // $ ReqSucc=req
64
+ lbclient .Do (req , res ) // $ ReqSucc=req SsrfSink=req
65
+ lbclient .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SsrfSink=req
66
+ lbclient .DoTimeout (req , res , 5 ) // $ ReqSucc=req SsrfSink=req
68
67
69
68
client := fasthttp.Client {}
70
- client .Get (resByte , "http://127.0.0.1:8909" ) // $ SSRF="http://127.0.0.1:8909"
71
- client .GetDeadline (resByte , "http://127.0.0.1:8909" , time.Time {}) // $ SSRF="http://127.0.0.1:8909"
72
- client .GetTimeout (resByte , "http://127.0.0.1:8909" , 5 ) // $ SSRF="http://127.0.0.1:8909"
73
- client .Post (resByte , "http://127.0.0.1:8909" , nil ) // $ SSRF="http://127.0.0.1:8909"
74
- client .Do (req , res ) // $ ReqSucc=req SSRF =req
75
- client .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SSRF =req
76
- client .DoRedirects (req , res , 2 ) // $ ReqSucc=req SSRF =req
77
- client .DoTimeout (req , res , 5 ) // $ ReqSucc=req SSRF =req
69
+ client .Get (resByte , userInput ) // $ SsrfSink=userInput
70
+ client .GetDeadline (resByte , userInput , time.Time {}) // $ SsrfSink=userInput
71
+ client .GetTimeout (resByte , userInput , 5 ) // $ SsrfSink=userInput
72
+ client .Post (resByte , userInput , nil ) // $ SsrfSink=userInput
73
+ client .Do (req , res ) // $ ReqSucc=req SsrfSink=req SsrfSink =req
74
+ client .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SsrfSink=req SsrfSink =req
75
+ client .DoRedirects (req , res , 2 ) // $ ReqSucc=req SsrfSink=req SsrfSink =req
76
+ client .DoTimeout (req , res , 5 ) // $ ReqSucc=req SsrfSink=req SsrfSink =req
78
77
79
78
pipelineClient := fasthttp.PipelineClient {}
80
- pipelineClient .Do (req , res ) // $ ReqSucc=req SSRF =req
81
- pipelineClient .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SSRF =req
82
- pipelineClient .DoTimeout (req , res , 5 ) // $ ReqSucc=req SSRF =req
79
+ pipelineClient .Do (req , res ) // $ ReqSucc=req SsrfSink=req SsrfSink =req
80
+ pipelineClient .DoDeadline (req , res , time.Time {}) // $ ReqSucc=req SsrfSink=req SsrfSink =req
81
+ pipelineClient .DoTimeout (req , res , 5 ) // $ ReqSucc=req SsrfSink=req SsrfSink =req
83
82
84
83
tcpDialer := fasthttp.TCPDialer {}
85
- tcpDialer .Dial ("127.0.0.1:8909" ) // $ SSRF="127.0.0.1:8909"
86
- tcpDialer .DialTimeout ("127.0.0.1:8909" , 5 ) // $ SSRF="127.0.0.1:8909"
87
- tcpDialer .DialDualStack ("127.0.0.1:8909" ) // $ SSRF="127.0.0.1:8909"
88
- tcpDialer .DialDualStackTimeout ("127.0.0.1:8909" , 5 ) // $ SSRF="127.0.0.1:8909"
84
+ userInput = "127.0.0.1:8909"
85
+ tcpDialer .Dial (userInput ) // $ SsrfSink=userInput
86
+ tcpDialer .DialTimeout (userInput , 5 ) // $ SsrfSink=userInput
87
+ tcpDialer .DialDualStack (userInput ) // $ SsrfSink=userInput
88
+ tcpDialer .DialDualStackTimeout (userInput , 5 ) // $ SsrfSink=userInput
89
89
}
90
90
91
91
func main () {
0 commit comments