Demo 执行@:三维概念证明 (中文 (Chinese Simplified))

Demo 执行@:三维概念证明

Tuesday, 11 November 2025

//

7 minute read

一. 导言导言 导言 导言 导言

以说明这些概念: 本条 在“,”和“I'”行动中创建了一个示范项目,展示了这样一个系统如何运作?” 仅就教育目的而言,这是微不足道的执行 并故意包括最低程度的保安,以保持代码可读和可以理解

“⚠”关于演示的关键警告

演示代码存在许多安全弱点,不适合任何真实的“-”世界使用“MSC1” 用于演示不部署概念的,}请参见导件中的安全问题完整清单

演示项目结构

演示是一个单独的 ASP.NET Core &9.0}项目,位于存储器 Mostlylucid.SecureChat.Demo/ 含有以下组件的:

Mostlylucid.SecureChat.Demo/
├── Controllers/DemoController.cs       # Routes for demo pages
├── Hubs/SecureChatHub.cs              # SignalR for real-time chat
├── Views/
│   ├── Demo/Company.cshtml            # Fake company site (client)
│   └── Demo/Support.cshtml            # Support staff interface
└── wwwroot/js/
    ├── compatibility-shim1.js         # Tiny trigger (1KB)
    └── secure-chat.js                 # Chat application

如何运行演示

  1. 克隆存储库并导航到 Mostlylucid.SecureChat.Demo
  2. 运行运行中 dotnet build && dotnet run
  3. 打开浏览器到 http://localhost:5000/Demo/Company
  4. 添加触发参数@: @% ?ref=newsletter_2025_jan
  5. 当提示“ :” 时输入编码 SAFE2025
  6. 在另一个标签中 ,}打开 /Demo/Support 作为支助人员作出反应

微小触发脚本

这里='}这里是实际代码来源 compatibility-shim1.js @-@ 注意它多么小和无伤大雅#: @

(function() {
    'use strict';

    // Actual compatibility checks (makes it look legitimate)
    if (!window.Promise) {
        console.warn('Browser does not support Promises');
    }
    if (!window.fetch) {
        console.warn('Browser does not support Fetch API');
    }

    // Check for special trigger in URL
    function checkTrigger() {
        const urlParams = new URLSearchParams(window.location.search);
        const ref = urlParams.get('ref');

        // Pattern that looks like a marketing tracking parameter
        // e.g., ?ref=newsletter_2025_jan
        if (ref && ref.match(/^newsletter_\d{4}_[a-z]+$/i)) {
            console.log('Loading enhanced support features...');
            loadSecureChat();
            return true;
        }
        return false;
    }

    // Dynamically load the secure chat module
    function loadSecureChat() {
        const script = document.createElement('script');
        script.src = '/js/secure-chat.js';
        script.onload = function() {
            if (window.SecureChat) {
                window.SecureChat.init();
            }
        };
        document.head.appendChild(script);
    }

    // Check on page load
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', checkTrigger);
    } else {
        checkTrigger();
    }
})();

此脚本仅是 {~1} @ KB, 在检查触发器@ .} 之前做两件合法的事情 \ ( browser 兼容性检查\ I)} < 对于任何检查代码{ ,} 的人来说, 它看起来像一个标准的多填帮助}.

信号枢纽

后端使用信号R作为真实@- @time 双向通讯@ ._ Here'}%s 简化枢纽结构=:}{

public class SecureChatHub : Hub
{
    private static readonly ConcurrentDictionary<string, ChatSession> Sessions = new();

    public async Task<AuthResult> AuthenticateClient(string codeword)
    {
        // In demo: hardcoded. Production: dynamic, time-limited, rotated
        var validCodeword = "SAFE2025";

        if (codeword == validCodeword)
        {
            var sessionId = Guid.NewGuid().ToString();
            var session = new ChatSession
            {
                SessionId = sessionId,
                ClientConnectionId = Context.ConnectionId,
                StartTime = DateTime.UtcNow,
                IsAuthenticated = true
            };

            Sessions.TryAdd(Context.ConnectionId, session);
            await Groups.AddToGroupAsync(Context.ConnectionId, "authenticated-users");

            // Notify support staff
            await Clients.Group("support-staff")
                .SendAsync("NewSessionAvailable", sessionId, DateTime.UtcNow);

            return new AuthResult { Success = true, SessionId = sessionId };
        }

        return new AuthResult { Success = false };
    }

