Skip to content

Commit

Permalink
Merge pull request #12 from sip49/pixeebot/drip-2024-01-19-pixee-java…
Browse files Browse the repository at this point in the history
…/harden-xstream

Hardened XStream with a converter to prevent exploitation
  • Loading branch information
sip49 authored Jan 22, 2024
2 parents 44c9b74 + 8f7e6cc commit 3dbc244
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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
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

0 comments on commit 3dbc244

Please sign in to comment.