Hacking JasperReports – The Hidden Shell Feature By @breenmachine
JasperReports servers were left internet-facing with default administrative credentials, and the report template feature allows uploading a JRXML file that references a custom Java scriptlet. An attacker with admin access could upload a malicious scriptlet JAR and template to run arbitrary code and obtain a reverse shell.
Published on foxglovesecurity.com
A short while ago, my coworkers and I were working on a penetration test for a client with a fairly small Internet facing attack surface. One thing we did find was that they had left a couple of JasperReports servers Internet facing.
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application allowed users with report-editing rights to upload and execute arbitrary Java scriptlets, combined with default administrative credentials on an internet-facing server.
Impact
An attacker with access to the administrative interface could run arbitrary commands on the server and obtain a reverse shell.
What the attacker needed
Internet-facing JasperReports server; default admin credentials; ability to edit reports
How it was found
- Log in to the JasperReports server with the default administrative account.
- Right-click an existing report and choose Edit.
- Under Controls and Resources, add the compiled JAR as a resource named ShellScriptlet.
- Upload the modified JRXML template that references the scriptlet.
- Supply placeholder images for the other referenced resources and submit.
- Start a listener, then run the report to receive the reverse shell.
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 write-up has not been written yet. The Original tab links to the source.
JasperReports is software that builds reports from data using templates. Those templates can call small Java programs called scriptlets, so anyone who can upload a template can make the server run their own code. The servers were reachable from the internet and still used the default admin username and password, which made this easy.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.