forked from frohoff/ysoserial
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed spring, commons-collections4 payloads, made test cases more robust
- Loading branch information
Showing
18 changed files
with
325 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package ysoserial; | ||
|
||
import java.security.Permission; | ||
import java.util.concurrent.Callable; | ||
|
||
public class ExecBlockingSecurityManager extends SecurityManager { | ||
@Override | ||
public void checkPermission(final Permission perm) { } | ||
|
||
@Override | ||
public void checkPermission(final Permission perm, final Object context) { } | ||
|
||
public void checkExec(final String cmd) { | ||
super.checkExec(cmd); | ||
// throw a special exception to ensure we can detect exec() in the test | ||
throw new ExecException(cmd); | ||
}; | ||
|
||
@SuppressWarnings("serial") | ||
public static class ExecException extends RuntimeException { | ||
private final String cmd; | ||
public ExecException(String cmd) { this.cmd = cmd; } | ||
public String getCmd() { return cmd; } | ||
} | ||
|
||
public static void wrap(final Runnable runnable) throws Exception { | ||
wrap(new Callable<Void>(){ | ||
public Void call() throws Exception { | ||
runnable.run(); | ||
return null; | ||
} | ||
}); | ||
} | ||
|
||
public static <T> T wrap(final Callable<T> callable) throws Exception { | ||
SecurityManager sm = System.getSecurityManager(); | ||
System.setSecurityManager(new ExecBlockingSecurityManager()); | ||
try { | ||
return callable.call(); | ||
} finally { | ||
System.setSecurityManager(sm); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/ysoserial/payloads/annotation/Dependencies.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ysoserial.payloads.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Dependencies { | ||
String[] value() default {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.