Show last authors
1 == General definition ==
2
3 Homoiconicity is the property of a programming language that the code and the data are stored in the same format. For example, the following languages are homoiconics :
4
5 * Lisp : using lists and theirs sub-types
6 * ASM : using bytes stored in memory
7 * XSLT : using the XML format
8
9 In some memory corruption exploits, shellcode is transmitted as data and later executed when the execution flow is altered. This is possible because of homoiconicity. Executing code transmitted as data is sometimes possible with XSLT too.
10
11 == Triggering embedded code ==
12
13 In some contexts (like browsers), XSLT code execution can be triggered while a XML document is parsed, via a xsl:stylesheet tag. The executed XSLT code can be stored on the Internet or in the XML document itself (homoiconicity + self-reference trick). A [[blog post>>http://scarybeastsecurity.blogspot.com/2011/01/harmless-svg-xslt-curiousity.html||rel="__blank"]] by Chris Evans describes a pseudo SVG file triggering a simple RAM DoS . But we can do better ;-)
14
15 == Exploiting via dynamic SVG images ==
16
17 We can create XML files which will be interpreted by browsers like perfectly valid self-contained dynamic SVG images. The SVG image is generated on the fly by the (Turing complete) XSLT engine of the browser and rendered.
18
19 In the following example, the XSLT code will :
20
21 * fingerprint the underlying XSLT engine
22 * draw a circle (red if Webkit, green otherwise)
23 * try to exploit [[CVE-2011-1774>>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-1774||rel="__blank" title="CVE-2011-1774"]] if Webkit is detected
24
25 Screenshot of Opera :
26 [[image:svg-opera-small.png||style="display: block; margin-left: auto; margin-right: auto"]]
27
28 Screenshot of Epiphany :
29 [[image:svg-webkit-small.png||style="display: block; margin-left: auto; margin-right: auto"]]

Welcome

Welcome on the XSLT Hacking Encyclopedia !

You may be interested by the Engines and Applications pages.

Link to the blog
Twitter: @Agarri_FR

Tag Cloud

Unknown macro: tagcloud. Click on this message for details.

Content by Nicolas Grégoire / Agarri
Blog - Follow me @Agarri_FR