# XSLT Server Side Injection (Extensible Stylesheet Languaje Transformations) {% hint style="success" %} AWS Hacking'i öğrenin ve pratik yapın:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ GCP Hacking'i öğrenin ve pratik yapın: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
HackTricks'i Destekleyin * [**abonelik planlarını**](https://github.com/sponsors/carlospolop) kontrol edin! * **💬 [**Discord grubuna**](https://discord.gg/hRep4RUj7f) veya [**telegram grubuna**](https://t.me/peass) katılın ya da **Twitter'da** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)** bizi takip edin.** * **Hacking ipuçlarını paylaşmak için** [**HackTricks**](https://github.com/carlospolop/hacktricks) ve [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github reposuna PR gönderin.
{% endhint %} ## Temel Bilgiler XSLT, XML belgelerini farklı formatlara dönüştürmek için kullanılan bir teknolojidir. Üç versiyonu vardır: 1, 2 ve 3, bunlar arasında en yaygın olarak kullanılan versiyon 1'dir. Dönüşüm süreci, ya sunucu üzerinde ya da tarayıcı içinde gerçekleştirilebilir. En sık kullanılan çerçeveler şunlardır: - **Gnome'dan Libxslt,** - **Apache'den Xalan,** - **Saxonica'dan Saxon.** XSLT ile ilişkili güvenlik açıklarının istismar edilmesi için xsl etiketlerinin sunucu tarafında saklanması ve ardından bu içeriğe erişilmesi gerekmektedir. Böyle bir güvenlik açığının bir örneği aşağıdaki kaynakta belgelenmiştir: [https://www.gosecure.net/blog/2019/05/02/esi-injection-part-2-abusing-specific-implementations/](https://www.gosecure.net/blog/2019/05/02/esi-injection-part-2-abusing-specific-implementations/). ## Örnek - Eğitim ```bash sudo apt-get install default-jdk sudo apt-get install libsaxonb-java libsaxon-java ``` {% code title="xml.xml" %} ```xml CD Title The artist Da Company 10000 1760 ``` {% endcode %} {% code title="xsl.xsl" %} ```xml

The Super title

Title artist
``` {% endcode %} Çalıştır: ```xml saxonb-xslt -xsl:xsl.xsl xml.xml Warning: at xsl:stylesheet on line 2 column 80 of xsl.xsl: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor

The Super title

Title artist
CD Title The artist
``` ### Parmak İzi {% code title="detection.xsl" %} ```xml Version:
Vendor:
Vendor URL:
Product Name:
Product Version:
Is Schema Aware ?:
Supports Serialization:
Supports Backwards Compatibility:
``` {% endcode %} Ve çalıştır ```xml $saxonb-xslt -xsl:detection.xsl xml.xml Warning: at xsl:stylesheet on line 2 column 80 of detection.xsl: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor

XSLT identification

Version:2.0
Vendor:SAXON 9.1.0.8 from Saxonica
Vendor URL:http://www.saxonica.com/
``` ### Yerel Dosyayı Oku {% code title="read.xsl" %} ```xml ``` {% endcode %} ```xml $ saxonb-xslt -xsl:read.xsl xml.xml Warning: at xsl:stylesheet on line 1 column 111 of read.xsl: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin ``` ### SSRF ```xml ``` ### Versiyonlar Kullanılan XSLT sürümüne bağlı olarak daha fazla veya daha az işlev olabilir: * [https://www.w3.org/TR/xslt-10/](https://www.w3.org/TR/xslt-10/) * [https://www.w3.org/TR/xslt20/](https://www.w3.org/TR/xslt20/) * [https://www.w3.org/TR/xslt-30/](https://www.w3.org/TR/xslt-30/) ## Parmak İzi Bunu yükleyin ve bilgi alın ```xml Version:
Vendor:
Vendor URL:
Product Name:
Product Version:
Is Schema Aware ?:
Supports Serialization:
Supports Backwards Compatibility:
``` ## SSRF ```xml ``` ## Javascript Enjeksiyonu ```xml ``` ## Dizin listeleme (PHP) ### **Opendir + readdir** ```xml - - - - - - - - - ``` ### **Assert (var\_dump + scandir + false)** ```xml
``` ## Dosyaları Oku ### **İçsel - PHP** ```xml ``` ### **İç - XXE** ```xml ]> &ext_file; ``` ### **HTTP Üzerinden** ```xml ``` ```xml ]> &passwd; ``` ### **Dahili (PHP-fonksiyonu)** ```xml ``` ```xml
``` ### Port taraması ```xml ``` ## Bir dosyaya yaz ### XSLT 2.0 ```xml Write Local File ``` ### **Xalan-J uzantısı** ```xml Write Local File ``` PDF'de dosya yazmanın diğer yolları ## Harici XSL dahil et ```xml ``` ```xml ``` ## Kod Çalıştır ### **php:function** ```xml ``` ```xml
``` Execute code using other frameworks in the PDF ### **Daha Fazla Dil** **Bu sayfada diğer dillerde RCE örneklerini bulabilirsiniz:** [**https://vulncat.fortify.com/en/detail?id=desc.dataflow.java.xslt\_injection#C%23%2FVB.NET%2FASP.NET**](https://vulncat.fortify.com/en/detail?id=desc.dataflow.java.xslt\_injection#C%23%2FVB.NET%2FASP.NET) **(C#, Java, PHP)** ## **Sınıflardan PHP statik fonksiyonlarına erişim** Aşağıdaki fonksiyon, XSL sınıfının `stringToUrl` statik metodunu çağıracaktır: ```xml ``` (Örnek [http://laurent.bientz.com/Blog/Entry/Item/using\_php\_functions\_in\_xsl-7.sls](http://laurent.bientz.com/Blog/Entry/Item/using\_php\_functions\_in\_xsl-7.sls) adresinden) ## Daha Fazla Payload * [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XSLT%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XSLT%20Injection) adresini kontrol edin * [https://vulncat.fortify.com/en/detail?id=desc.dataflow.java.xslt_injection](https://vulncat.fortify.com/en/detail?id=desc.dataflow.java.xslt_injection) adresini kontrol edin ## **Brute-Force Tespit Listesi** {% embed url="https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/xslt.txt" %} ## **Referanslar** * [XSLT\_SSRF](https://feelsec.info/wp-content/uploads/2018/11/XSLT\_SSRF.pdf)\\ * [http://repository.root-me.org/Exploitation%20-%20Web/EN%20-%20Abusing%20XSLT%20for%20practical%20attacks%20-%20Arnaboldi%20-%20IO%20Active.pdf](http://repository.root-me.org/Exploitation%20-%20Web/EN%20-%20Abusing%20XSLT%20for%20practical%20attacks%20-%20Arnaboldi%20-%20IO%20Active.pdf)\\ * [http://repository.root-me.org/Exploitation%20-%20Web/EN%20-%20Abusing%20XSLT%20for%20practical%20attacks%20-%20Arnaboldi%20-%20Blackhat%202015.pdf](http://repository.root-me.org/Exploitation%20-%20Web/EN%20-%20Abusing%20XSLT%20for%20practical%20attacks%20-%20Arnaboldi%20-%20Blackhat%202015.pdf) {% hint style="success" %} AWS Hacking öğrenin ve pratik yapın:[**HackTricks Eğitim AWS Kırmızı Takım Uzmanı (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ GCP Hacking öğrenin ve pratik yapın: [**HackTricks Eğitim GCP Kırmızı Takım Uzmanı (GRTE)**](https://training.hacktricks.xyz/courses/grte)
HackTricks'i Destekleyin * [**abonelik planlarını**](https://github.com/sponsors/carlospolop) kontrol edin! * **💬 [**Discord grubuna**](https://discord.gg/hRep4RUj7f) veya [**telegram grubuna**](https://t.me/peass) katılın ya da **Twitter**'da **bizi takip edin** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Hacking ipuçlarını paylaşmak için** [**HackTricks**](https://github.com/carlospolop/hacktricks) ve [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github reposuna PR gönderin.
{% endhint %}