@@ -10,6 +10,13 @@ import (
10
10
"github.com/valyala/fasthttp"
11
11
)
12
12
13
+ func source () interface {} {
14
+ return make ([]byte , 1 )
15
+ }
16
+
17
+ func sink (interface {}) {
18
+ }
19
+
13
20
func fasthttpClient () {
14
21
userInput := "127.0.0.1:8909"
15
22
userInputByte := []byte ("user Controlled input" )
@@ -20,33 +27,42 @@ func fasthttpClient() {
20
27
21
28
res := & fasthttp.Response {}
22
29
req := & fasthttp.Request {}
23
- req .SetHost (userInput ) // $ hasTaintFlow="req" ReqPred=userInput
24
- req .SetHostBytes (userInputByte ) // $ hasTaintFlow="req" ReqPred=userInputByte
25
- req .SetRequestURI (userInput ) // $ hasTaintFlow="req" ReqPred=userInput
26
- req .SetRequestURIBytes (userInputByte ) // $ hasTaintFlow="req" ReqPred=userInputByte
30
+ req .SetHost (source ())
31
+ sink (req ) // $ hasTaintFlow="req"
32
+ req .SetHostBytes (userInputByte )
33
+ sink (req ) // $ hasTaintFlow="req"
34
+ req .SetRequestURI (userInput )
35
+ sink (req ) // $ hasTaintFlow="req"
36
+ req .SetRequestURIBytes (userInputByte )
37
+ sink (req ) // $ hasTaintFlow="req"
27
38
28
39
uri := fasthttp .AcquireURI ()
29
40
userInput = "UserControlled.com:80"
30
41
userInputByte = []byte ("UserControlled.com:80" )
31
- uri .SetHost (userInput ) // $ hasTaintFlow="uri"
32
- uri .SetHostBytes (userInputByte ) // $ hasTaintFlow="uri"
42
+ uri .SetHost (source ())
43
+ sink (uri ) // $ hasTaintFlow="uri"
44
+ uri .SetHostBytes (source ())
45
+ sink (uri ) // $ hasTaintFlow="uri"
33
46
userInput = "http://UserControlled.com"
34
47
userInputByte = []byte ("http://UserControlled.com" )
35
- uri .Update (userInput ) // $ hasTaintFlow="uri"
36
- uri .UpdateBytes (userInputByte ) // $ hasTaintFlow="uri"
37
- uri .Parse (userInputByte , userInputByte ) // $ hasTaintFlow="uri"
38
- req .SetURI (uri ) // $ hasTaintFlow="uri" hasTaintFlow="req"
48
+ uri .Update (source ())
49
+ sink (uri ) // $ hasTaintFlow="uri"
50
+ uri .UpdateBytes (source ())
51
+ sink (uri ) // $ hasTaintFlow="uri"
52
+ uri .Parse (source (), source ())
53
+ sink (uri ) // $ hasTaintFlow="uri"
54
+ req .SetURI (uri )
39
55
40
56
resByte := make ([]byte , 1000 )
41
57
userInput = "http://127.0.0.1:8909"
42
58
fasthttp .Get (resByte , userInput ) // $ SsrfSink=userInput
43
59
fasthttp .GetDeadline (resByte , userInput , time.Time {}) // $ SsrfSink=userInput
44
60
fasthttp .GetTimeout (resByte , userInput , 5 ) // $ SsrfSink=userInput
45
61
fasthttp .Post (resByte , userInput , nil ) // $ SsrfSink=userInput
46
- fasthttp .Do (req , res ) // $ hasTaintFlow="req" SsrfSink=req
47
- fasthttp .DoRedirects (req , res , 2 ) // $ hasTaintFlow="req" SsrfSink=req
48
- fasthttp .DoDeadline (req , res , time.Time {}) // $ hasTaintFlow="req" SsrfSink=req
49
- fasthttp .DoTimeout (req , res , 5 ) // $ hasTaintFlow="req" SsrfSink=req
62
+ fasthttp .Do (req , res ) // $ SsrfSink=req
63
+ fasthttp .DoRedirects (req , res , 2 ) // $ SsrfSink=req
64
+ fasthttp .DoDeadline (req , res , time.Time {}) // $ SsrfSink=req
65
+ fasthttp .DoTimeout (req , res , 5 ) // $ SsrfSink=req
50
66
51
67
hostClient := & fasthttp.HostClient {
52
68
Addr : "localhost:8080" ,
@@ -55,31 +71,31 @@ func fasthttpClient() {
55
71
hostClient .GetDeadline (resByte , userInput , time.Time {}) // $ SsrfSink=userInput
56
72
hostClient .GetTimeout (resByte , userInput , 5 ) // $ SsrfSink=userInput
57
73
hostClient .Post (resByte , userInput , nil ) // $ SsrfSink=userInput
58
- hostClient .Do (req , res ) // $ hasTaintFlow="req" SsrfSink=req
59
- hostClient .DoDeadline (req , res , time.Time {}) // $ hasTaintFlow="req" SsrfSink=req
60
- hostClient .DoRedirects (req , res , 2 ) // $ hasTaintFlow="req" SsrfSink=req
61
- hostClient .DoTimeout (req , res , 5 ) // $ hasTaintFlow="req" SsrfSink=req
74
+ hostClient .Do (req , res ) // $ SsrfSink=req
75
+ hostClient .DoDeadline (req , res , time.Time {}) // $ SsrfSink=req
76
+ hostClient .DoRedirects (req , res , 2 ) // $ SsrfSink=req
77
+ hostClient .DoTimeout (req , res , 5 ) // $ SsrfSink=req
62
78
63
79
var lbclient fasthttp.LBClient
64
80
lbclient .Clients = append (lbclient .Clients , hostClient )
65
- lbclient .Do (req , res ) // $ hasTaintFlow="req" SsrfSink=req
66
- lbclient .DoDeadline (req , res , time.Time {}) // $ hasTaintFlow="req" SsrfSink=req
67
- lbclient .DoTimeout (req , res , 5 ) // $ hasTaintFlow="req" SsrfSink=req
81
+ lbclient .Do (req , res ) // $ SsrfSink=req
82
+ lbclient .DoDeadline (req , res , time.Time {}) // $ SsrfSink=req
83
+ lbclient .DoTimeout (req , res , 5 ) // $ SsrfSink=req
68
84
69
85
client := fasthttp.Client {}
70
86
client .Get (resByte , userInput ) // $ SsrfSink=userInput
71
87
client .GetDeadline (resByte , userInput , time.Time {}) // $ SsrfSink=userInput
72
88
client .GetTimeout (resByte , userInput , 5 ) // $ SsrfSink=userInput
73
89
client .Post (resByte , userInput , nil ) // $ SsrfSink=userInput
74
- client .Do (req , res ) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
75
- client .DoDeadline (req , res , time.Time {}) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
76
- client .DoRedirects (req , res , 2 ) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
77
- client .DoTimeout (req , res , 5 ) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
90
+ client .Do (req , res ) // $ SsrfSink=req
91
+ client .DoDeadline (req , res , time.Time {}) // $ SsrfSink=req
92
+ client .DoRedirects (req , res , 2 ) // $ SsrfSink=req
93
+ client .DoTimeout (req , res , 5 ) // $ SsrfSink=req
78
94
79
95
pipelineClient := fasthttp.PipelineClient {}
80
- pipelineClient .Do (req , res ) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
81
- pipelineClient .DoDeadline (req , res , time.Time {}) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
82
- pipelineClient .DoTimeout (req , res , 5 ) // $ hasTaintFlow="req" SsrfSink=req SsrfSink=req
96
+ pipelineClient .Do (req , res ) // $ SsrfSink=req
97
+ pipelineClient .DoDeadline (req , res , time.Time {}) // $ SsrfSink=req
98
+ pipelineClient .DoTimeout (req , res , 5 ) // $ SsrfSink=req
83
99
84
100
tcpDialer := fasthttp.TCPDialer {}
85
101
userInput = "127.0.0.1:8909"
0 commit comments