Expression Language (EL) 삽입
Expression Language (EL) Injection
설명
잠재적 영향
해결 방법
취약한 코드 및 안전한 코드 예시
취약한 코드
import jakarta.el.ExpressionFactory;
import jakarta.el.ValueExpression;
import jakarta.el.VariableMapper;
import jakarta.el.ELContext;
import jakarta.el.StandardELContext;
@RequestMapping("/runCommand")
public class UnsafeELInjection {
public String runCommand(@RequestParam String commandParam) throws IOException {
ExpressionFactory factory = ExpressionFactory.newInstance();
ELContext context = new StandardELContext(factory);
ValueExpression expression = factory.createValueExpression(context, commandParam, Object.class);
Object result = expression.getValue(context); // EL 실행
return result;
}
}안전한 코드
관련 CVE
참조
Last updated