From 68fd03838cc2e167d08cbc1c7f534d34a8df4246 Mon Sep 17 00:00:00 2001 From: Michal Stanek <75310947+stanek-michal@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:11:23 +0200 Subject: [PATCH 1/3] Add Stage0 RFC for new fields for fileless execution on Linux (#2322) --- rfcs/text/0047-fileless-execution-linux.md | 132 +++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 rfcs/text/0047-fileless-execution-linux.md diff --git a/rfcs/text/0047-fileless-execution-linux.md b/rfcs/text/0047-fileless-execution-linux.md new file mode 100644 index 0000000000..8ab161511d --- /dev/null +++ b/rfcs/text/0047-fileless-execution-linux.md @@ -0,0 +1,132 @@ +# 0047: Fileless execution on Linux + + +- Stage: **0 (strawperson)** +- Date: **2024-09-26** + + + + + +This RFC proposes adding new fields and event types to enhance the detection of fileless malware execution and related malicious activities on Linux systems. + +The new fields include: + * file.is_memfd - Indicates if the file is an anonymous file descriptor (memfd) created using the memfd_create system call. + * file.is_shmem - Indicates if the file is a POSIX shared memory object created using the shm_open system call, typically located in /dev/shm. + * process.is_setuid - Indicates if the process has the setuid bit set, allowing it to run with the privileges of its owner. + * process.is_setgid - Indicates if the process has the setgid bit set, allowing it to run with the privileges of its group. + * process.is_memfd - Indicates if the process was executed from a memory file descriptor (memfd). + * process.inode_nlink - Number of links to the inode of the process executable file, obtained from the i_nlink variable in the inode structure. + +New process event types: + * memfd_create + * shmget (SystemV shared memory API) + * ptrace + * load_module + +New file event types: + * memfd_open + * shmem_open + +These additions will enable the detection and investigation of various malware execution techniques, such as executing code from memory file descriptors (memfd), hiding malicious binaries in shared memory objects (shm_open and shmget), debugging other processes for code injection (ptrace), and loading kernel modules for rootkits (load_module). The proposed fields also cover privilege escalation using setuid/setgid binaries. + + + + + +## Fields + + + + + +## Usage + + + +## Source data + +The data can be collected by monitoring system calls and events on Linux hosts using kernel instrumentation techniques like eBPF or kprobes. + + + + + + + +## Scope of impact + + + +## Concerns + + + + + + + +## People + +The following are the people that consulted on the contents of this RFC. + + * @stanek-michal | author + + + + +## References + + + +### RFC Pull Requests + + + + From 312f5d5438c0c2d744b56da1763414ddd17ec2ec Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:00:22 -0700 Subject: [PATCH 2/3] Update actions/checkout digest to eef6144 (#2389) Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc2d5276c5..829db21779 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-22.04 name: Unit Tests steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 with: python-version: '3.x' From 8a2c649b8ead839848750bcea085b6a755a5ba46 Mon Sep 17 00:00:00 2001 From: Asuka Nakajima Date: Wed, 16 Oct 2024 05:13:18 +0900 Subject: [PATCH 3/3] [RFC] Stage 0: Introducing new fields in file/dll/process fields (#2387) --------- Co-authored-by: Michael Wolf --- rfcs/text/0048-fileorigin-fields.md | 143 ++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 rfcs/text/0048-fileorigin-fields.md diff --git a/rfcs/text/0048-fileorigin-fields.md b/rfcs/text/0048-fileorigin-fields.md new file mode 100644 index 0000000000..85622991b7 --- /dev/null +++ b/rfcs/text/0048-fileorigin-fields.md @@ -0,0 +1,143 @@ +# 0048: File Origin Fields + + +- Stage: **0 (strawperson)** +- Date: **2024-10-15** + + + + + +It is known that when downloading files from the internet using a web browser (eg. Chrome, Edge, etc), information about the file's source is added to the file. +In Windows, it is known as the Mark of the Web and stored in file's Alternate Data Stream (ADS). In MacOS, it is stored in file's extended file attributes (metadata). + +For example, in Windows, when you download an image file (`image17.webp`) from [this webpage](https://www.elastic.co/security-labs/pikabot-i-choose-you) using a web browser, the download source URL is automatically added to the file's Alternate Data Stream (ADS) as following. + +image + +* Inside `image17.webp:Zone.Identifier:$DATA` +image + +In ensuring endpoint security, the origin information of a file is crucial for determining whether a downloaded file or executable from the internet comes from a safe source and if it is safe to execute. + +Thus, this PR adds new fields to store the URL of the file's origin information for `file`, `process`, and `dll`. +The ReferrerUrl is intended to be stored in the `origin_referrer_url` field, and the `HostUrl` is inteded to be stored in the `origin_url` field. The ZoneId is intended to be stored in the `zone_identifier` field. + + + + + +## Fields + + + +The new fields proposed are: + +Field | Type | Description /Usage +-- | -- | -- +file.origin_referrer_url | keyword | The URL of the webpage that linked to the file. +file.origin_url | keyword | The URL where the file is hosted. +file.zone_identifier | short | Numerical identifier that indicates the security zone of a file's origin. +process.origin_referrer_url | keyword | The URL of the webpage that linked to the file. +process.origin_url | keyword | The URL where the file is hosted. +process.zone_identifier | short | Numerical identifier that indicates the security zone of a file's origin. +dll.origin_referrer_url | keyword | The URL of the webpage that linked to the file. +dll.origin_url | keyword | The URL where the file is hosted. +dll.zone_identifier | short | Numerical identifier that indicates the security zone of a file's origin. + + + +## Usage + + + +## Source data + + + + + + + +## Scope of impact + + + +## Concerns + + + + + + + +## People + +The following are the people that consulted on the contents of this RFC. + +* @AsuNa-jp | author +* @joe-desimone +* @trisch-me +* @mjwolf + + + + +## References + + + + +### RFC Pull Requests + + + +* Stage 0: https://github.com/elastic/ecs/pull/2387 + +