Skip to content

Commit 8222d2f

Browse files
committed
escape user provided data in browser scripts
1 parent c82266c commit 8222d2f

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

Payload_Types/apfell/mythic/browser_scripts/download.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ function(task, responses){
77
return "<div class='card'><div class='card-header border border-dark shadow'>Finished Downloading <span class='display'>" + escapeHTML(file_name) + "</span>. Click <a href='/api/v1.4/files/download/" + status['agent_file_id'] + "'>here</a> to download</div></div>";
88
}
99
}catch(error){
10-
return "<pre>Error: " + error.toString() + "\n" + JSON.stringify(responses, null, 2) + "</pre>";
10+
return "<pre>Error: " + error.toString() + "\n" + escapeHTML(JSON.stringify(responses, null, 2)) + "</pre>";
1111
}
1212
}
1313
if(task.status === 'error'){
1414
return "<pre> Error: untoggle for error message(s) </pre>";
1515
}
1616
return "<pre> Downloading... </pre>";
17-
}
17+
}

Payload_Types/apfell/mythic/browser_scripts/list_apps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ function(task, response){
2727
});
2828
}
2929
catch(error){
30-
"<pre>Error: " + error.toString() + "\n" + JSON.stringify(response, null, 2) + "</pre>";
30+
"<pre>Error: " + error.toString() + "\n" + escapeHTML(JSON.stringify(response, null, 2)) + "</pre>";
3131
}
3232
}
3333
return support_scripts['apfell_create_table']([{"name":"pid","size":"2em"},{"name":"arch","size":"2em"},{"name":"name", "size":"10em"}, {"name":"frontMost","size":"3em"},{"name":"bin_path","size":"20em"}], rows);
34-
}
34+
}

Payload_Types/apfell/mythic/browser_scripts/screenshot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ function(task, responses){
1111
output += "<div class='response-background card-body' style='padding:0'><img src='/api/v1.4/files/screencaptures/" + escapeHTML(id) + "' width='100%'></div></div></div>";
1212
return output;
1313
}catch(error){
14-
return "<pre>Error: " + error.toString() + "\n" + JSON.stringify(responses, null, 2) + "</pre>";
14+
return "<pre>Error: " + error.toString() + "\n" + escapeHTML(JSON.stringify(responses, null, 2)) + "</pre>";
1515
}
1616
}
1717
if(task.status === 'processing' || task.status === "processed"){
1818
return "<pre> downloading pieces ...</pre>";
1919
}
20-
}
20+
}

Payload_Types/apfell/mythic/browser_scripts/terminals_read.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function(task, responses){
1919
}
2020
}
2121
catch(error){
22-
return "<pre>Error: " + error.toString() + "\n" + JSON.stringify(responses, null, 2) + "</pre>";
22+
return "<pre>Error: " + error.toString() + "\n" + escapeHTML(JSON.stringify(responses, null, 2)) + "</pre>";
2323
}
2424
}
2525
return output;
26-
}
26+
}

Payload_Types/atlas/mythic/browser_scripts/ls.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function(task, response) {
55
var data = JSON.parse(response[i]['response']);
66
} catch (error) {
77
//return error.ToString();
8-
return response;
8+
return escapeHTML(response);
99
}
1010

1111
data.forEach(function (r) {
@@ -27,4 +27,4 @@ function(task, response) {
2727
"name": "Size",
2828
"size": "2em"
2929
}, {"name": "Lastmodified", "size": "3em"}, {"name": "IsDir", "size": "2em"}], rows);
30-
}
30+
}

Payload_Types/atlas/mythic/browser_scripts/ps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function(task, response){
44
try{
55
var data = JSON.parse(response[i]['response']);
66
}catch(error){
7-
return response;
7+
return escapeHTML(response);
88
}
99
data.forEach(function(r){
1010
let row_style = "";
@@ -18,4 +18,4 @@ function(task, response){
1818
});
1919
}
2020
return support_scripts['atlas_create_table']([{"name":"process_id", "size":"10em"},{"name":"parent_process_id", "size":"10em"}, {"name": "user", "size": "10em"},{"name":"path", "size":""}], rows);
21-
}
21+
}

Payload_Types/poseidon/mythic/browser_scripts/list_entitlements.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function(task, responses){
2626
}
2727
}
2828
}
29-
return "<pre>" + JSON.stringify(dict, null, 6) + "</pre>";
29+
return "<pre>" + escapeHTML(JSON.stringify(dict, null, 6)) + "</pre>";
3030
}catch(error){
31-
return "<pre>" + error.toString() + JSON.stringify(responses, null, 6) + "</pre>";
31+
return "<pre>" + error.toString() + escapeHTML(JSON.stringify(responses, null, 6)) + "</pre>";
3232
}
33-
}
33+
}

Payload_Types/poseidon/mythic/browser_scripts/ls.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function(task, responses){
1212
if( !data['is_file'] ){ row_style = "background-color: #5E28DC"}
1313
let row = {"name": escapeHTML(data['name']), "size": escapeHTML(data['size']), "row-style": row_style, "cell-style": {}};
1414
let perm_data = data['permissions'];
15-
row['permissions'] = perm_data["permissions"];
15+
row['permissions'] = escapeHTML(perm_data["permissions"]);
1616
rows.push(row);
1717
if(!data.hasOwnProperty('files')){data['files'] = []}
1818
data['files'].forEach(function(r){
@@ -21,7 +21,7 @@ function(task, responses){
2121
let row = {"name": escapeHTML(r['name']), "size": escapeHTML(r['size']), "row-style": row_style, "cell-style": {}};
2222
let perm_data = r['permissions'];
2323
perm_data = data['permissions'];
24-
row['permissions'] = perm_data["permissions"];
24+
row['permissions'] = escapeHTML(perm_data["permissions"]);
2525
rows.push(row);
2626
});
2727
}
@@ -33,4 +33,4 @@ function(task, responses){
3333
console.log(error);
3434
return "<pre> Error: untoggle for error message(s) </pre>";
3535
}
36-
}
36+
}

Payload_Types/poseidon/mythic/browser_scripts/ps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function(task, response){
55
try{
66
var data = JSON.parse(response[i]['response']);
77
}catch(error){
8-
return response;
8+
return escapeHTML(response);
99
}
1010
data.forEach(function(r){
1111
let row_style = "";
@@ -37,4 +37,4 @@ function(task, response){
3737
{"name":"path", "size":""}
3838
], rows);
3939
return output;
40-
}
40+
}

0 commit comments

Comments
 (0)