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

rebase from main #17

Merged
merged 5 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<xstream.version>1.4.5</xstream.version>
<!-- do not update necessary for lesson -->
<zxcvbn.version>1.5.2</zxcvbn.version>
<versions.java-security-toolkit-xstream>1.0.2</versions.java-security-toolkit-xstream>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -248,6 +249,11 @@
<artifactId>jruby</artifactId>
<version>9.3.6.0</version>
</dependency>
<dependency>
<groupId>io.github.pixee</groupId>
<artifactId>java-security-toolkit-xstream</artifactId>
<version>${versions.java-security-toolkit-xstream}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -393,6 +399,10 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.pixee</groupId>
<artifactId>java-security-toolkit-xstream</artifactId>
</dependency>
</dependencies>

<repositories>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/owasp/webgoat/lessons/ssrf/SSRFTask2.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package org.owasp.webgoat.lessons.ssrf;

import io.github.pixee.security.HostValidator;
import io.github.pixee.security.Urls;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
Expand All @@ -48,7 +50,7 @@ public AttackResult completed(@RequestParam String url) {
protected AttackResult furBall(String url) {
if (url.matches("http://ifconfig.pro")) {
String html;
try (InputStream in = new URL(url).openStream()) {
try (InputStream in = Urls.create(url, Urls.HTTP_PROTOCOLS, HostValidator.DENY_COMMON_INFRASTRUCTURE_TARGETS).openStream()) {
html =
new String(in.readAllBytes(), StandardCharsets.UTF_8)
.replaceAll("\n", "<br>"); // Otherwise the \n gets escaped in the response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package org.owasp.webgoat.lessons.vulnerablecomponents;

import com.thoughtworks.xstream.XStream;
import io.github.pixee.security.xstream.HardeningConverter;
import org.apache.commons.lang3.StringUtils;
import org.owasp.webgoat.container.assignments.AssignmentEndpoint;
import org.owasp.webgoat.container.assignments.AssignmentHints;
Expand All @@ -39,6 +40,7 @@ public class VulnerableComponentsLesson extends AssignmentEndpoint {
@PostMapping("/VulnerableComponents/attack1")
public @ResponseBody AttackResult completed(@RequestParam String payload) {
XStream xstream = new XStream();
xstream.registerConverter(new HardeningConverter());
xstream.setClassLoader(Contact.class.getClassLoader());
xstream.alias("contact", ContactImpl.class);
xstream.ignoreUnknownElements();
Expand Down
Loading