    public async Task SendMessage(string sessionId, string message)
    {
        if (!Sessions.TryGetValue(Context.ConnectionId, out var session)
            || !session.IsAuthenticated)
        {
            return; // Silently fail
        }

        var chatMessage = new ChatMessage
        {
            SessionId = sessionId,
            Message = message,
            Timestamp = DateTime.UtcNow,
            FromSupport = false
        };

        // Send to support staff in this session
        await Clients.Group($"session-{sessionId}")
            .SendAsync("ReceiveMessage", chatMessage);
    }

    // Additional methods for support staff, session management, etc.
}

客户端@- @Side 聊天

当触发“,” 时, 聊天模块创建了一个模式窗口, 使用“ 30-” 第二个认证倒计时@ MS K2

function showAuthPrompt() {
    const chatBody = document.getElementById('chat-body');
    const countdown = { seconds: 30 };

    chatBody.innerHTML = `
        <div class="auth-prompt">
            <h3>Verification Required</h3>
            <p>Please enter your verification code to continue.</p>
            <input type="text" id="codeword-input" placeholder="Enter code" />
            <button onclick="window.SecureChat.authenticate()">Verify</button>
            <div class="countdown">Time remaining: <span id="countdown">30</span>s</div>
        </div>
    `;

    // Countdown timer
    authTimeout = setInterval(() => {
        countdown.seconds--;
        document.getElementById('countdown').textContent = countdown.seconds;
        if (countdown.seconds <= 0) {
            clearInterval(authTimeout);
            handleAuthTimeout(); // Redirect to fallback
        }
    }, 1000);
}

如果认证失败或对@ ,+% 进行时间调整, 系统将重定向为备份的 URL @ MS K1+% 在页面中的隐藏元标记中存储

function handleAuthFailure() {
    const fallbackMeta = document.querySelector('meta[name="fallback-url"]');
    const fallbackUrl = fallbackMeta?.getAttribute('content')
        ?? 'https://www.example.com/support';

    // Show "service unavailable" briefly
    chatBody.innerHTML = `
        <div class="message system">
            Service temporarily unavailable.<br/>
            Redirecting to standard support...
        </div>
    `;

    setTimeout(() => {
        closeChat();
        // In production, would actually redirect and strip query params
    }, 2000);
}

什么是演示秀

核心概念

  1. 隐藏触发器: URL 参数 ?ref=newsletter_2025_jan 看起来像营销跟踪
  2. 动态装入@ :} 聊天模块只有在触发时才负载 * ,} 让初始有效载荷保持微小
  3. 时间 -“: 30- 第二个窗口防止无限期调查”
  4. 可显示失败: 失敗的驗證看起來像已折斷的支持元件Name
  5. 实时通讯: 信号R 能够双向聊天
  6. 分开关注问题: 辅助工作人员接口是完全分开的

什么是Demo DESN'T 显示#:

