连接到常用滥用 Web 服务

编辑

攻击者可能会实施使用常见 Web 服务隐藏其活动的命令和控制 (C2) 通信。此攻击技术通常针对某个组织,并使用受害者网络中常见的 Web 服务,这使得攻击者能够融入合法的流量活动中。这些流行的服务通常成为目标,因为它们很可能在入侵之前就被使用过,这有助于恶意流量融入其中。

规则类型: eql

规则索引:

  • logs-endpoint.events.network-*

严重程度: 低

风险评分: 21

每隔: 5 分钟

搜索索引时间范围: now-9m (日期数学格式,另请参阅 额外回溯时间)

每次执行的最大告警数: 100

参考:

标签:

  • 领域:端点
  • 操作系统:Windows
  • 用例:威胁检测
  • 战术:命令和控制
  • 资源:调查指南
  • 数据源:Elastic Defend

版本: 116

规则作者:

  • Elastic

规则许可证: Elastic License v2

调查指南

编辑

分类和分析

调查连接到常用滥用 Web 服务

攻击者可能会使用现有的合法外部 Web 服务作为在受感染系统之间中继数据的方法。充当 C2 机制的流行网站和社交媒体可能会提供大量的掩护,因为网络中的主机很可能在入侵之前就已经与它们进行通信。

此规则查找位于已知合法程序位置之外的进程与可被滥用于泄密或命令和控制的服务列表进行通信。

注意: 此调查指南使用 Elastic Stack 版本 8.5.0 中引入的 Osquery Markdown 插件。较旧的 Elastic Stack 版本将在此指南中显示未呈现的 Markdown。此调查指南使用 Elastic Stack 版本 8.8.0 中引入的 调查 Markdown 插件。较旧的 Elastic Stack 版本将在此指南中显示未呈现的 Markdown。

可能的调查步骤

  • 调查未知进程的进程执行链(父进程树)。检查其可执行文件以了解流行程度、它们是否位于预期位置以及它们是否使用有效的数字签名进行签名。
  • 调查过去 48 小时内与用户/主机关联的其他告警。
  • !{investigate{"label":"过去 48 小时内与用户关联的告警","providers":[[{"excluded":false,"field":"event.kind","queryType":"phrase","value":"signal","valueType":"string"},{"excluded":false,"field":"user.id","queryType":"phrase","value":"{{user.id}}","valueType":"string"}]],"relativeFrom":"now-48h/h","relativeTo":"now"}}
  • !{investigate{"label":"过去 48 小时内与主机关联的告警","providers":[[{"excluded":false,"field":"event.kind","queryType":"phrase","value":"signal","valueType":"string"},{"excluded":false,"field":"host.name","queryType":"phrase","value":"{{host.name}}","valueType":"string"}]],"relativeFrom":"now-48h/h","relativeTo":"now"}}
  • 验证可执行文件是否存在数字签名。
  • 确定操作类型(上传、下载、隧道等)。
  • 检查主机以查找指示可疑活动的派生工件
  • 使用私有沙箱分析系统分析进程可执行文件。
  • 观察并收集有关沙箱和告警主题主机中以下活动的信息
  • 尝试联系外部域和地址。
  • 使用 Elastic Defend 网络事件通过按进程的 process.entity_id 进行筛选来确定受试进程联系的域和地址。
  • !{investigate{"label":"调查受试进程网络事件","providers":[[{"excluded":false,"field":"event.category","queryType":"phrase","value":"network","valueType":"string"},{"excluded":false,"field":"process.entity_id","queryType":"phrase","value":"{{process.entity_id}}","valueType":"string"}]]}}
  • 检查 DNS 缓存中是否存在可疑或异常条目。
  • !{osquery{"label":"Osquery - 检索 DNS 缓存","query":"SELECT * FROM dns_cache"}}
  • 使用 Elastic Defend 注册表事件检查进程树中相关进程访问、修改或创建的注册表项。
  • 检查主机服务中是否存在可疑或异常条目。
  • !{osquery{"label":"Osquery - 检索所有服务","query":"SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"}}
  • !{osquery{"label":"Osquery - 检索在用户帐户上运行的服务","query":"SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE\nNOT (user_account LIKE %LocalSystem OR user_account LIKE %LocalService OR user_account LIKE %NetworkService OR\nuser_account == null)\n"}}
  • !{osquery{"label":"Osquery - 检索具有 VirusTotal 链接的未签名可执行服务","query":"SELECT concat(https://www.virustotal.com/gui/file/, sha1) AS VtLink, name, description, start_type, status, pid,\nservices.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =\nauthenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != trusted\n"}}
  • 使用 PowerShell Get-FileHash cmdlet 检索文件的 SHA-256 哈希值,并在 VirusTotal、Hybrid-Analysis、CISCO Talos、Any.run 等资源中搜索哈希的存在性和信誉。

