# SOME - Same Origin Method Execution {% 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)λŠ” **닀크 μ›Ή** 기반의 검색 μ—”μ§„μœΌλ‘œ, κΈ°μ—…μ΄λ‚˜ 고객이 **stealer malwares**에 μ˜ν•΄ **μΉ¨ν•΄**λ˜μ—ˆλŠ”μ§€ 확인할 수 μžˆλŠ” **무료** κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€. WhiteIntel의 μ£Όμš” λͺ©ν‘œλŠ” 정보 νƒˆμ·¨ μ•…μ„± μ†Œν”„νŠΈμ›¨μ–΄λ‘œ μΈν•œ 계정 νƒˆμ·¨ 및 λžœμ„¬μ›¨μ–΄ 곡격에 λ§žμ„œ μ‹Έμš°λŠ” κ²ƒμž…λ‹ˆλ‹€. κ·Έλ“€μ˜ μ›Ήμ‚¬μ΄νŠΈλ₯Ό ν™•μΈν•˜κ³  **무료**둜 엔진을 μ‚¬μš©ν•΄ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€: {% embed url="https://whiteintel.io" %} *** ## Same Origin Method Execution νŽ˜μ΄μ§€μ—μ„œ μ œν•œλœ μžλ°”μŠ€ν¬λ¦½νŠΈλ₯Ό μ‹€ν–‰ν•  수 μžˆλŠ” κ²½μš°κ°€ μžˆμŠ΅λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, [**싀행될 콜백 값을 μ œμ–΄ν•  수 μžˆλŠ” 경우**](./#javascript-function)μž…λ‹ˆλ‹€. 이런 경우, ν•  수 μžˆλŠ” κ°€μž₯ 쒋은 일 쀑 ν•˜λ‚˜λŠ” **DOM에 μ ‘κ·Όν•˜μ—¬** κ·Έκ³³μ—μ„œ 찾을 수 μžˆλŠ” μ–΄λ–€ **λ―Όκ°ν•œ μž‘μ—…μ„ ν˜ΈμΆœν•˜λŠ” 것**μž…λ‹ˆλ‹€ (예: λ²„νŠΌ 클릭). κ·ΈλŸ¬λ‚˜ 일반적으둜 이 취약점은 **DOM에 ν₯미둜운 것이 μ—†λŠ” μž‘μ€ μ—”λ“œν¬μΈνŠΈμ—μ„œ λ°œκ²¬λ©λ‹ˆλ‹€**. 이런 μ‹œλ‚˜λ¦¬μ˜€μ—μ„œ 이 곡격은 맀우 μœ μš©ν•©λ‹ˆλ‹€. κ·Έ μ΄μœ λŠ” **같은 λ„λ©”μΈμ˜ λ‹€λ₯Έ νŽ˜μ΄μ§€μ—μ„œ DOM λ‚΄μ˜ μ œν•œλœ JS 싀행을 μ•…μš©ν•  수 μžˆλŠ”** 것이기 λ•Œλ¬Έμž…λ‹ˆλ‹€. 기본적으둜 곡격 흐름은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€: * **μ•…μš©ν•  수 μžˆλŠ” μ½œλ°±μ„ μ°ΎμŠ΅λ‹ˆλ‹€** (잠재적으둜 \[\w\\.\_]둜 μ œν•œλ¨). * μ œν•œμ΄ μ—†κ³  μ–΄λ–€ JS도 μ‹€ν–‰ν•  수 μžˆλ‹€λ©΄, 일반 XSS처럼 이λ₯Ό μ•…μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€. * **ν”Όν•΄μžκ°€ κ³΅κ²©μžκ°€ μ œμ–΄ν•˜λŠ” νŽ˜μ΄μ§€λ₯Ό 열도둝 λ§Œλ“­λ‹ˆλ‹€.** * **νŽ˜μ΄μ§€κ°€ λ‹€λ₯Έ μ°½μ—μ„œ μ—΄λ¦½λ‹ˆλ‹€** (μƒˆ 창은 초기 창을 μ°Έμ‘°ν•˜λŠ” **`opener`** 객체λ₯Ό κ°€μ§‘λ‹ˆλ‹€). * **초기 νŽ˜μ΄μ§€**λŠ” **ν₯미둜운 DOM**이 μœ„μΉ˜ν•œ **νŽ˜μ΄μ§€**λ₯Ό λ‘œλ“œν•©λ‹ˆλ‹€. * **두 번째 νŽ˜μ΄μ§€**λŠ” **μ½œλ°±μ„ μ•…μš©ν•˜μ—¬ μ·¨μ•½ν•œ νŽ˜μ΄μ§€λ₯Ό λ‘œλ“œν•˜κ³ ** **`opener`** 객체λ₯Ό μ‚¬μš©ν•˜μ—¬ **초기 νŽ˜μ΄μ§€μ—μ„œ μ–΄λ–€ μž‘μ—…μ„ μ ‘κ·Όν•˜κ³  μ‹€ν–‰ν•©λ‹ˆλ‹€** (이제 ν₯미둜운 DOM을 ν¬ν•¨ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€). {% hint style="danger" %} 초기 νŽ˜μ΄μ§€κ°€ 두 번째 νŽ˜μ΄μ§€λ₯Ό μƒμ„±ν•œ ν›„ μƒˆ URL에 μ ‘κ·Όν•˜λ”λΌλ„, **두 번째 νŽ˜μ΄μ§€μ˜ `opener` κ°μ²΄λŠ” μ—¬μ „νžˆ μƒˆ DOMμ—μ„œ 첫 번째 νŽ˜μ΄μ§€μ— λŒ€ν•œ μœ νš¨ν•œ μ°Έμ‘°μž…λ‹ˆλ‹€**. λ˜ν•œ, 두 번째 νŽ˜μ΄μ§€κ°€ opener 객체λ₯Ό μ‚¬μš©ν•  수 있으렀면 **두 νŽ˜μ΄μ§€ λͺ¨λ‘ 같은 μΆœμ²˜μ— μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€**. 이것이 이 취약점을 μ•…μš©ν•˜κΈ° μœ„ν•΄ **같은 μΆœμ²˜μ—μ„œ XSSλ₯Ό μ°Ύμ•„μ•Ό ν•˜λŠ” μ΄μœ μž…λ‹ˆλ‹€**. {% endhint %} ### Exploitation * 이 양식을 μ‚¬μš©ν•˜μ—¬ **이 μœ ν˜•μ˜ 취약점을 μ•…μš©ν•˜κΈ° μœ„ν•œ PoCλ₯Ό 생성할 수 μžˆμŠ΅λ‹ˆλ‹€**: [https://www.someattack.com/Playground/SOMEGenerator](https://www.someattack.com/Playground/SOMEGenerator) * 클릭할 HTML μš”μ†Œμ— λŒ€ν•œ DOM 경둜λ₯Ό μ°ΎκΈ° μœ„ν•΄ 이 λΈŒλΌμš°μ € ν™•μž₯ ν”„λ‘œκ·Έλž¨μ„ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€: [https://www.someattack.com/Playground/targeting\_tool](https://www.someattack.com/Playground/targeting\_tool) ### Example * μ·¨μ•½ν•œ 예제λ₯Ό [https://www.someattack.com/Playground/](https://www.someattack.com/Playground/)μ—μ„œ 찾을 수 μžˆμŠ΅λ‹ˆλ‹€. * 이 μ˜ˆμ œμ—μ„œ μ„œλ²„λŠ” **μžλ°”μŠ€ν¬λ¦½νŠΈ μ½”λ“œλ₯Ό μƒμ„±ν•˜κ³ ** 이λ₯Ό **콜백 λ§€κ°œλ³€μˆ˜μ˜ λ‚΄μš©μ— 따라** HTML에 μΆ”κ°€ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€: `` . κ·Έλž˜μ„œ 이 μ˜ˆμ œμ—μ„œλŠ” `opener`의 μ‚¬μš©μ„ λͺ…μ‹œμ μœΌλ‘œ μ§€μ‹œν•  ν•„μš”κ°€ μ—†μŠ΅λ‹ˆλ‹€. * 이 CTF μž‘μ„±λ¬Όλ„ ν™•μΈν•˜μ„Έμš”: [https://ctftime.org/writeup/36068](https://ctftime.org/writeup/36068) ## References * [https://conference.hitb.org/hitbsecconf2017ams/sessions/everybody-wants-some-advance-same-origin-method-execution/](https://conference.hitb.org/hitbsecconf2017ams/sessions/everybody-wants-some-advance-same-origin-method-execution/) {% 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 %}