diff --git a/pom.xml b/pom.xml
index b5ad9015d..3259ca38a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -238,7 +238,7 @@
Your support is appreciated
We have charged credit card:" + field1 + "
");
+ cart.append("
We have charged credit card:" + renderedCardNumber + "
");
cart.append(" -------------------
");
cart.append(" $" + totalSale);
@@ -71,9 +81,9 @@ public AttackResult completed(
userSessionData.setValue("xss-reflected1-complete", "false");
}
- if (XSS_PATTERN.test(field1)) {
+ if (XSS_PATTERN.test(renderedCardNumber)) {
userSessionData.setValue("xss-reflected-5a-complete", "true");
- if (field1.toLowerCase().contains("console.log")) {
+ if (renderedCardNumber.toLowerCase().contains("console.log")) {
return success(this)
.feedback("xss-reflected-5a-success-console")
.output(cart.toString())
diff --git a/src/main/resources/webgoat/static/js/goatApp/view/LessonContentView.js b/src/main/resources/webgoat/static/js/goatApp/view/LessonContentView.js
index b998b6bdf..fc86a7ade 100644
--- a/src/main/resources/webgoat/static/js/goatApp/view/LessonContentView.js
+++ b/src/main/resources/webgoat/static/js/goatApp/view/LessonContentView.js
@@ -213,7 +213,11 @@ define(['jquery',
/* for testing */
showTestParam: function (param) {
- this.$el.find('.lesson-content').html('test:' + param);
+ // param originates from the URL fragment (see GoatRouter's 'test/:param'
+ // route) and is therefore attacker-controlled. Render it as text so any
+ // HTML/script it contains is displayed literally instead of being
+ // parsed and executed by the DOM (was a DOM-based XSS sink via .html()).
+ this.$el.find('.lesson-content').text('test:' + param);
},
resetLesson: function () {