-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MVELRule Remote Code Execution #419
Comments
It's a limitation of mvel expression language. |
Hi! Do you have an update on this, is there a workaround or fix for this? |
Do we have any workaround to fix the vulnerability ? |
If you don't need new features 4.1.0, just downgrade to 4.0.0, it is a safe version with only a irrelevant vulnerability in |
Today a customer of ours (Veracode Application Security Consulting) ran into this vulnerability and asked us to help review as Veracode Software Composition Analysis (SCA) was blocking their release. Veracode SCA ( https://sca.analysiscenter.veracode.com/vulnerability-database/security/remote-code-execution/java/sid-44914/summary ) includes earlier versions as the same functionality is also present in versions (we tracked Reviewing this vulnerability I would agree with @dvgaba , this is a 'limitation' or 'feature' of MVEL. Perhaps @fmbenhassine could consider restricting the class loader by default to not load any classes? In my testing the below stopped the vulnerability: import org.jeasy.rules.mvel.MVELRule;
import org.mvel2.ParserConfiguration;
import org.mvel2.ParserContext;
public class App
{
public static class RefusingClassLoader extends ClassLoader {
public RefusingClassLoader() {
super();
}
public RefusingClassLoader(ClassLoader parent) {
super(parent);
}
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
throw new ClassNotFoundException("Class loading is disabled by RefusingClassLoader: " + name);
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
throw new ClassNotFoundException("Class loading is disabled by RefusingClassLoader: " + name);
}
}
public static void main( String[] args )
{
try {
ParserConfiguration config = new ParserConfiguration();
config.setClassLoader(new RefusingClassLoader());
MVELRule mVELRule = new MVELRule(new ParserContext(config));
mVELRule.then("import Zer;");
System.out.println( "mVELRule executed!" );
} catch (Exception e) {
System.out.print(e);
}
System.out.println( "Hello World!" );
}
} For my customer I recommended 2 things:
|
easy-rules-mvel version: 4.1.0
I have run code like:
Meanwhile I hava class
jaz.Zer
in classpath, which content is:On Windows platform, above code will open my PC's calculator
Additional:
MVELRule.when
also leads to this RCEThe text was updated successfully, but these errors were encountered: