Skip to content

Commit 014007c

Browse files
maximthomasvharseko
authored andcommitted
CVE-2026-33439 Pre-Authentication Remote Code Execution via jato.clientSession Deserialization in OpenAM
1 parent ab64ded commit 014007c

2 files changed

Lines changed: 38 additions & 15 deletions

File tree

jato-shaded/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* information: "Portions copyright [year] [name of copyright owner]".
1414
*
1515
* Copyright 2011-2016 ForgeRock AS.
16-
* Portions Copyrighted 2025 3A Systems LLC.
16+
* Portions Copyrighted 2025-2026 3A Systems LLC.
1717
-->
1818
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1919
<modelVersion>4.0.0</modelVersion>
@@ -40,6 +40,11 @@
4040
<artifactId>jato</artifactId>
4141
<version>2005-05-04</version>
4242
</dependency>
43+
<dependency>
44+
<groupId>org.openidentityplatform.openam</groupId>
45+
<artifactId>openam-shared</artifactId>
46+
<scope>provided</scope>
47+
</dependency>
4348
</dependencies>
4449
<build>
4550
<plugins>
@@ -55,6 +60,7 @@
5560
</goals>
5661
<configuration>
5762
<outputDirectory>${project.build.directory}/classes</outputDirectory>
63+
<excludeScope>provided</excludeScope>
5864
</configuration>
5965
</execution>
6066
</executions>

jato-shaded/src/main/java/com/iplanet/jato/util/Encoder.java

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
1+
/*
2+
* The contents of this file are subject to the terms of the Common Development and
3+
* Distribution License (the License). You may not use this file except in compliance with the
4+
* License.
5+
*
6+
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7+
* specific language governing permission and limitations under the License.
8+
*
9+
* When distributing Covered Software, include this CDDL Header Notice in each file and include
10+
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11+
* Header, with the fields enclosed by brackets [] replaced by your own identifying
12+
* information: "Portions copyright [year] [name of copyright owner]".
13+
*
14+
* Copyright 2023-2026 3A Systems LLC.
15+
*/
16+
117
package com.iplanet.jato.util;
218

3-
import java.io.ByteArrayInputStream;
19+
import com.sun.identity.shared.debug.Debug;
20+
import org.forgerock.openam.utils.IOUtils;
21+
422
import java.io.ByteArrayOutputStream;
523
import java.io.IOException;
6-
import java.io.ObjectInputStream;
724
import java.io.ObjectOutputStream;
825
import java.io.Serializable;
926
import java.util.Base64;
27+
import java.util.stream.Collectors;
1028
import java.util.zip.DataFormatException;
1129
import java.util.zip.Deflater;
1230
import java.util.zip.DeflaterOutputStream;
1331
import java.util.zip.Inflater;
14-
import java.util.zip.InflaterInputStream;
1532

1633
public class Encoder {
1734

35+
private final static Debug debug = Debug.getInstance("amConsole");
1836
private Encoder() {
1937
}
2038

@@ -115,18 +133,17 @@ public static byte[] serialize(Serializable o, boolean compress) throws IOExcept
115133
}
116134

117135
public static Object deserialize(byte[] b, boolean compressed) throws IOException, ClassNotFoundException {
118-
ByteArrayInputStream bais = new ByteArrayInputStream(b);
119-
InflaterInputStream iis = null;
120-
ObjectInputStream ois = null;
121-
if (compressed) {
122-
iis = new InflaterInputStream(bais);
123-
ois = new ApplicationObjectInputStream(iis);
124-
} else {
125-
ois = new ApplicationObjectInputStream(bais);
136+
if(debug.messageEnabled()) {
137+
String trace = StackWalker.getInstance()
138+
.walk(frames -> frames
139+
.skip(1).limit(3)
140+
.map(f -> String.format("%s.%s(%s:%d)",
141+
f.getClassName(), f.getMethodName(),
142+
f.getFileName(), f.getLineNumber()))
143+
.collect(Collectors.joining("; ")));
144+
debug.message("Encoder:deserialize callers trace: " + trace);
126145
}
127-
128-
Object result = ois.readObject();
129-
return result;
146+
return IOUtils.deserialise(b, compressed);
130147
}
131148
}
132149

0 commit comments

Comments
 (0)