揭露浏览器恶意书签如何盗取你的Discord账户

慢雾科技Published on 2022-04-21Last updated on 2022-04-21

Abstract

注意任何添加操作和代码都可能是恶意的。

背景
区块链的世界遵循黑暗森林法则,在这个世界我们随时可能遭受到来自不明的外部攻击,作为普通用户不进行作恶,但是了解黑客的作恶的方式是十分必要的。
慢雾安全团队此前发布了区块链黑暗森林自救手册
(https://github.com/slowmist/Blockchain-dark-forest-selfguard-handbook),其中提到了不少关于针对 NFT 项目方的 Discord 进行攻击的手法,为了帮助读者对相关钓鱼方式有更清晰的认知,本文将揭露其中一种钓鱼方法,即通过恶意的书签来盗取项目方 Discord 账号的 Token,用来发布虚假信息等诱导用户访问钓鱼网站,从而盗取用户的数字资产。
钓鱼事件
先来回顾一起 Discord 钓鱼事件:2022 年 3 月 14 日,一则推特称 NFT 项目 Wizard Pass 的 Discord 社区被诈骗者入侵,目前已造成 BAYC、Doodles、Clone X 等 NFT 被盗,详情如下:

慢雾

(来源:https://twitter.com/SerpentAU/status/1503232270219431941)
牵出其中一个解读:

慢雾

(来源:https://twitter.com/sentinelwtf/status/1496293768542429187)
该解读里说的 bookmark 就是浏览器书签,这个书签里的内容可以是一段 JavaScript 恶意代码,当 Discord 用户点击时,恶意 JavaScript 代码就会在用户所在的 Discord 域内执行,盗取 Discord Token,攻击者获得项目方的 Discord Token 后就可以直接自动化接管项目方的 Discord 账户相关权限。
背景知识
要理解该事件需要读者有一定的背景知识,现在的浏览器都有自带的书签管理器,在提供便利的同时却也容易被攻击者利用。通过精心构造恶意的钓鱼页面可以让你收藏的书签中插入一段 JavaScript 代码,当受害者点击书签时会以当前浏览器标签页的域进行执行。

慢雾

以上图为例,受害者打开了 discord.com 官网,并在这个页面点击了之前收藏的恶意的书签「Hello,World!」从而执行了一个弹窗语句,可以发现执行的源显示的是 discord.com。
这里有一个域的概念,浏览器是有同源策略等防护策略的,按理不属于 discord.com 做出的操作不应该在 discord.com 域的页面有响应,但书签却绕过了这个限制。
可以预见书签这么个小功能隐含的安全问题,正常添加书签的方式会明显看到书签网址:

慢雾

稍微有安全意识的读者应该会直接看到网址信息明显存在问题。
当然如果是一个构造好诱导你拖拽收藏到书签栏到页面呢?可以看到 twitter 链接中的演示视频就是构造了这么个诱导页面:」Drag this to your bookmarked」。

慢雾

也就是拖着某个链接即可添加到书签栏,只要钓鱼剧本写得足够真实,就很容易让安全意识不足的用户中招。
要实现拖拽即可添加到书签栏只需要构造一个 a 标签,下面是示例代码:
1 <a href="javascript: (() => { alert('Hello, World!'); })();">
2 Hello, World!
3 </a>

慢雾

书签在点击时可以像在开发者工具控制台中的代码一样执行,并且会绕过 CSP(Content Security Policy) 策略。
读者可能会有疑问,类似「javascript:()」这样的链接,在添加进入到浏览器书签栏,浏览器竟然会没有任何的提醒?
笔者这里以谷歌和火狐两款浏览器来进行对比。
使用谷歌浏览器,拖拽添加正常的 URL 链接不会有任何的编辑提醒。

慢雾

使用谷歌浏览器,拖拽添加恶意链接同样不会有任何的编辑提醒。

慢雾

使用火狐浏览器如果添加正常链接不会有提醒。

慢雾

使用火狐浏览器,如果添加恶意链接则会出现一个窗口提醒编辑确认保存。

慢雾

由此可见在书签添加这方面火狐浏览器的处理安全性更高。
场景演示
演示采用的谷歌浏览器,在用户登录 Web 端 Discord 的前提下,假设受害者在钓鱼页面的指引下添加了恶意书签,在 Discord Web 端登录时,点击了该书签,触发恶意代码,受害者的 Token 等个人信息便会通过攻击者设置好的 Discord webhook 发送到攻击者的频道上。
下面是演示受害者点击了钓鱼的书签:

慢雾

下面是演示攻击者编写的 JavaScript 代码获取 Token 等个人信息后,通过 Discord Server 的 webhook 接收到。

慢雾

笔者补充几点可能会产生疑问的攻击细节
1. 为什么受害者点了一下就获取了?
通过背景知识我们知道,书签可以插入一段 JavaScript 脚本,有了这个几乎可以做任何事情,包括通过 Discord 封装好的 webpackChunkdiscord_app 前端包进行信息获取,但是为了防止作恶的发生,详细的攻击代码笔者不会给出。
2. 为什么攻击者会选择 Discord webhook 进行接收?
因为 Discord webhook 的格式为
「https://discord.com/api/webhooks/xxxxxx」,直接是 Discord 的主域名,绕过了同源策略等问题,读者可以自行新建一个 Discord webhook 进行测试。
3. 拿到了 Token 又能怎么样?
拿到了 Token 等同于登录了 Discord 账号,可以做登录 Discord 的任何同等操作,比如建立一个 Discord webhook 机器人,在频道里发布公告等虚假消息进行钓鱼。
总结
攻击时刻在发生,针对已经遭受到恶意攻击的用户,建议立刻采取如下行动进行补救
1. 立刻重置 Discord 账号密码。
2. 重置密码后重新登录该 Discord 账号来刷新 Token,才能让攻击者拿到的 Token 失效。
3. 删除并更换原有的 webhook 链接,因为原有的 webhook 已经泄露。
4. 提高安全意识,检查并删除已添加的恶意书签。
作为用户,重要的是要注意任何添加操作和代码都可能是恶意的,Web 上会有很多的扩展看起来非常友好和灵活。书签不能阻止网络请求,在用户手动触发执行的那一刻,还是需要保持一颗怀疑的心。

Related Reads

What If the CLARITY Act Ultimately Fails to Pass?

This article examines the potential consequences if the CLARITY Act, a major US crypto market structure bill, fails to pass in the Senate. Having cleared the House in July 2025 and a key committee in May 2026, the bill's passage into law this year is now considered uncertain, with prediction markets showing its probability dropping from 82% in February to 35%. The article analyzes three main areas of impact should the bill fail. First, for the crypto market, analysts believe a negative reaction is limited and partially priced in already, with Bitcoin's recent weakness attributed more to macro factors. The specific details of the failed bill would matter more than its failure alone. Second, for US stocks, Coinbase (COIN) could see short-term pressure, with analysts citing a potential drop to the $140-$160 range, though its long-term thesis is not solely tied to the bill. For Circle, failure might be neutral or even positive long-term, as a passed bill could invite more stablecoin competition. Bitcoin-treasury firms like Strategy (MSTR) are seen as more directly tied to Bitcoin's price than the legislation. Third, in Washington, the failure is framed within a broader political struggle. Democratic resistance is partly linked to concerns over former President Trump's crypto holdings, making the bill a political tool. If it fails in 2026, the industry would likely rely on existing frameworks like the GENIUS Act and agency-level rules. Missing the August window likely pushes any significant progress to 2027, a period of political reshuffling after midterm elections, making consensus harder to achieve.

Odaily星球日报Just now

What If the CLARITY Act Ultimately Fails to Pass?

Odaily星球日报Just now

SK Hynix Q2 Profit Soars Sixfold, Still 'Misses Expectations'; Secures Long-Term Agreements with 10 Clients, HBM4 to Accelerate Volume Ramp in Second Half

SK Hynix reported record-breaking Q2 2026 financial results, with operating profit soaring 557% year-over-year to 60.5 trillion won and revenue increasing 257% to 79.3 trillion won, driven by strong demand for AI server memory, HBM, and enterprise SSDs. The operating profit margin reached 76.3%. However, both figures fell short of analyst expectations, leading to a drop in its share price. The company attributed the earnings miss to three factors: a high sales mix of HBM, which limited upside from surging prices of general-purpose DRAM; a deceleration in memory price increases compared to Q1; and long-term supply agreements (LTAs) with major customers that lock in prices, reducing sensitivity to spot market gains. SK Hynix has signed LTAs with about 10 clients, covering roughly half of its sales. Despite the miss, the company remains optimistic about AI-driven demand. Its net profit of 93.9 trillion won was significantly boosted by a one-time gain from the partial sale of its Kioxia stake. Financially, it strengthened its cash position, ending the quarter with a net cash position of 69.4 trillion won. Looking ahead, SK Hynix plans capital expenditures at the high end of its 40-50 trillion won range for 2026 to expand capacity for HBM and advanced NAND products, including accelerating the mass production of HBM4 in the second half of the year.

marsbit21m ago

SK Hynix Q2 Profit Soars Sixfold, Still 'Misses Expectations'; Secures Long-Term Agreements with 10 Clients, HBM4 to Accelerate Volume Ramp in Second Half

marsbit21m ago

Behind the 67,000 Semiconductor Talent Shortage: U.S. Industrial Policy Game and Implications for China

The U.S. push to reshore semiconductor manufacturing faces a core challenge: a significant talent shortage. While over $770 billion in investments are planned across 160 projects, a key hurdle is finding enough people to run the new fabs. According to industry projections, the U.S. could face a shortage of approximately 67,000 technicians, engineers, and computer scientists by 2030. This shortage is multi-faceted. It includes not only high-level chip design engineers requiring advanced degrees but also a substantial need for technicians to operate and maintain fab equipment. Technician roles, while often requiring less formal education, are hard to fill due to factors like shift work, factory locations, and local community infrastructure. Conversely, for high-end engineers, the issue is less about salary—which is already competitive—and more about intense competition for specialized skills from other tech sectors and the long lead time to develop such expertise. The geographic dispersion of new investments complicates recruitment, as fabs need large numbers of local, stable employees. In response, U.S. policy emphasizes building workforce development as critical infrastructure. Strategies include expanding community college programs for technician training, fostering industry-education partnerships, and pursuing immigration reforms for high-skilled talent, aiming to balance immediate needs with long-term domestic pipeline development. For China, the key takeaway is the need to integrate talent supply planning with factory construction from the outset. This involves requiring companies to submit workforce plans, strengthening vocational education aligned with industry needs, and building supportive local ecosystems to retain talent. Ultimately, a sustainable semiconductor industry depends not just on building fabs, but on cultivating a continuous, local talent pipeline capable of keeping them running and advancing.

marsbit1h ago

Behind the 67,000 Semiconductor Talent Shortage: U.S. Industrial Policy Game and Implications for China

marsbit1h ago

Trading

Spot
活动图片