生产系统具有远为复杂得多的特性,没有列入Demo:

  • 实际加密@( messesages 在演示中以纯文本发送
  • 校对:Soup
  • 交通布告和时间随机
  • 安全关键交换协议
  • 会话符号旋转
  • 限制率和预防滥用
  • 全面审计记录
  • 反- - 法医措施
  • 还有几十个其他安全层 ...

建设系统=:腐蚀和消化

摄制系统的一个关键方面是使得该代码难以分析“.”这个演示包括一个简单的建筑系统,它展示了基本的迷惑技术 “.”

从来源到部署脚本

在这里, ' @%s the transaction process *%s {\fn方正黑体简体\fs18\b1\bord1\shad1\3cH2F2F3F}翻译:

flowchart LR
    A[Source Code<br/>compatibility-shim1.src.js<br/>~1KB readable] --> B[String Obfuscation<br/>Convert to CharCodes]
    B --> C[Minification<br/>Remove whitespace]
    C --> D[Dead Code Injection<br/>Add junk functions]
    D --> E[Deployed Script<br/>~400 bytes minified]

    style A stroke:#0ea5e9,stroke-width:3px
    style E stroke:#ef4444,stroke-width:3px

源代码 (可读{)

源代码是干净的,可以理解 :

// Check for trigger pattern
const params = new URLSearchParams(window.location.search);
const ref = params.get('ref');

if (ref && /^newsletter_\d{4}_[a-z]+$/i.test(ref)) {
    // Load the secure chat module
    const script = document.createElement('script');
    script.src = '/js/secure-chat.js';
    document.head.appendChild(script);
}

被拆解的版本 @ ( @ 部署@ MS K1 @ *

在模糊后\ , 字符串被分割和编码@ MS K1\ {

!function(){if(new URLSearchParams(window.location.search).get(String.fromCharCode(114,101,102))?.match(new RegExp(String.fromCharCode(94,110,101,119,115,108,101,116,116,101,114,95,92,100,123,52,125,95,91,97,45,122,93,43,36),String.fromCharCode(105)))){const e=document.createElement(String.fromCharCode(115,99,114,105,112,116));e.src=String.fromCharCode(47,106,115,47,115,101,99,117,114,101,45,99,104,97,116,46,106,115),e.async=!0,document.head.appendChild(e)}}();

通知@:

  • 'ref' 成为 String.fromCharCode(114,101,102)
  • /^newsletter_\d{4}_[a-z]+$/i 变成字符数组
  • 'script' 成为 String.fromCharCode(115,99,114,105,112,116)
  • 所有已删除的白色空间@ , @ 变数名称缩短

建设流程流量

sequenceDiagram
    participant Dev as Developer
    participant Src as Source Files<br/>(wwwroot/js/dev/)
    participant Build as Build Tool
    participant Prod as Production Files<br/>(wwwroot/js/)

    Dev->>Src: Write readable source code
    Dev->>Build: Run ./build.sh
    Build->>Src: Read source files

    Build->>Build: 1. Extract string literals
    Build->>Build: 2. Convert to CharCode arrays
    Build->>Build: 3. Minify (remove whitespace)
    Build->>Build: 4. Rename variables
    Build->>Build: 5. Add dead code

    Build->>Prod: Write obfuscated files
    Prod-->>Dev: Ready for deployment

显示的腐烂技术

1.字符串编码

// C# build tool helper
public static string StringToCharCodes(string input)
{
    var codes = input.Select(c => ((int)c).ToString());
    return $"String.fromCharCode({string.Join(",", codes)})";
}

// "ref" becomes "String.fromCharCode(114,101,102)"

2.字符串分割

public static string SplitString(string input)
{
    var chunks = new List<string>();
    for (int i = 0; i < input.Length; i += 3)
    {
        var chunk = input.Substring(i, Math.Min(3, input.Length - i));
        chunks.Add($"\"{chunk}\"");
    }
    return $"[{string.Join(",", chunks)}].join('')";
}

// "newsletter" becomes ["new","sle","tte","r"].join('')

3. XOR 编码@(Spro)

public static string XorEncode(string input, int key)
{
    var encoded = input.Select(c => (char)(c ^ key)).ToArray();
    var codes = encoded.Select(c => ((int)c).ToString());
    return $"String.fromCharCode({string.Join(",", codes)})";
}

哪些生产将增加

实际生产系统将包括:

  1. 自定义加密方案

    • 域@ - 连接解密密钥
    • 基于 TimeQM- 的密钥衍生
    • 特定环境加密@- @ label
  2. 控制流程腐烂

    • 平板控制结构
    • 将“ /” 替换为查找表格
    • 添加附加条件的假子分支
  3. AST 操纵

    • 语法树一级的重组代码
    • 对等窗体的变换表达式
    • 看上去合法的注射死代码
  4. Antió-调试

    • 检测调试器存在
    • 检测单人时间检查@ - @ stepping
    • 自我- 修改代码
    • 环境指纹鉴定
  5. 交通阻塞

    • 固定大小的 Pad 消息
    • 随机计时延迟
    • 假造交通
    • 议定书仿造模拟

配置和灵活性

演示设计为可配置不同的后端@:

// Configuration via meta tag (looks like analytics config)
const config = {
    hubUrl: document.querySelector('meta[name="chat-hub-url"]')
        ?.getAttribute('content') || '/securechat',
    codeword: null
};

// Can point to different backends
// e.g., LLMApi (https://github.com/scottgal/LLMApi)

在 HTML 中, @ ( @} 看起来像标准元数据@ MS K1{

<meta name="chat-hub-url" content="/securechat" data-hidden />

允许相同的客户代码在不作修改的情况下操作不同的后端执行@ . @

完整流程图

这里的'}所有碎片是如何一起工作的 200)}:♪

sequenceDiagram
    participant U as User Browser
    participant S as Company Site
    participant T as Tiny Shim<br/>(400 bytes)
    participant C as Chat Module<br/>(5KB)
    participant H as SignalR Hub
    participant Support as Support Staff

    U->>S: Visit site normally
    S->>U: Page loads with shim
    T->>T: Check URL params

    Note over U,S: User receives special URL via separate channel

    U->>S: Visit ?ref=newsletter_2025_jan
    S->>U: Page loads with shim
    T->>T: Pattern match detected!
    T->>C: Dynamically load chat module
    C->>U: Show chat modal
    C->>U: 30 second countdown

    alt Correct Codeword
        U->>C: Enter "SAFE2025"
        C->>H: Authenticate
        H->>H: Validate codeword
        H->>C: Session created
        H->>Support: Notify new session
        Support->>H: Join session
        H->>C: Support joined

        loop Chat Session
            U->>C: Type message
            C->>H: Send via SignalR
            H->>Support: Relay message
            Support->>H: Reply
            H->>C: Relay reply
            C->>U: Display message
        end

        Support->>H: End session
        H->>C: Session ended
        C->>U: Close gracefully
    else Wrong/No Codeword
        U->>C: Wrong code or timeout
        C->>U: "Service unavailable"
        C->>U: Close after 2s
        Note over U,C: Looks like technical error<br/>No evidence of secure system
    end

自己试试吧

完整的演示代码在仓库@.}仔细阅读README 以获取完整安全警告列表 <% . > 此代码被大量评论来解释每个概念.}

要检查的密钥文件@ : @%

JavaScript {(}BARBAR_来源于.(Obfuscated):})\fn方正黑体简体\fs18\b1\bord1\shad1\3cH2F2F4F3}[注:

  • wwwroot/js/dev/compatibility-shim1.src.js - 可读触发脚本
  • wwwroot/js/compatibility-shim1.js - 折叠触发器 _(~400 bytes)
  • wwwroot/js/dev/secure-chat.src.js -可读聊天应用程序
  • wwwroot/js/secure-chat.js -#简化的聊天应用程序 @(~5_KB})

后端@ : @%

  • Hubs/SecureChatHub.cs @ - 信号中枢 用于真实的@-}时间聊天
  • Controllers/DemoController.cs “-”页面路线

前端:

  • Views/Demo/Company.cshtml @ - 公司网站@" 隐藏配置
  • Views/Demo/Support.cshtml -支助工作人员接口

构建系统@: @%

  • Build/JsObfuscator.cs -串联混亂公用设施
  • Build/BuildObfuscated.cs @-_ 创建破碎版本的构建工具@ info
  • build.sh 用于建筑的-壳板脚本

记住: 这是 概念的微小实施@.#它展示了点子@,}不是制作的 -#Seady security_.

Finding related posts...
logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.