Falco Rules

repository·main·Indexed 41 days ago

https://github.com/falcosecurity/rules

The officially managed repository of Falco Rules and the Falco Rules Files Registry. It provides pre-defined security detections for syscalls and container events to monitor for threats and compliance. Rules are categorized by maturity levels: Stable (default), Incubating, and Sandbox. The collection includes main rules, application rules, and plugin rules for various data sources.

Tokens
3.5K
Snippets
3
Records
14
Agent score
2%

What's inside Falco Rules

  1. Overview of Falco Rules

    main

    Falco rules are pre-defined detections used by Falco to monitor for security threats, abnormal behaviors, and compliance-related events. These rules primarily focus on syscalls and container events.

    Key Considerations for Users:

    • Customization: Users are encouraged to modify community-contributed rules or create their own custom rules to fit specific needs.
    • Plugin Rules: Rules for Falco plugins are not in this repository; they are located in the subfolders of the Falco Plugins repository.
    • Maturity Levels: Rules are categorized by maturity. Rules marked as maturity_stable in rules/falco_rules.yaml are included in the standard Falco release package. Other maturity levels (like Sandbox or Incubating) are released separately and require explicit installation and potential customization.
    • Compatibility: The Falco Project guarantees compatibility between the most recent rules release and the latest Falco release. It is recommended to use the most recent Falco release to avoid issues.
    • Development vs. Stable: The main branch contains the latest development. For production use, it is recommended to use rules from the release branches to avoid incompatibilities caused by changes like new output fields.
  2. Overview of Falco Rules Management and Resources

    main

    Falco rules are managed through a combination of community contributions, official documentation, and lifecycle management tools.

    Rule Creation and Contribution

    • Writing Rules: Detailed guidance on how to write rules, including references for supported fields in conditions and outputs, is available on the Falco documentation website.
    • Contributing: Community members contribute new rules by opening a Pull Request (PR) against the falcosecurity/rules repository.

    Rule Lifecycle Management

    • falcoctl: Use the falcoctl CLI tool to manage the lifecycle of rules, including installation and updates.

    Existing Rule Types

    Rules are distributed in various YAML files depending on their source and scope:

    • Main Rules (falco_rules.yaml): Based on syscall and container events.
    • Application Rules (application_rules.yaml): Contains rules based on network-related syscalls.
    • Plugin Rules: Rules based on third-party data sources (e.g., k8s_audit_rules.yaml, github.yaml, okta_rules.yaml, aws_cloudtrail_rules.yaml).

    Rule Metadata and Structure

    Rules include specific metadata to assist with filtering and prioritization:

    • priority: Determines the level at which rules should be loaded and activated.
    • tag: Provides additional filter fields and information. Tags may indicate if a rule targets host-level or container-level workloads and can include MITRE ATT&CK phase and TTP (Tactics, Techniques, and Procedures) codes.
  3. Falco Rules Naming Convention

    main

    This repository follows a specific naming convention for rule files and Git tags to facilitate the Falco Rules Files Registry. Note that this convention is specific to this repository and is not enforced by the Falco application itself.

    Rule File Naming

    Rule files must be located in the /rules folder and follow the pattern: <ruleset>_rules.yaml

    • <ruleset> must be an alphanumeric string.
    • It must be entirely lowercase.
    • It must begin with a letter.
    • It can use hyphens (-) as separators.

    Example: falco_rules.yaml for the falco ruleset.

    Git Tag Naming

    Rule files are released using Git tags following the pattern: <ruleset>-rules-<version>

    Example: falco-rules-1.0.0 for the falco ruleset version 1.0.0.

  4. Understand Falco rule maturity levels

    main

    Falco rules are categorized by a maturity framework to help users decide which rules to adopt as-is and which require engineering effort to tune. Rules are tagged with specific maturity levels that indicate their robustness, relevance, and stability:

    • maturity_stable: Enabled by default. These rules are evaluated by experts, follow best practices, and are highly robust against bypasses. They focus on universal, system-level detections (e.g., generic reverse shells, container escapes) and provide a solid baseline.
    • maturity_incubating: Disabled by default. These rules address relevant threats and follow best practices but are often more application-specific. They may require more tuning to fit your specific environment.
    • maturity_sandbox: Disabled by default. Experimental rules used for inspiration or to assess potential broader usefulness.
    • maturity_deprecated: Disabled by default. Rules deemed less applicable to the community. They are kept as examples but are no longer actively supported or tuned by The Falco Project.

    Note: Maturity level does not directly correlate to the amount of noise (false positives) a rule generates; noise levels depend on your specific environment.

  5. Understand the Falco Rules tiers (Stable, Incubating, Sandbox)

    main

    Since version 2.0.0, Falco rules are categorized into three distinct tiers based on their maturity and use case suitability. You can choose which tiers to load into your Falco distribution:

    • Stable: Vetted by the community and bundled with Falco by default. These are the most reliable rules.
    • Incubating: Rules that offer a level of robustness but are intended for specific use cases that may not apply to every user.
    • Sandbox: Experimental rules that are highly specialized or in early development.

    When configuring Falco, you should decide which of these tiers are appropriate for your security requirements.

  6. Understand Falco's detection capabilities and limitations

    main

    When designing your security monitoring strategy, it is important to understand what Falco is optimized for and where its visibility ends.

    Primary Use Cases

    • Threat Detection: Identifying indicators of compromise and suspicious system activities.
    • Compliance: Monitoring for activities required by regulatory frameworks (rules may be tagged with compliance tags).

    Capabilities and Limitations

    CapabilityDescription
    Kernel-level MonitoringFalco monitors system calls and observable kernel events. It does not provide deep visibility into all internal kernel structures.
    Network MonitoringFalco detects network-related system calls. It is not a network packet inspection tool and faces limitations with L3/4 monitoring in cloud architectures using load balancers.
    Application MonitoringFalco focuses on the Linux kernel and system-level activities. While it can be extended via the plugins framework (e.g., Kubernetes audit logs), it does not provide full-stack application monitoring out of the box.
    Anomaly DetectionFalco excels at detecting known patterns and rule-based anomalies. It has limitations in identifying zero-day exploits or performing advanced host-based anomaly detection that does not follow known patterns.
  7. Identify robust and behavioral-based rules

    main

    Robust Falco rules move away from simple signature matching and instead focus on behavioral indicators and preconditions.

    Characteristics of Robust Rules

    • Use of Preconditions: Verifying necessary privileges (e.g., checking if a container has specific capabilities) before triggering an alert. This ensures the TTP (Tactic, Technique, or Procedure) is actually feasible.
    • Behavioral Focus: Instead of checking for specific file paths (which can be easily changed by an attacker), focus on high-value kernel signals.

    Examples of Robust Patterns

    • Container Escapes: Rather than just looking for a specific file, a robust rule might monitor open syscalls for specific filenames (like release_agent) while verifying the container's privileges via preconditions.
    • Suspicious Executions: Instead of inspecting all unusual executable paths, focus on identifying executables that were not part of the original container image and were executed from the container's upper overlayfs layer shortly after being dropped.
  8. Identify Falco rule use cases

    main

    Falco rules are primarily categorized into two main use cases to help adopters understand how to leverage them:

    1. Threat Detection: Rules where violations serve as indicators of compromise (IoC).
    2. Compliance: Rules designed to detect unauthorized changes to files or system states to meet regulatory requirements (e.g., PCI/DSS).

    Compliance-related rules are tagged accordingly in the rule metadata, similar to how rules are tagged with Mitre ATT&CK phases.

  9. Registering a new Rules file in the Registry

    main

    To share a ruleset with the community and ensure it meets technical constraints, you can register it in the registry.yaml file by submitting a Pull Request to this repository.

    Constraints for Registration

    • name: Must be unique across the entire registry and match the regex ^[a-z]+[a-z0-9-_\-]*$. (Using underscores _ is discouraged).
    • path: Must specify the path to the rule file within this repository.
    • url: Must point to the ruleset file in the source code.

    Example Registry Entry

    - name: falco-rules
      description: Falco rules that are loaded by default
      authors: The Falco Authors
      contact: https://falco.org/community
      maintainers:
        - name: The Falco Authors
          email: cncf-falco-dev@lists.cncf.io
      path: rules/falco_rules.yaml
      license: apache-2.0
      url: https://github.com/falcosecurity/rules/blob/main/rules/falco_rules.yaml
    - name: falco-rules
      description: Falco rules that are loaded by default
      authors: The Falco Authors
      contact: https://falco.org/community
      maintainers:
        - name: The Falco Authors
          email: cncf-falco-dev@lists.cf@lists.cncf.io
      path: rules/falco_rules.yaml
      license: apache-2.0
      url: https://github.com/falcosecurity/rules/blob/main/rules/falco_rules.yaml
  10. Install Falco rules via Helm Chart

    main

    If you are using the official Falco Helm chart, you can include Incubating and Sandbox rules by configuring falcoctl and the falco.yaml settings.

    To install the Helm chart and load all available rule tiers (Stable, Incubating, and Sandbox) with automatic updates enabled, use the following command. This configuration uses falcoctl.config.artifact.install.refs to download the rules at startup, falcoctl.config.artifact.follow.refs to enable automatic updates, and falco.rules_file to tell the Falco engine which files to load.

    helm install falco falcosecurity/falco \
      --set "falcoctl.config.artifact.install.refs={falco-rules:2,falco-incubating-rules:2,falco-sandbox-rules:2}" \
      --set "falcoctl.config.artifact.follow.refs={falco-rules:2,falco-incubating-rules:2,falco-sandbox-rules:2}" \
      --set "falco.rules_file={/etc/falco/k8s_audit_rules.yaml,/etc/falco/rules.d,/etc/falco/falco_rules.yaml,/etc/falco/falco-incubating_rules.yaml,/etc/falco/falco-sandbox_rules.yaml}"
  11. Tune Falco rules for your environment

    main

    Tuning Falco rules helps reduce noise and increase detection precision. Depending on your environment, you can use the following strategies:

    Profiling

    Profile your environment to identify behaviors that are normal for system-critical applications but would be considered outliers in standard applications. A common technique is implementing an allow list for specific container names or namespaces. This is particularly useful when defining 'crown jewel' applications that require robust, high-fidelity detections.

    Behavioral Indicators

    Refine detections by incorporating Linux behavioral concepts. Instead of relying on simple signatures, tune rules based on process lineage or specific activity patterns, such as:

    • Detecting the presence of a shell or a Java process in a parent process lineage.
    • Detecting file manipulations that occur during manual interactive shell access to a container.

    Beyond On-Host Tuning

    In complex environments, on-host rule tuning may have limitations. For advanced operationalization, consider leveraging data lake systems to perform additional data analysis and contextual correlation of the alerts generated by Falco.

  12. Install Falco rules via Host installation

    main

    For manual host installations, you can add Incubating or Sandbox rules by downloading them from the rules repository, uncompressing them, and placing them in your Falco rules directory.

    Ensure that the rule files are included in the rules_file configuration option within your falco.yaml. Typically, you can also use a rules.d directory to manage extra or custom rule files.