> For the complete documentation index, see [llms.txt](https://hacktricks.xsx.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacktricks.xsx.tw/generic-methodologies-and-resources/pentesting-wifi/evil-twin-eap-tls.md).

# Evil Twin EAP-TLS

<details>

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

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**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) github仓库提交PR来分享您的黑客技巧。

</details>

<img src="/files/wQPam8C1YmPwZ2KLeMOE" alt="" data-size="original">\
**赏金提示**：**注册**Intigriti，这是一家由黑客创建的高级**赏金平台**！立即加入我们，访问[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)，开始赚取高达\*\*$100,000\*\*的赏金！

{% embed url="<https://go.intigriti.com/hacktricks>" %}

在某个时候，我需要使用下面帖子中提出的解决方案，但是<https://github.com/OpenSecurityResearch/hostapd-wpe>中的步骤在现代kali（2019v3）中不再起作用。\
无论如何，很容易让它们起作用。\
您只需要从这里下载hostapd-2.6：[https://w1.fi/releases/](https://w1.fi/releases)，并在重新编译hostapd-wpe之前安装：`apt-get install libssl1.0-dev`

### 分析和利用无线网络中的EAP-TLS

#### 背景：无线网络中的EAP-TLS

EAP-TLS是一种安全协议，使用证书在客户端和服务器之间提供相互认证。只有在客户端和服务器互相验证对方的证书时，连接才会建立。

#### 遇到的挑战

在评估过程中，使用`hostapd-wpe`工具时遇到了一个有趣的错误。由于客户端的证书是由未知的证书颁发机构（CA）签名的，该工具拒绝了客户端的连接。这表明客户端信任了伪造服务器的证书，指向客户端端口的安全配置不严格。

#### 目标：设置中间人攻击（MiTM）

目标是修改工具以接受任何客户端证书。这将允许与恶意无线网络建立连接，并启用MiTM攻击，可能捕获明文凭据或其他敏感数据。

#### 解决方案：修改`hostapd-wpe`

对`hostapd-wpe`的源代码进行分析后发现，客户端证书验证由OpenSSL函数`SSL_set_verify`中的一个参数（`verify_peer`）控制。通过将此参数的值从1（验证）更改为0（不验证），工具被修改为接受任何客户端证书。

#### 攻击执行

1. **环境检查：** 使用`airodump-ng`监视无线网络并识别目标。
2. **设置虚假AP：** 运行修改后的`hostapd-wpe`创建一个模仿目标网络的虚假接入点（AP）。
3. **定制强制门户：** 自定义强制门户的登录页面，使其看起来合法且对目标用户熟悉。
4. **去认证攻击：** 可选地，执行去认证攻击以将客户端从合法网络断开连接并将其连接到虚假AP。
5. **捕获凭据：** 一旦客户端连接到虚假AP并与强制门户交互，它们的凭据就会被捕获。

#### 攻击观察

* 在Windows机器上，系统可能会自动连接到虚假AP，在尝试进行网页导航时显示强制门户。
* 在iPhone上，用户可能会被提示接受新证书，然后显示强制门户。

#### 结论

尽管EAP-TLS被认为是安全的，但其有效性在很大程度上取决于正确的配置和终端用户的谨慎行为。配置错误的设备或毫不知情的用户接受伪造证书可能会破坏受EAP-TLS保护的网络的安全性。

有关更多详细信息，请查看<https://versprite.com/blog/application-security/eap-tls-wireless-infrastructure/>

## 参考资料

* <https://versprite.com/blog/application-security/eap-tls-wireless-infrastructure/>

<img src="/files/wQPam8C1YmPwZ2KLeMOE" alt="" data-size="original">\
**赏金提示**：**注册**Intigriti，这是一家由黑客创建的高级**赏金平台**！立即加入我们，访问[**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)，开始赚取高达\*\*$100,000\*\*的赏金！

{% embed url="<https://go.intigriti.com/hacktricks>" %}

<details>

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

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**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) github仓库提交PR来分享您的黑客技巧。

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://hacktricks.xsx.tw/generic-methodologies-and-resources/pentesting-wifi/evil-twin-eap-tls.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
