Skip to content

Commit

Permalink
WebGoat#359 Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaars committed Jun 12, 2017
1 parent 52a48df commit 99f75a8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 46 deletions.
22 changes: 13 additions & 9 deletions webgoat-lessons/xxe/src/main/resources/html/XXE.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ <h6 class="text-muted time">24 days ago</h6>
</div>
<div class="post-footer">
<div class="input-group">
<input class="form-control" id="commentInputSimple" placeholder="Add a comment"
<input class="form-control input-lg" id="commentInputSimple" placeholder="Add a comment"
type="text"/>
<span class="input-group-addon">
<button id="postCommentSimple" class="fa fa-edit" style="font-size: 20px"></button>
<button id="postCommentSimple" class="btn btn-primary">Submit</button>
</span>
</div>
<ul class="comments-list">
Expand All @@ -80,8 +80,10 @@ <h6 class="text-muted time">24 days ago</h6>
<div class="assignment-success"><i class="fa fa-2 fa-check hidden" aria-hidden="true"></i></div>
<form class="attack-form" accept-charset="UNKNOWN"
method="POST" name="form"
action="/WebGoat/xxe/content-type"
enctype="application/json;charset=UTF-8">
prepareData="contentTypeXXE"
callback="contentTypeXXECallback"
action="xxe/content-type"
contentType="application/json">
<div class="container-fluid">
<div class="panel post">
<div class="post-heading">
Expand All @@ -107,10 +109,10 @@ <h6 class="text-muted time">24 days ago</h6>
</div>
<div class="post-footer">
<div class="input-group">
<input class="form-control" id="commentInputContentType" placeholder="Add a comment"
<input class="form-control input-lg" id="commentInputContentType" placeholder="Add a comment"
type="text"/>
<span class="input-group-addon">
<i id="postCommentContentType" class="fa fa-edit" style="font-size: 20px"></i>
<button id="postCommentContentType" class="btn btn-primary">Submit</button>
</span>
</div>
<ul class="comments-list">
Expand Down Expand Up @@ -143,8 +145,10 @@ <h6 class="text-muted time">24 days ago</h6>
<div class="assignment-success"><i class="fa fa-2 fa-check hidden" aria-hidden="true"></i></div>
<form class="attack-form" accept-charset="UNKNOWN"
method="POST" name="form"
prepareData="blindXXE"
callback="blindXXECallback"
action="/WebGoat/xxe/blind"
enctype="application/json;charset=UTF-8">
contentType="application/xml">
<div class="container-fluid">
<div class="panel post">
<div class="post-heading">
Expand All @@ -170,9 +174,9 @@ <h6 class="text-muted time">24 days ago</h6>
</div>
<div class="post-footer">
<div class="input-group">
<input class="form-control" id="commentInputBlind" placeholder="Add a comment" type="text"/>
<input class="form-control input-lg" id="commentInputBlind" placeholder="Add a comment" type="text"/>
<span class="input-group-addon">
<i id="postCommentBlind" class="fa fa-edit" style="font-size: 20px"></i>
<button id="postCommentBlind" class="btn btn-primary">Submit</button>
</span>
</div>
<ul class="comments-list">
Expand Down
61 changes: 24 additions & 37 deletions webgoat-lessons/xxe/src/main/resources/js/xxe.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,44 @@ webgoat.customjs.simpleXXE = function () {
}

webgoat.customjs.simpleXXECallback = function() {
$("#commentInputBlind").val('');
getComments('#commentsListSimple');
}

$(document).ready(function () {
getComments('#commentsListSimple');
});

webgoat.customjs.blindXXE = function() {
var commentInput = $("#commentInputBlind").val();
var xml = '<?xml version="1.0"?>' +
'<comment>' +
' <text>' + commentInput + '</text>' +
'</comment>';
return xml;
}

webgoat.customjs.blindXXECallback = function() {
$("#commentInputBlind").val('');
getComments('#commentsListBlind');
}

$(document).ready(function () {
$("#postCommentBlind").unbind();
$("#postCommentBlind").on("click", function () {
var commentInput = $("#commentInputBlind").val();
var xml = '<?xml version="1.0"?>' +
'<comment>' +
' <text>' + commentInput + '</text>' +
'</comment>';
$.ajax({
type: 'POST',
url: 'xxe/blind',
data: xml,
contentType: "application/xml",
dataType: 'xml',
complete: function (data) {
$("#commentInputBlind").val('');
getComments('#commentsListBlind')
}
})
});
getComments('#commentsListBlind');
});

$(document).ready(function () {
$("#postCommentContentType").unbind();
$("#postCommentContentType").on("click", function () {
var commentInput = $("#commentInputContentType").val();
$.ajax({
type: 'POST',
url: 'xxe/content-type',
data: JSON.stringify({text: commentInput}),
contentType: "application/json",
dataType: 'xml',
complete: function (data) {
$("#commentInputContentType").val('');
getComments('#commentsListContentType')
}
})
});
webgoat.customjs.contentTypeXXE = function() {
var commentInput = $("#commentInputContentType").val();
return JSON.stringify({text: commentInput});
}

webgoat.customjs.contentTypeXXECallback = function() {
$("#commentInputContentType").val('');
getComments('#commentsListContentType');
});
}

$(document).ready(function () {
getComments();
getComments('#commentsListContentType');
});

var html = '<li class="comment">' +
Expand Down

0 comments on commit 99f75a8

Please sign in to comment.