Skip to content

Commit f2a603f

Browse files
committed
fix: don't report RCE finding if hook is disabled
With this commit no RCE finding will be reported from the jaz.Zer.el() method if the ReflectiveCall sanitizer is not enabled.
1 parent 06ab006 commit f2a603f

File tree

3 files changed

+4
-31
lines changed

3 files changed

+4
-31
lines changed

sanitizers/src/test/java/com/example/DisabledHooksTest.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.example;
1818

1919
import com.code_intelligence.jazzer.api.FuzzerSecurityIssueHigh;
20-
import java.lang.reflect.InvocationTargetException;
2120
import java.io.ByteArrayInputStream;
2221
import java.io.File;
2322
import java.io.IOException;
@@ -34,15 +33,6 @@ public static void triggerReflectiveCallSanitizer() {
3433
}
3534
}
3635

37-
public static void triggerExpressionLanguageInjectionSanitizer() throws Throwable {
38-
try {
39-
Class.forName("jaz.Zer").getMethod("el").invoke(null);
40-
} catch (InvocationTargetException e) {
41-
throw e.getCause();
42-
} catch (IllegalAccessException | ClassNotFoundException | NoSuchMethodException ignore) {
43-
}
44-
}
45-
4636
public static void triggerDeserializationSanitizer() {
4737
byte[] data =
4838
Base64.getDecoder().decode("rO0ABXNyAAdqYXouWmVyAAAAAAAAACoCAAFCAAlzYW5pdGl6ZXJ4cAEK");
@@ -68,11 +58,6 @@ public void enableDeserializationSanitizer() {
6858
triggerDeserializationSanitizer();
6959
}
7060

71-
@Test(expected = FuzzerSecurityIssueHigh.class)
72-
public void enableExpressionLanguageInjectionSanitizer() throws Throwable {
73-
triggerExpressionLanguageInjectionSanitizer();
74-
}
75-
7661
@Test
7762
public void disableReflectiveCallSanitizer() {
7863
System.setProperty(
@@ -87,14 +72,6 @@ public void disableDeserializationSanitizer() {
8772
triggerDeserializationSanitizer();
8873
}
8974

90-
@Test
91-
public void disableExpressionLanguageSanitizer() throws Throwable {
92-
System.setProperty(
93-
"jazzer.disabled_hooks",
94-
"com.code_intelligence.jazzer.sanitizers.ExpressionLanguageInjection");
95-
triggerExpressionLanguageInjectionSanitizer();
96-
}
97-
9875
@Test(expected = FuzzerSecurityIssueHigh.class)
9976
public void disableReflectiveCallAndEnableDeserialization() {
10077
System.setProperty(
@@ -111,7 +88,6 @@ public void disableAllSanitizers() throws Throwable {
11188
+ File.pathSeparatorChar
11289
+ "com.code_intelligence.jazzer.sanitizers.Deserialization");
11390
triggerReflectiveCallSanitizer();
114-
triggerExpressionLanguageInjectionSanitizer();
11591
triggerDeserializationSanitizer();
11692
}
11793
}

src/main/java/jaz/Ter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class Ter implements java.io.Serializable {
2626

2727
public static final byte REFLECTIVE_CALL_SANITIZER_ID = 0;
2828
public static final byte DESERIALIZATION_SANITIZER_ID = 1;
29-
public static final byte EXPRESSION_LANGUAGE_SANITIZER_ID = 2;
3029

3130
private byte sanitizer = REFLECTIVE_CALL_SANITIZER_ID;
3231

src/main/java/jaz/Zer.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public class Zer
7171
// serialized size is 41 bytes
7272
private static final byte REFLECTIVE_CALL_SANITIZER_ID = 0;
7373
private static final byte DESERIALIZATION_SANITIZER_ID = 1;
74-
private static final byte EXPRESSION_LANGUAGE_SANITIZER_ID = 2;
7574

7675
// A byte representing the relevant sanitizer for a given jaz.Zer instance. It is used to check
7776
// whether the corresponding sanitizer is disabled and jaz.Zer will not report a finding in this
@@ -101,11 +100,13 @@ public Zer(byte sanitizer) {
101100
reportFindingIfEnabled();
102101
}
103102

104-
// A special static method that is called by the expression language injection sanitizer. We
103+
// A special static method that is guided to by the expression language injection sanitizer. We
105104
// choose a parameterless method to keep the string that the sanitizer guides the fuzzer to
106105
// generate within the 64-byte boundary required by the corresponding guiding methods.
106+
// A RCE finding is only reported if the ReflectiveCall sanitizer is active to give users a way to
107+
// silence it.
107108
public static void el() {
108-
if (isSanitizerEnabled(EXPRESSION_LANGUAGE_SANITIZER_ID)) {
109+
if (isSanitizerEnabled(REFLECTIVE_CALL_SANITIZER_ID)) {
109110
reportFinding();
110111
}
111112
}
@@ -137,9 +138,6 @@ private static boolean isSanitizerEnabled(byte sanitizerId) {
137138
case DESERIALIZATION_SANITIZER_ID:
138139
sanitizer = "com.code_intelligence.jazzer.sanitizers.Deserialization";
139140
break;
140-
case EXPRESSION_LANGUAGE_SANITIZER_ID:
141-
sanitizer = "com.code_intelligence.jazzer.sanitizers.ExpressionLanguageInjection";
142-
break;
143141
default:
144142
sanitizer = "com.code_intelligence.jazzer.sanitizers.ReflectiveCall";
145143
}

0 commit comments

Comments
 (0)