Describe the bug
The pattern in Java command injection rule has a common false negative:
import java.lang.Runtime;
class Cls {
public Cls(String input) {
Runtime r = Runtime.getRuntime();
// ruleid: command-injection-formatted-runtime-call
r.exec("/bin/sh -c some_tool" + input); // it is ok
}
}
class Cls {
public Cls(String input) {
Runtime r = Runtime.getRuntime();
// ruleid: command-injection-formatted-runtime-call
r.exec(new String[] {"/bin/sh", "-c", "some_tool", input}); // false negative
}
}
To Reproduce
https://semgrep.dev/playground/s/jxAWY
Expected behavior
A clear and concise description of what you expected to happen.
Priority
How important is this to you?
Additional Context
Add any other context about the problem here.
Describe the bug
The pattern in Java command injection rule has a common false negative:
To Reproduce
https://semgrep.dev/playground/s/jxAWY
Expected behavior
A clear and concise description of what you expected to happen.
Priority
How important is this to you?
Additional Context
Add any other context about the problem here.