Skip to content

Commit

Permalink
Fix multiple XSS issues in User Management Page (gophish#1547)
Browse files Browse the repository at this point in the history
If the user name is embedding some JS code, it will be executed on the client side. Note: gophish/static/js/dist/app/users.min.js will need to be regenerated too.
  • Loading branch information
dmaciejak authored and jordan-wright committed Aug 24, 2019
1 parent f95e955 commit 24fe998
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions static/js/src/app/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const save = (id) => {
user.id = id
api.userId.put(user)
.success(function (data) {
successFlash(`User ${user.username} updated successfully!`)
successFlash("User " + escapeHtml(user.username) + " updated successfully!")
load()
dismiss()
$("#modal").modal('hide')
Expand All @@ -32,7 +32,7 @@ const save = (id) => {
// to /user
api.users.post(user)
.success(function (data) {
successFlash(`User ${user.username} registered successfully!`)
successFlash("User " + escapeHtml(user.username) + " registered successfully!")
load()
dismiss()
$("#modal").modal('hide')
Expand Down Expand Up @@ -79,7 +79,7 @@ const deleteUser = (id) => {
}
swal({
title: "Are you sure?",
text: `This will delete the account for ${user.username} as well as all of the objects they have created.\n\nThis can't be undone!`,
text: "This will delete the account for " + escapeHtml(user.username) + " as well as all of the objects they have created.\n\nThis can't be undone!",
type: "warning",
animation: false,
showCancelButton: true,
Expand All @@ -101,7 +101,7 @@ const deleteUser = (id) => {
}).then(function () {
swal(
'User Deleted!',
`The user account for ${user.username} and all associated objects have been deleted!`,
"The user account for " + escapeHtml(user.username) + " and all associated objects have been deleted!",
'success'
);
$('button:contains("OK")').on('click', function () {
Expand Down Expand Up @@ -175,4 +175,4 @@ $(document).ready(function () {
$("#userTable").on('click', '.delete_button', function (e) {
deleteUser($(this).attr('data-user-id'))
})
});
});

0 comments on commit 24fe998

Please sign in to comment.