误报分析

  • 此规则产生误报的可能性很高,因为它检测到与合法服务的通信。嘈杂的误报可以作为例外添加。

响应和修复

  • 根据分类结果启动事件响应流程。
  • 隔离相关主机以防止进一步的入侵后行为。
  • 如果分类识别出恶意软件,请在环境中搜索其他受感染的主机。
  • 实施临时网络规则、程序和分段以遏制恶意软件。
  • 停止可疑进程。
  • 立即阻止已识别的入侵指标 (IoC)。
  • 检查受影响的系统是否存在其他恶意软件后门,例如反向 shell、反向代理或攻击者可能用来重新感染系统的投放程序。
  • 删除并阻止在分类期间识别的恶意工件。
  • 运行完整的反恶意软件扫描。这可能会发现系统中留下的其他工件、持久性机制和恶意软件组件。
  • 确定攻击者滥用的初始载体,并采取措施防止通过同一载体重新感染。
  • 使用事件响应数据更新日志记录和审计策略,以提高平均检测时间 (MTTD) 和平均响应时间 (MTTR)。

规则查询

编辑
network where host.os.type == "windows" and network.protocol == "dns" and
    process.name != null and user.id not in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
    /* Add new WebSvc domains here */
    dns.question.name :
       (
        "raw.githubusercontent.*",
        "pastebin.*",
        "paste4btc.com",
        "paste.ee",
        "ghostbin.com",
        "drive.google.com",
        "?.docs.live.net",
        "api.dropboxapi.*",
        "content.dropboxapi.*",
        "dl.dropboxusercontent.*",
        "api.onedrive.com",
        "*.onedrive.org",
        "onedrive.live.com",
        "filebin.net",
        "*.ngrok.io",
        "ngrok.com",
        "*.portmap.*",
        "*serveo.net",
        "*localtunnel.me",
        "*pagekite.me",
        "*localxpose.io",
        "*notabug.org",
        "rawcdn.githack.*",
        "paste.nrecom.net",
        "zerobin.net",
        "controlc.com",
        "requestbin.net",
        "slack.com",
        "api.slack.com",
        "slack-redir.net",
        "slack-files.com",
        "cdn.discordapp.com",
        "discordapp.com",
        "discord.com",
        "apis.azureedge.net",
        "cdn.sql.gg",
        "?.top4top.io",
        "top4top.io",
        "www.uplooder.net",
        "*.cdnmegafiles.com",
        "transfer.sh",
        "gofile.io",
        "updates.peer2profit.com",
        "api.telegram.org",
        "t.me",
        "meacz.gq",
        "rwrd.org",
        "*.publicvm.com",
        "*.blogspot.com",
        "api.mylnikov.org",
        "file.io",
        "stackoverflow.com",
        "*files.1drv.com",
        "api.anonfile.com",
        "*hosting-profi.de",
        "ipbase.com",
        "ipfs.io",
        "*up.freeo*.space",
        "api.mylnikov.org",
        "script.google.com",
        "script.googleusercontent.com",
        "api.notion.com",
        "graph.microsoft.com",
        "*.sharepoint.com",
        "mbasic.facebook.com",
        "login.live.com",
        "api.gofile.io",
        "api.anonfiles.com",
        "api.notion.com",
        "api.trello.com",
        "gist.githubusercontent.com",
        "files.pythonhosted.org",
        "g.live.com",
        "*.zulipchat.com",
        "webhook.site",
        "run.mocky.io",
        "mockbin.org",
        "www.googleapis.com",
        "googleapis.com",
        "global.rel.tunnels.api.visualstudio.com",
        "*.devtunnels.ms") and

    /* Insert noisy false positives here */
    not (
      (
        process.executable : (
          "?:\\Program Files\\*.exe",
          "?:\\Program Files (x86)\\*.exe",
          "?:\\Windows\\System32\\WWAHost.exe",
          "?:\\Windows\\System32\\smartscreen.exe",
          "?:\\Windows\\System32\\MicrosoftEdgeCP.exe",
          "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
          "?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
          "?:\\Users\\*\\AppData\\Local\\BraveSoftware\\*\\Application\\brave.exe",
          "?:\\Users\\*\\AppData\\Local\\Vivaldi\\Application\\vivaldi.exe",
          "?:\\Users\\*\\AppData\\Local\\Programs\\Opera*\\opera.exe",
          "?:\\Users\\*\\AppData\\Local\\Programs\\Fiddler\\Fiddler.exe",
          "?:\\Users\\*\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe",
          "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\OneDrive.exe",
          "?:\\Windows\\system32\\mobsync.exe",
          "?:\\Windows\\SysWOW64\\mobsync.exe"
        )
      ) or

      /* Discord App */
      (process.name : "Discord.exe" and (process.code_signature.subject_name : "Discord Inc." and
       process.code_signature.trusted == true) and dns.question.name : ("discord.com", "cdn.discordapp.com", "discordapp.com")
      ) or

      /* MS Sharepoint */
      (process.name : "Microsoft.SharePoint.exe" and (process.code_signature.subject_name : "Microsoft Corporation" and
       process.code_signature.trusted == true) and dns.question.name : "onedrive.live.com"
      ) or

      /* Firefox */
      (process.name : "firefox.exe" and (process.code_signature.subject_name : "Mozilla Corporation" and
       process.code_signature.trusted == true)
      ) or

      /* Dropbox */
      (process.name : "Dropbox.exe" and (process.code_signature.subject_name : "Dropbox, Inc" and
       process.code_signature.trusted == true) and dns.question.name : ("api.dropboxapi.com", "*.dropboxusercontent.com")
      ) or

      /* Obsidian - Plugins are stored on raw.githubusercontent.com */
      (process.name : "Obsidian.exe" and (process.code_signature.subject_name : "Dynalist Inc" and
       process.code_signature.trusted == true) and dns.question.name : "raw.githubusercontent.com"
      ) or

      /* WebExperienceHostApp */
      (process.name : "WebExperienceHostApp.exe" and (process.code_signature.subject_name : "Microsoft Windows" and
       process.code_signature.trusted == true) and dns.question.name : ("onedrive.live.com", "skyapi.onedrive.live.com")
      ) or

      (process.code_signature.subject_name : "Microsoft *" and process.code_signature.trusted == true and
       dns.question.name : ("*.sharepoint.com", "graph.microsoft.com", "g.live.com", "login.live.com", "login.live.com")) or

      (process.code_signature.trusted == true and
       process.code_signature.subject_name :
                             ("Johannes Schindelin",
                              "Redis Inc.",
                              "Slack Technologies, LLC",
                              "Cisco Systems, Inc.",
                              "Dropbox, Inc",
                              "Amazon.com Services LLC"))
    )

框架: MITRE ATT&CKTM