18
18
19
19
import static com .google .common .truth .extensions .proto .ProtoTruth .assertThat ;
20
20
import static com .google .tsunami .common .data .NetworkEndpointUtils .forHostnameAndPort ;
21
- import static com .google .tsunami .plugins .detectors .rce .TritonInferenceServerRceVulnDetector .*;
21
+ import static com .google .tsunami .plugins .detectors .rce .TritonInferenceServerRceVulnDetector .MODEL_CONFIG ;
22
+ import static com .google .tsunami .plugins .detectors .rce .TritonInferenceServerRceVulnDetector .PYTHON_MODEL ;
23
+ import static com .google .tsunami .plugins .detectors .rce .TritonInferenceServerRceVulnDetector .UPLOAD_CONFIG_PAYLOAD ;
24
+ import static com .google .tsunami .plugins .detectors .rce .TritonInferenceServerRceVulnDetector .UPLOAD_MODEL_PAYLOAD ;
25
+ import static java .nio .charset .StandardCharsets .UTF_8 ;
22
26
23
27
import com .google .common .collect .ImmutableList ;
24
28
import com .google .common .truth .Truth ;
45
49
import java .util .Base64 ;
46
50
import java .util .Objects ;
47
51
import javax .inject .Inject ;
48
-
49
52
import okhttp3 .mockwebserver .Dispatcher ;
50
53
import okhttp3 .mockwebserver .MockResponse ;
51
54
import okhttp3 .mockwebserver .MockWebServer ;
@@ -120,13 +123,13 @@ public void detect_whenVulnerable_returnsVulnerability() throws IOException {
120
123
.setPublisher ("TSUNAMI_COMMUNITY" )
121
124
.setValue ("TritonInferenceServerRce" ))
122
125
.setSeverity (Severity .CRITICAL )
123
- .setTitle (
124
- "This detector checks triton inference server RCE with explicit"
125
- + " model-control option enabled" )
126
+ .setTitle ("Triton Inference Server RCE" )
126
127
.setDescription (
127
- "All versions of triton inference server with the `--model-control"
128
- + " explicit` option and at least one loaded model can be"
129
- + " overwritten by a malicious model and lead to RCE." )
128
+ "This detector checks triton inference server RCE with explicit"
129
+ + " model-control option enabled. \n "
130
+ + "All versions of triton inference server with the"
131
+ + " `--model-control explicit` option allows for loaded models to"
132
+ + " be overwritten by malicious models and lead to RCE." )
130
133
.setRecommendation (
131
134
"don't use `--model-control explicit` option with public access" )
132
135
.addRelatedId (
@@ -177,7 +180,7 @@ public MockResponse dispatch(RecordedRequest request) {
177
180
UPLOAD_CONFIG_PAYLOAD ,
178
181
Base64 .getEncoder ()
179
182
.encodeToString (
180
- String .format (MODEL_CONFIG , "metasploit" ).getBytes ())))
183
+ String .format (MODEL_CONFIG , "metasploit" ).getBytes (UTF_8 ))))
181
184
|| request
182
185
.getBody ()
183
186
.readString (StandardCharsets .UTF_8 )
@@ -186,7 +189,7 @@ public MockResponse dispatch(RecordedRequest request) {
186
189
UPLOAD_MODEL_PAYLOAD ,
187
190
Base64 .getEncoder ()
188
191
.encodeToString (
189
- PYTHON_MODEL .substring (0 , 20 ).getBytes ()))))) {
192
+ PYTHON_MODEL .substring (0 , 20 ).getBytes (UTF_8 )))))) {
190
193
return new MockResponse ().setResponseCode (200 );
191
194
}
192
195
}
0 commit comments