Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check null dereference in DOMCrossSiteScripting #1

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ protected void configure(HttpSecurity http) throws Exception {
.permitAll();
security.and()
.logout().deleteCookies("JSESSIONID").invalidateHttpSession(true);
security.and().csrf().disable();

http.headers().cacheControl().disable();
http.exceptionHandling().authenticationEntryPoint(new AjaxAuthenticationEntryPoint("/login"));
Expand Down Expand Up @@ -97,4 +96,4 @@ protected AuthenticationManager authenticationManager() throws Exception {
public NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ public AttackResult completed(@RequestParam Integer param1,
UserSessionData userSessionData = getUserSessionData();
SecureRandom number = new SecureRandom();
userSessionData.setValue("randValue", String.valueOf(number.nextInt()));

if (param1 == 42 && param2 == 24 && request.getHeader("webgoat-requested-by").equals("dom-xss-vuln")) {
return success(this).output("phoneHome Response is " + userSessionData.getValue("randValue").toString()).build();
if (userSessionData != null && userSessionData.getValue("randValue") != null){
return success(this).output("phoneHome Response is " + userSessionData.getValue("randValue").toString()).build();
}
} else {
return failed(this).build();
}
Comment on lines 46 to 48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build complains here with: "missing return statement". I think this fixes it:

Suggested change
} else {
return failed(this).build();
}
}
return failed(this).build();


}
}
// something like ... http://localhost:8080/WebGoat/start.mvc#test/testParam=foobar&_someVar=234902384lotslsfjdOf9889080GarbageHere%3Cscript%3Ewebgoat.customjs.phoneHome();%3C%2Fscript%3E--andMoreGarbageHere
Expand Down