# SOME - Same Origin Method Execution

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

* 您在**网络安全公司**工作吗？ 您想看到您的**公司在HackTricks中做广告**吗？ 或者您想访问**PEASS的最新版本或下载HackTricks的PDF**吗？ 请查看[**订阅计划**](https://github.com/sponsors/carlospolop)！
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[NFT](https://opensea.io/collection/the-peass-family)收藏品
* 获取[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上**关注**我 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**hacktricks存储库**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud存储库**](https://github.com/carlospolop/hacktricks-cloud)提交PR来分享您的黑客技巧。

</details>

### [WhiteIntel](https://whiteintel.io)

<figure><img src="/files/YEhfJ0lgKxxdqFKA17yB" alt=""><figcaption></figcaption></figure>

[**WhiteIntel**](https://whiteintel.io) 是一个由**暗网**推动的搜索引擎，提供免费功能，用于检查公司或其客户是否受到**窃取恶意软件**的**侵害**。

WhiteIntel的主要目标是打击由窃取信息恶意软件导致的账户劫持和勒索软件攻击。

您可以访问他们的网站并免费尝试他们的引擎：

{% embed url="<https://whiteintel.io>" %}

***

## 同源方法执行

有时您可以在页面中执行一些有限的javascript。例如，在您可以[**控制将执行的回调值**](/pentesting-web/xss-cross-site-scripting.md#javascript-function)的情况下。

在这种情况下，您可以做的最好的事情之一是**访问DOM以调用您可以在其中找到的任何敏感操作**（如单击按钮）。但是，通常您会在**没有任何有趣内容的DOM**中找到此漏洞。

在这些情况下，此攻击将非常有用，因为其目标是能够**滥用来自同一域的不同页面中的DOM内的有限JS执行**，以执行更有趣的操作。

基本上，攻击流程如下：

* 找到**可以滥用的回调**（可能仅限于\[\w\\.\_]）。
* 如果没有限制且您可以执行任何JS，则可以像常规XSS一样滥用此功能
* 使**受害者打开**由**攻击者控制**的页面
* **页面将在**一个**不同的窗口中打开**（新窗口将具有引用初始窗口的对象\*\*`opener`\*\*）
* **初始页面**将加载**包含有趣DOM的页面**。
* **第二个页面**将加载**滥用回调的易受攻击页面**，并使用\*\*`opener`**对象来**访问并执行初始页面中的某些操作\*\*（现在包含有趣DOM）。

{% hint style="danger" %}
请注意，即使初始页面在创建第二个页面后访问新URL，第二个页面的\*\*`opener`对象仍然是对新DOM中第一个页面的有效引用\*\*。

此外，为了使第二个页面能够使用opener对象，**两个页面必须在同一源中**。这就是为什么为了滥用此漏洞，您需要找到某种**同源XSS**的原因。
{% endhint %}

### 利用

* 您可以使用此表单来**生成PoC**以利用此类型的漏洞：<https://www.someattack.com/Playground/SOMEGenerator>
* 为了找到具有单击的HTML元素的DOM路径，您可以使用此浏览器扩展程序：<https://www.someattack.com/Playground/targeting_tool>

### 示例

* 您可以在<https://www.someattack.com/Playground/>找到一个易受攻击的示例
* 请注意，在此示例中，服务器正在**生成javascript代码**并根据**回调参数的内容**将其添加到HTML中：`<script>opener.{callbacl_content}</script>`。这就是为什么在此示例中，您不需要显式指示使用`opener`。
* 还请查看此CTF解密：<https://ctftime.org/writeup/36068>

## 参考资料

* <https://conference.hitb.org/hitbsecconf2017ams/sessions/everybody-wants-some-advance-same-origin-method-execution/>

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

* 您在**网络安全公司**工作吗？ 您想看到您的**公司在HackTricks中做广告**吗？ 或者您想访问**PEASS的最新版本或下载HackTricks的PDF**吗？ 请查看[**订阅计划**](https://github.com/sponsors/carlospolop)！
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[NFT](https://opensea.io/collection/the-peass-family)收藏品
* 获取[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上**关注**我 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**hacktricks存储库**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud存储库**](https://github.com/carlospolop/hacktricks-cloud)提交PR来分享您的黑客技巧。

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hacktricks.xsx.tw/pentesting-web/xss-cross-site-scripting/some-same-origin-method-execution.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
