From ef7bd12d8a6c5c1136c084629f90d47ee28179f5 Mon Sep 17 00:00:00 2001 From: Andrew Pease Date: Thu, 5 Nov 2020 13:25:56 -0600 Subject: [PATCH 01/34] initial commit --- rfcs/text/0000-create-file-mach-o.md | 155 +++++++++++++++++++ rfcs/text/mach-o/mach-o.yml | 219 +++++++++++++++++++++++++++ 2 files changed, 374 insertions(+) create mode 100644 rfcs/text/0000-create-file-mach-o.md create mode 100644 rfcs/text/mach-o/mach-o.yml diff --git a/rfcs/text/0000-create-file-mach-o.md b/rfcs/text/0000-create-file-mach-o.md new file mode 100644 index 0000000000..856c65334e --- /dev/null +++ b/rfcs/text/0000-create-file-mach-o.md @@ -0,0 +1,155 @@ +# 0000: Create the Mach-O sub-field of the File fieldset + +- Stage: **0 (strawperson)** +- Date: **TBD** + +Create the Mach Object (Mach-O) sub-field, of the `file` top-level fieldset. This document metadata can be used for malware research, as well as coding and other application development efforts. + +## Fields + +**Stage 0** + +This RFC is to create the Mach-O sub-field within the `file.` fieldset. This will include 35 sub-fields. + +| Name | Type | Description | +|--------------------------------------------|------------|-----------------------------------------------------------------------------| +| file.mach-o.cpu | object | CPU information for the file. | +| file.mach-o.cpu.architecture | keyword | CPU architecture target for the file. | +| file.mach-o.cpu.byte_order | keyword | CPU byte order for the file. | +| file.mach-o.cpu.subtype | keyword | CPU subtype for the file. | +| file.mach-o.cpu.type | keyword | CPU type for the file. | +| file.mach-o.headers | object | Header information for the file. | +| file.mach-o.headers.commands | object | Header load commands for the file. | +| file.mach-o.headers.commands.number | long | Number of load commands for the Mach-O header. | +| file.mach-o.headers.commands.size | long | Size of load commands of the Mach-O header. | +| file.mach-o.headers.commands.type | keyword | Type of the load commands for the Mach-O header. | +| file.mach-o.headers.magic | keyword | Magic field of the Mach-O header. | +| file.mach-o.headers.flags | keyword | Flags set in the Mach-O header. | +| file.mach-o.segments | object | Segment information for the file. | +| file.mach-o.segments.vmaddr | keyword | Memory address of this segment. | +| file.mach-o.segments.name | keyword | Name of this segment. | +| file.mach-o.segments.vmsize | keyword | Memory size of this segment. | +| file.mach-o.segments.fileoff | keyword | File offset of this segment. | +| file.mach-o.segments.filesize | keyword | Amount of memory to map from the file. | +| file.mach-o.segments.sections | object | Section information for the segment of the file. | +| file.mach-o.segments.sections.flags | keyword | Section flags for the segment of the file. | +| file.mach-o.segments.sections.name | keyword | Section name for the segment of the file. | +| file.mach-o.segments.sections.type | keyword | Section type for the segment of the file. | +| file.mach-o.signature | object | Signature information for the file. | +| file.mach-o.signature.candidate_cd_hash | keyword | Code Digest (CD) SHA256 hash of the first 20-bytes of the file. | +| file.mach-o.signature.team_identifier | keyword | Team identifier of the code signing certificate. | +| file.mach-o.signature.sealed_resources | long | Version of the resource envelope for the code signing certificate. | +| file.mach-o.signature.cms_digest | keyword | Cryptographic Message Syntax (CMS) hash of the code signing certificate. | +| file.mach-o.signature.cms_digest_type | keyword | Cryptographic Message Syntax (CMS) type of the code signing certificate. | +| file.mach-o.signature.status | keyword | Verification information for the code signing certificate. | +| file.mach-o.signature.fingerprint | keyword | MD5 digest of the der-encoded certificate information. | +| file.mach-o.executable | object | Information about the executable segment for the file. | +| file.mach-o.executable.segment_base | keyword | Executable segment base size. | +| file.mach-o.executable.segment_limit | keyword | Executable segment limit size. | +| file.mach-o.executable.segment_flags | keyword | Executable segment flags. | +| file.mach-o.page_size | long | Page size of the file. | + + +**Stage 1** + +[New `mach-o.yml` candidate](mach-o/mach-o.yml)] + + + +## Usage + +**Stage 1** + +In performing file analysis, specifically for malware research, understanding file similarities can be used to chain together malware samples and families to identify campaigns and possibly attribution. Additionally, understanding how malware components are re-used is useful in understanding malware telemetry, especially in understanding the impact being made through the introduction of defensive countermeasures. + +As an example, if XDR vendors deploys a new malware model to defeat a specific type of ransomware and we start observing a change and/or relationship to the headers, import tables, libraries, etc of that malware family, we can make assumptions that the changes to the malware model are making an impact against the malware family. + +As another example, tracking file metadata for specific families is useful in predicting new campaigns if we see similar file metadata being used for new samples. [Example](https://www.bleepingcomputer.com/news/security/maze-ransomware-is-shutting-down-its-cybercrime-operation/), the Maze ransomware family shutting down and re-purposing as Egregor (this is for Windows malware, but the concept is the same). + +## Source data + +**Stage 1** + +This type of data can be provided by logs from VirusTotal, Reversing Labs, Lockheed Martin's LAIKABOSS, Emerson's File Scanning Framework, Target's Strelka, or other file/malware analysis platforms. + +* [VirusTotal API](https://developers.virustotal.com/v3.0/reference) +* [Emerson FSF](https://github.com/EmersonElectricCo/fsf) +* [Target Strelka](https://github.com/target/strelka) +* [Lockheed Martin LAIKABOSS](https://github.com/lmco/laikaboss) + + + + + + + +## Scope of impact + +**Stage 2** + +There should be no breaking changes, depreciation strategies, or significant refactoring as this is creating a sub-field for the existing `file.` fieldset. + +While likely not a large-scale ECS project, there would be documentation updates needed to explain the new fields. + + + +## Concerns + + + + + + + + + +## Real-world implementations + + + +## People + +The following are the people that consulted on the contents of this RFC. + +* @peasead | author +* @devonakerr | sponsor +* @dcode, @peasead | subject matter expert + +## References + + + +### RFC Pull Requests + + + +* Stage 0: https://github.com/elastic/ecs/pull/NNNN + + diff --git a/rfcs/text/mach-o/mach-o.yml b/rfcs/text/mach-o/mach-o.yml new file mode 100644 index 0000000000..2dbae8c96c --- /dev/null +++ b/rfcs/text/mach-o/mach-o.yml @@ -0,0 +1,219 @@ +--- +- name: file.mach-o + title: Mach-O file information. + group: 2 + description: > + These fields contain macOS Mach Object (Mach-O) metadata. + type: group + reusable: + top_level: false + expected: + - file + - process + fields: + - name: cpu + level: extended + description: CPU information for the file. + type: object + fields: + - name: architecture + description: CPU architecture target for the file. + type: keyword + level: extended + example: 64-bit + + - name: byte_order + description: CPU byte order for the file. + type: keyword + level: extended + example: Little endian + + - name: subtype + description: CPU subtype for the file. + type: keyword + level: extended + example: ARM (all) 64-bit + + - name: type + description: CPU type for the file. + type: keyword + level: extended + example: ARM 64-bit + + - name: headers + level: extended + description: Header information for the file. + type: object + fields: + - name: commands + level: extended + description: Header load commands information for the file. + type: object + fields: + - name: number + description: Number of load commands for the Mach-O header. + type: long + level: extended + example: 23 + + - name: size + description: Size of load commands of the Mach-O header. + type: long + level: extended + format: bytes + example: 3888 + + - name: type + description: Type of the load commands for the Mach-O header. + type: keyword + level: extended + example: LC_SYMTAB, 0x2c + + - name: magic + description: Magic field of the Mach-O header. + type: keyword + level: extended + example: 0xfeedfacf + + - name: flags + description: Flags set in the Mach-O header. + type: keyword + level: extended + example: TWOLEVEL, 0x4000000 + + - name: segments + level: extended + description: Segment information for the file. + type: object + fields: + - name: vmaddr + description: Memory address of this segment. + type: keyword + level: extended + example: 0x0 + + - name: name + description: Name of this segment. + type: keyword + level: extended + example: __TEXT, __DATA + + - name: vmsize + description: Memory size of this segment. + type: keyword + level: extended + example: 0x4c000 + + - name: fileoff + description: File offset of this segment. + type: keyword + level: extended + example: 0x0 + + - name: filesize + description: Amount of memory to map from the file. + type: keyword + level: extended + example: 0x4c000 + + - name: sections + level: extended + description: Section information for the segment of the file. + type: object + fields: + - name: flags + description: Section flags for the segment of the file. + type: keyword + level: extended + example: SECTION_ATTRIBUTES_USR, S_8BYTE_LITERALS + + - name: name + description: Section name for the segment of the file. + type: keyword + level: extended + example: __objc_classname, __stub_helper + + - name: type + description: Section type for the segment of the file. + type: keyword + level: extended + example: S_REGULAR, S_CSTRING_LITERALS + + - name: signature + level: extended + description: Signature information for the file. + type: object + fields: + - name: candidate_cd_hash + description: Code Digest (CD) SHA256 hash of the first 20-bytes of the file. + type: keyword + level: extended + example: 2035094a7065b29421e7a51f51db9bd61807c3628f210b1f8e667235777dc592 + + - name: team_identifier + description: Team identifier of the code signing certificate. + type: keyword + level: extended + example: 11A1A1AAAA + + - name: sealed_resources + description: Version of the resource envelope for the code signing certificate. + type: long + level: extended + example: 2 + + - name: cms_digest + description: Cryptographic Message Syntax (CMS) hash of the code signing certificate. + type: keyword + level: extended + example: 3ae1b10f231bee84ca17ab4295c0faaf6cbd535f3cc8010474ec6a67909e1980 + + - name: cms_digest_type + description: Cryptographic Message Syntax (CMS) type of the code signing certificate. + type: keyword + level: extended + example: 2 + + - name: status + description: Verification information for the code signing certificate. + type: keyword + level: extended + example: Valid + + - name: fingerprint + description: MD5 digest of the der-encoded certificate information. + type: keyword + level: extended + example: 611E5B662C593A08FF58D14AE22452D198DF6C60 + + - name: executable + level: extended + description: Information about the executable segment for the file. + type: object + fields: + - name: segment_base + description: Executable segment base size. + type: long + format: bytes + level: extended + example: 0 + + - name: segment_limit + description: Executable segment limit size. + type: long + format: bytes + level: extended + example: 123456 + + - name: segment_flags + description: Executable segment flags. + type: keyword + level: extended + example: 0x0 + + - name: page_size + description: Page size of the file. + type: long + format: bytes + level: extended + example: 4096 From 01075427362f83723b013873704ea5d54c15693d Mon Sep 17 00:00:00 2001 From: Andrew Pease Date: Thu, 5 Nov 2020 13:35:02 -0600 Subject: [PATCH 02/34] added PR# --- rfcs/text/0000-create-file-mach-o.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/text/0000-create-file-mach-o.md b/rfcs/text/0000-create-file-mach-o.md index 856c65334e..bfda62f023 100644 --- a/rfcs/text/0000-create-file-mach-o.md +++ b/rfcs/text/0000-create-file-mach-o.md @@ -147,7 +147,7 @@ The following are the people that consulted on the contents of this RFC. -* Stage 0: https://github.com/elastic/ecs/pull/NNNN +* Stage 0: https://github.com/elastic/ecs/pull/1097 -* Stage 0: https://github.com/elastic/ecs/pull/1097 +* Stage 1: https://github.com/elastic/ecs/pull/1097