@@ -10,6 +10,8 @@ import (
10
10
)
11
11
12
12
func fasthttpClient () {
13
+ userInput := "user Controlled input"
14
+ userInputByte := []byte ("user Controlled input" )
13
15
// #SSRF
14
16
response , _ := fasthttp .DialDualStack ("127.0.0.1:8909" )
15
17
response , _ = fasthttp .Dial ("google.com:80" )
@@ -18,31 +20,33 @@ func fasthttpClient() {
18
20
resByte := make ([]byte , 1000 )
19
21
_ , _ = response .Read (resByte )
20
22
21
- // #SSRF
22
23
res := & fasthttp.Response {}
23
24
req := & fasthttp.Request {}
25
+ req .SetHost (userInput ) // $ ReqSucc=req ReqPred=userInput
26
+ req .SetHostBytes (userInputByte ) // $ ReqSucc=req ReqPred=userInputByte
27
+ req .SetRequestURI (userInput ) // $ ReqSucc=req ReqPred=userInput
28
+ req .SetRequestURIBytes (userInputByte ) // $ ReqSucc=req ReqPred=userInputByte
29
+
24
30
uri := fasthttp .AcquireURI ()
31
+ userInput = "UserControlled.com:80"
32
+ userInputByte = []byte ("UserControlled.com:80" )
33
+ uri .SetHost (userInput ) // $ UriPred=userInput UriSucc=uri
34
+ uri .SetHostBytes (userInputByte ) // $ UriPred=userInputByte UriSucc=uri
35
+ userInput = "http://UserControlled.com"
36
+ userInputByte = []byte ("http://UserControlled.com" )
37
+ uri .Update (userInput ) // $ UriPred=userInput UriSucc=uri
38
+ uri .UpdateBytes (userInputByte ) // $ UriPred=userInputByte UriSucc=uri
39
+ uri .Parse (userInputByte , userInputByte ) // $ UriPred=userInputByte UriPred=userInputByte UriSucc=uri
40
+ req .SetURI (uri ) // $ ReqSucc=req ReqPred=uri UriSucc=uri
41
+
25
42
fasthttp .Get (resByte , "http://127.0.0.1:8909" ) // $ SSRF="http://127.0.0.1:8909"
26
43
fasthttp .GetDeadline (resByte , "http://127.0.0.1:8909" , time.Time {}) // $ SSRF="http://127.0.0.1:8909"
27
44
fasthttp .GetTimeout (resByte , "http://127.0.0.1:8909" , 5 ) // $ SSRF="http://127.0.0.1:8909"
28
45
fasthttp .Post (resByte , "http://127.0.0.1:8909" , nil ) // $ SSRF="http://127.0.0.1:8909"
29
- fasthttp .Do (req , res ) // $ req=req
30
- fasthttp .DoRedirects (req , res , 2 ) // $ req=req
31
- fasthttp .DoDeadline (req , res , time.Time {}) // $ req=req
32
- fasthttp .DoTimeout (req , res , 5 ) // $ req=req
33
-
34
- // additional steps
35
- uri .SetHost ("UserControlled.com:80" ) // $ URI=uri
36
- uri .SetHostBytes ([]byte ("UserControlled.com:80" )) // $ URI=uri
37
- uri .Update ("http://httpbin.org/ip" ) // $ URI=uri
38
- uri .UpdateBytes ([]byte ("http://httpbin.org/ip" )) // $ URI=uri
39
- uri .Parse (nil , []byte ("http://httpbin.org/ip" )) // $ URI=uri
40
-
41
- req .SetHost ("UserControlled.com:80" ) // $ req=req
42
- req .SetHostBytes ([]byte ("UserControlled.com:80" )) // $ req=req
43
- req .SetRequestURI ("https://UserControlled.com" ) // $ req=req
44
- req .SetRequestURIBytes ([]byte ("https://UserControlled.com" )) // $ req=req
45
- req .SetURI (uri ) // $ req=req URI=uri
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
46
50
47
51
hostClient := & fasthttp.HostClient {
48
52
Addr : "localhost:8080" ,
@@ -51,31 +55,31 @@ func fasthttpClient() {
51
55
hostClient .GetDeadline (resByte , "http://127.0.0.1:8909" , time.Time {}) // $ SSRF="http://127.0.0.1:8909"
52
56
hostClient .GetTimeout (resByte , "http://127.0.0.1:8909" , 5 ) // $ SSRF="http://127.0.0.1:8909"
53
57
hostClient .Post (resByte , "http://127.0.0.1:8909" , nil ) // $ SSRF="http://127.0.0.1:8909"
54
- hostClient .Do (req , res ) // $ req =req
55
- hostClient .DoDeadline (req , res , time.Time {}) // $ req =req
56
- hostClient .DoRedirects (req , res , 2 ) // $ req =req
57
- hostClient .DoTimeout (req , res , 5 ) // $ req =req
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
58
62
59
63
var lbclient fasthttp.LBClient
60
64
lbclient .Clients = append (lbclient .Clients , hostClient )
61
- lbclient .Do (req , res ) // $ req =req
62
- lbclient .DoDeadline (req , res , time.Time {}) // $ req =req
63
- lbclient .DoTimeout (req , res , 5 ) // $ req =req
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
68
65
69
client := fasthttp.Client {}
66
70
client .Get (resByte , "http://127.0.0.1:8909" ) // $ SSRF="http://127.0.0.1:8909"
67
71
client .GetDeadline (resByte , "http://127.0.0.1:8909" , time.Time {}) // $ SSRF="http://127.0.0.1:8909"
68
72
client .GetTimeout (resByte , "http://127.0.0.1:8909" , 5 ) // $ SSRF="http://127.0.0.1:8909"
69
73
client .Post (resByte , "http://127.0.0.1:8909" , nil ) // $ SSRF="http://127.0.0.1:8909"
70
- client .Do (req , res ) // $ req =req SSRF=req
71
- client .DoDeadline (req , res , time.Time {}) // $ req =req SSRF=req
72
- client .DoRedirects (req , res , 2 ) // $ req =req SSRF=req
73
- client .DoTimeout (req , res , 5 ) // $ req =req SSRF=req
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
74
78
75
79
pipelineClient := fasthttp.PipelineClient {}
76
- pipelineClient .Do (req , res ) // $ req =req SSRF=req
77
- pipelineClient .DoDeadline (req , res , time.Time {}) // $ req =req SSRF=req
78
- pipelineClient .DoTimeout (req , res , 5 ) // $ req =req SSRF=req
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
83
80
84
tcpDialer := fasthttp.TCPDialer {}
81
85
tcpDialer .Dial ("127.0.0.1:8909" ) // $ SSRF="127.0.0.1:8909"
0 commit comments