Skip to content

Commit ec6186a

Browse files
Draft of tests for RmiUnsafeDeserialization.ql
1 parent efa4b4f commit ec6186a

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

java/ql/test/experimental/query-tests/security/CWE-502/RmiUnsafeDeserialization.expected

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.rmi.Naming;
2+
import java.rmi.Remote;
3+
import java.rmi.RemoteException;
4+
import java.rmi.registry.LocateRegistry;
5+
import java.rmi.registry.Registry;
6+
7+
public class RmiUnsafeDeserialization {
8+
9+
// BAD (bind a remote object that has a vulnerable method that takes Object)
10+
public static void testRegistryBindWithObjectParameter() throws Exception {
11+
Registry registry = LocateRegistry.createRegistry(1099);
12+
registry.bind("test", new RemoteObjectWithObject());
13+
}
14+
}
15+
16+
interface RemoteObjectWithObjectInterface extends Remote {
17+
18+
void take(Object obj) throws RemoteException;
19+
}
20+
21+
class RemoteObjectWithObject implements RemoteObjectWithObjectInterface {
22+
23+
public void take(Object obj) throws RemoteException {}
24+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
experimental/Security/CWE/CWE-502/RmiUnsafeDeserialization.ql

0 commit comments

Comments
 (0)