GHSL-2020-212: Template injection in Cron-utils - CVE-2020-26238
Cron-Utils' @Cron validator passed the user-supplied cron expression into a Java Bean Validation error message template, which supports Java EL expressions. An attacker who controls the cron expression could therefore inject an EL expression that runs arbitrary Java code.
Originally disclosed on GitHub Security Lab
A Template Injection was identified in Cron-Utils enabling attackers to inject arbitrary Java EL expressions, leading to unauthenticated Remote Code Execution (RCE) vulnerability.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The validator used the untrusted cron expression as the error message template for buildConstraintViolationWithTemplate, which evaluates Java EL expressions.
Impact
This issue leads to Remote Code execution.
What the attacker needed
Application uses @Cron on user-controlled input; Bean Validation with EL enabled
The fix
The issue was fixed in version 9.1.3.
How it was found
- Create a bean with a @Cron-annotated field and set it to a crafted cron expression containing an EL expression.
- Validate the bean with a standard Bean Validation Validator.
- Read the resulting constraint violation message, which shows the EL expression was evaluated.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Cron-Utils is a library that checks whether a cron schedule (like '4 5 * * *') is valid. When it finds an invalid schedule, it puts the user's text into an error message. That error message system can also run small Java expressions, so a crafted schedule can make the server run code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.