Falco는 클라우드 네이티브 컴퓨팅 재단(CNCF)의 인큐베이팅 프로젝트로, 시스템 동작을 감시하고 비정상적인 행위를 탐지하는 강력한 런타임 보안 도구입니다. 특히 컨테이너와 쿠버네티스 환경의 보안을 강화하는 데 최적화되어 있습니다.

CKS 시험에서 Falco는 런타임 보안(Runtime Security) 분야의 핵심 도구입니다. 시험에서는 주로 컨테이너 환경에서 발생할 수 있는 비정상적인 행위를 탐지하는 룰을 만들거나 수정하는 문제가 출제됩니다.

https://falco.org/docs/concepts/rules/basic-elements/ 

 

Basic Elements of Falco Rules

Understand Falco Rules, Lists and Macros

falco.org

 

대표적인 룰 설정

1. 쉘(Shell)이 컨테이너 내에서 실행될 때 탐지하는 룰

이 룰은 CKS에서 가장 기본적인 유형입니다. 운영 중인 컨테이너에서 쉘이 실행되는 것은 일반적으로 디버깅 목적이거나, 공격자가 컨테이너에 침투한 후 명령을 내리기 위한 행위일 수 있어 중요한 보안 위협입니다.

- rule: Shell in a Container
  desc: A shell was used as the entrypoint/exec point into a container with an attached terminal.
  condition: >
    spawned_process and container and proc.name in (shell_binaries)
  output: >
    A shell was spawned in a container (user=%user.name container_id=%container.id container_name=%container.name shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline)
  priority: WARNING
  • condition:
    • spawned_process: 새로운 프로세스가 생성되는 이벤트를 탐지하는 매크로입니다.
    • container: 이벤트가 호스트가 아닌 컨테이너에서 발생했음을 확인하는 매크로입니다.
    • proc.name in (shell_binaries): 실행된 프로세스의 이름이 sh, bash, zsh 등 쉘 바이너리 목록에 포함되는지를 확인합니다.
  • output: 룰이 트리거되면 output에 정의된 상세한 정보(사용자, 컨테이너 ID, 쉘 이름 등)를 로그에 남깁니다.
  • priority: 경고의 심각도를 WARNING으로 설정합니다.

 

2. 민감한 파일에 접근할 때 탐지하는 룰

/etc/shadow나 /dev/mem과 같이 중요한 시스템 파일에 접근하는 것은 악의적인 의도일 가능성이 높습니다. CKS 시험에서는 이러한 파일에 대한 접근을 탐지하도록 룰을 수정하거나 새로 만들도록 요구할 수 있습니다.

/etc/shadow 파일 접근 탐지:

- rule: Read sensitive file trusted by host
  desc: Detect attempts to read host sensitive files from a container.
  condition: >
    open_read and container and fd.name in (/etc/shadow, /etc/gshadow)
  output: >
    Sensitive file accessed (user=%user.name process=%proc.name container_id=%container.id file=%fd.name)
  priority: CRITICAL
  • condition:
    • open_read: 파일을 읽기 모드로 여는 이벤트를 탐지하는 매크로입니다.
    • fd.name in (...): 열린 파일의 경로가 /etc/shadow 또는 /etc/gshadow일 때를 조건으로 합니다.

/dev/mem 파일 접근 탐지:

- rule: devmem
  desc: Access to /dev/mem
  condition: >
    fd.name = /dev/mem
  output: >
    Access to /dev/mem (user=%user.name process=%proc.name container_id=%container.id)
  priority: WARNING
  • condition: fd.name = /dev/mem이라는 매우 직관적인 조건으로 /dev/mem 파일에 대한 접근을 탐지합니다.

 

3. 컨테이너에서 네트워크 연결이 생성될 때 탐지하는 룰

컨테이너가 예상치 않은 외부 네트워크에 연결을 시도하는 경우를 탐지하는 룰입니다. 특히 외부로의 데이터 유출(egress)을 막는 데 유용합니다.

- rule: Outbound Connection
  desc: Detects when a container makes an outbound network connection.
  condition: >
    evt.type = connect and container and evt.dir=<
  output: >
    Outbound connection from container (user=%user.name container_id=%container.id proc_name=%proc.name dest_ip=%fd.cip dest_port=%fd.cport)
  priority: NOTICE
  • condition:
    • evt.type = connect: 네트워크 연결(socket connect) 이벤트가 발생했음을 탐지합니다.
    • evt.dir=<: 이벤트가 시스템 호출(syscall)로 들어오고 있음을 의미합니다

 

4. 컨테이너에서 새로운 프로세스를 실행할 때 사용되는 시스템 호출

컨테이너 에서 새로은 프로세스가 사용될때 탐지하는 룰 입니다.

- rule: Any process in a specific container
  desc: Detects any process execution inside the 'my-web-app' container.
  condition: >
    evt.type = execve and container.name = "my-web-app"
  output: >
    Process '%proc.name' started in container '%container.name' (user=%user.name cmdline=%proc.cmdline)
  priority: INFO
  • condition:
    • evt.type = execve: 새로운 프로세스 실행을 탐지합니다.
    • container.name: 컨테이너 이름을 지정해서 탐지합니다.

 

 

 

+ Recent posts