连接到常用滥用 Web 服务编辑

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

规则类型: eql

规则索引:

  • logs-endpoint.events.network-*

严重性: 低

风险评分: 21

每隔: 5 分钟运行一次

从以下时间开始搜索索引: now-9m(日期数学格式,另请参阅 其他回溯时间

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

参考: 无

标签:

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

版本: 113

规则作者:

  • Elastic

规则许可证: Elastic 许可证 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"}}
  • 验证可执行文件中是否存在数字签名。
  • 识别操作类型(上传、下载、隧道传输等)。
  • 检查主机是否存在表明可疑活动的派生工件
  • 使用私有沙盒分析系统分析进程可执行文件。
  • 在沙盒和警报主题主机中观察并收集有关以下活动的的信息
  • 尝试联系外部域和地址。
  • 通过按进程的 process.entity_id 进行过滤,使用 Elastic Defend 网络事件来确定受试进程联系的域和地址。
  • !{investigate{"label":"调查受试进程网络事件","providers":[[{"excluded":false,"field":"process.entity_id","queryType":"phrase","value":"{{process.entity_id}}","valueType":"string"},{"excluded":false,"field":"event.category","queryType":"phrase","value":"network","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、反向代理或 dropper。
  • 删除和阻止分流期间识别的恶意工件。
  • 运行完整的反恶意软件扫描。这可能会揭示系统中留下的其他工件、持久性机制和恶意软件组件。
  • 确定攻击者滥用的初始媒介,并采取措施防止通过相同的媒介重新感染。
  • 使用事件响应数据,更新日志记录和审计策略,以改善平均检测时间 (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") 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