码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • falco 【3】 default macro


    falco default macros

    tags: falco,安全

    文章目录

    • falco default macros
        • 为写入而打开的文件
        • 打开文件以供阅读
        • 从不真实
        • 永远真实
        • 进程名称已设置
        • 文件系统对象重命名
        • 已创建新目录
        • 文件系统对象已删除
        • 文件系统对象已修改
        • 新进程产生
        • 二进制文件的公共目录
        • Shell 已启动
        • 已知敏感文件
        • 新创建的进程
        • 出站网络连接
        • 入站网络连接
        • 对象是一个容器
        • 交互过程产生
        • 通用 SSH 端口
        • 允许的 SSH 主机
        • 用户列入白名单的容器
        • 允许生成shell的容器
        • 允许与 EC2 元数据服务通信的容器
        • Kubernetes API 服务器
        • 允许与 Kubernetes API 通信的容器
        • 允许与 Kubernetes 服务节点端口通信的容器

    上篇我们学习falco的规则运用,其中宏(macro)是指可重用方式定义规则的公共子部分的方法。
    Falco 规则集定义了许多宏,可以更轻松地开始编写规则。这些宏为许多常见场景提供了快捷方式,并且可以在任何用户定义的规则集中使用。Falco 还提供了应该由用户覆盖的宏,以提供特定于用户环境的设置。提供的宏也可以附加到本地规则文件中。

    为写入而打开的文件

    - macro: open_write
      condition: (evt.type=open or evt.type=openat) and evt.is_open_write=true and fd.typechar='f' and fd.num>=0
    
    • 1
    • 2

    打开文件以供阅读

    - macro: open_read
      condition: (evt.type=open or evt.type=openat) and evt.is_open_read=true and fd.typechar='f' and fd.num>=0
    
    • 1
    • 2

    从不真实

    - macro: never_true
      condition: (evt.num=0)
    
    • 1
    • 2

    永远真实

    - macro: always_true
      condition: (evt.num=>0)
    
    • 1
    • 2

    进程名称已设置

    - macro: proc_name_exists
      condition: (proc.name!="")
    
    • 1
    • 2

    文件系统对象重命名

    - macro: proc_name_exists
      condition: (proc.name!="")
    
    • 1
    • 2

    已创建新目录

    - macro: mkdir
      condition: evt.type = mkdir
    
    • 1
    • 2

    文件系统对象已删除

    - macro: remove
      condition: evt.type in (rmdir, unlink, unlinkat)
    
    • 1
    • 2

    文件系统对象已修改

    - macro: modify
      condition: rename or remove
    
    • 1
    • 2

    新进程产生

    - macro: spawned_process
      condition: evt.type = execve and evt.dir=<
    
    • 1
    • 2

    二进制文件的公共目录

    - macro: bin_dir
      condition: fd.directory in (/bin, /sbin, /usr/bin, /usr/sbin)
    
    • 1
    • 2

    Shell 已启动

    - macro: shell_procs
      condition: (proc.name in (shell_binaries))
    
    • 1
    • 2

    已知敏感文件

    - macro: sensitive_files
      condition: >
        fd.name startswith /etc and
        (fd.name in (sensitive_file_names)
         or fd.directory in (/etc/sudoers.d, /etc/pam.d))
    
    • 1
    • 2
    • 3
    • 4
    • 5

    新创建的进程

    - macro: proc_is_new
      condition: proc.duration <= 5000000000
    Inbound Network Connections
    - macro: inbound
      condition: >
        (((evt.type in (accept,listen) and evt.dir=<)) or
         (fd.typechar = 4 or fd.typechar = 6) and
         (fd.ip != "0.0.0.0" and fd.net != "127.0.0.0/8") and (evt.rawres >= 0 or evt.res = EINPROGRESS))
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    出站网络连接

    - macro: outbound
      condition: >
        (((evt.type = connect and evt.dir=<)) or
         (fd.typechar = 4 or fd.typechar = 6) and
         (fd.ip != "0.0.0.0" and fd.net != "127.0.0.0/8") and (evt.rawres >= 0 or evt.res = EINPROGRESS))
    
    • 1
    • 2
    • 3
    • 4
    • 5

    入站网络连接

    - macro: inbound_outbound
      condition: >
        (((evt.type in (accept,listen,connect) and evt.dir=<)) or
         (fd.typechar = 4 or fd.typechar = 6) and
         (fd.ip != "0.0.0.0" and fd.net != "127.0.0.0/8") and (evt.rawres >= 0 or evt.res = EINPROGRESS))
    
    • 1
    • 2
    • 3
    • 4
    • 5

    对象是一个容器

    - macro: container
      condition: container.id != host
    
    
    • 1
    • 2
    • 3

    交互过程产生

    - macro: interactive
      condition: >
        ((proc.aname=sshd and proc.name != sshd) or
        proc.name=systemd-logind or proc.name=login)
    
    • 1
    • 2
    • 3
    • 4

    通用 SSH 端口

    覆盖此宏以反映环境中提供 SSH 服务的端口。

    - macro: ssh_port
      condition: fd.sport=22
    
    • 1
    • 2

    允许的 SSH 主机

    覆盖此宏以反映可以连接到已知 SSH 端口(即堡垒或跳转框)的主机。

    - macro: allowed_ssh_hosts
      condition: ssh_port
    
    • 1
    • 2

    用户列入白名单的容器

    允许在特权模式下运行的白名单容器。

    - macro: user_trusted_containers
      condition: (container.image startswith sysdig/agent)
    
    • 1
    • 2

    允许生成shell的容器

    将允许生成 shell 的容器列入白名单,如果在 CI/CD 管道中使用容器,则可能需要这样做。

    - macro: user_shell_container_exclusions
      condition: (never_true)
    
    • 1
    • 2

    允许与 EC2 元数据服务通信的容器

    将允许与 EC2 元数据服务通信的容器列入白名单。默认值:任何容器。

    - macro: ec2_metadata_containers
      condition: container
    
    • 1
    • 2

    Kubernetes API 服务器

    在此处设置 Kubernetes API 服务的 IP。

    - macro: k8s_api_server
      condition: (fd.sip="1.2.3.4" and fd.sport=8080)
    
    • 1
    • 2

    允许与 Kubernetes API 通信的容器

    将允许与 Kubernetes API 服务通信的容器列入白名单。需要设置 k8s_api_server。

    - macro: k8s_containers
      condition: >
        (container.image startswith gcr.io/google_containers/hyperkube-amd64 or
        container.image startswith gcr.io/google_containers/kube2sky or
        container.image startswith sysdig/agent or
        container.image startswith sysdig/falco or
        container.image startswith sysdig/sysdig)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    允许与 Kubernetes 服务节点端口通信的容器

    - macro: nodeport_containers
      condition: container
    
    • 1
    • 2

    参考:

    • faloc Default Macros
  • 相关阅读:
    burp+IE 微信小程序抓包教程
    华为机试 - 考古学家
    服务器数据恢复—EqualLogic存储硬盘灯亮黄色的数据恢复案例
    【C++】set & multiset
    『LeetCode|每日一题』---->三数之和
    node.js part1
    js函数相关知识详解
    层次分明井然有条,Go lang1.18入门精炼教程,由白丁入鸿儒,Go lang包管理机制(package)EP10
    Go开源世界主流成熟ORM框架gorm实践分享
    (附源码)ssm医疗管理系统 毕业设计 260952
  • 原文地址:https://blog.csdn.net/xixihahalelehehe/article/details/126183489
  • 最新文章
  • 【FHE】我们如何实现同态加密推理(八):SiLU 的密文化——两条路径,和一个 8 字节的开关
    SQLcl 中 c/old/new 替换变量为何失效?先定位再替换
    不让模型写作文,直接从它脑子里读答案:Jev 决策在 .NET 的两条路线
    Halo插件:支持GitHub的图床附件策略
    电视投屏界的“一股清流”!SimpleTVCast 6.0.0-beta 抢先体验:无需TV端App,界面大换血!✨
    华三VXLAN集中式网关实战指南:Spine多活网关 + 双活接入(M-LAG)
    软件更好写之后口碑会更重要
    大 O、大 Omega、大 Theta 的区别,O(n) 复杂度是什么意思
    Java标签跳转:一个鲜为人知但却很实用的小技巧
    多智能体系统论文速读
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号