From 83331dca00d4d98a07153c19379bf64d058ebe1d Mon Sep 17 00:00:00 2001 From: tomchop Date: Mon, 26 Oct 2026 00:15:42 +0100 Subject: [PATCH 1/3] Update website, schemas, and tooling for DFIQ 1.1.0 --- .github/workflows/yamale.yml | 9 +- README.md | 4 - dfiq/dfiq.py | 295 ++++++++------ dfiq/templates/approach_glossary.jinja2 | 103 ++--- .../templates/question_with_approaches.jinja2 | 185 ++++----- dfiq/templates/questions_index.jinja2 | 2 +- dfiq/templates/scenario.jinja2 | 41 +- dfiq/utils/approach_spec.yaml | 37 -- dfiq/utils/facet_spec.yaml | 6 +- dfiq/utils/question_spec.yaml | 25 +- dfiq/utils/scenario_spec.yaml | 4 +- pyproject.toml | 2 +- site/docs/contributing/approach_glossary.md | 114 +++--- site/docs/contributing/specification.md | 341 ++++++---------- site/docs/contributing/specification_1_0_1.md | 343 ++++++++++++++++ site/docs/index.md | 14 +- site/docs/questions/Q1001.md | 382 +++++++----------- site/docs/questions/Q1018.md | 259 +++++------- site/docs/questions/Q1019.md | 54 +-- site/docs/questions/Q1020.md | 147 +++---- site/docs/questions/Q1024.md | 58 +-- site/docs/questions/Q1036.md | 167 +++----- site/docs/questions/Q1037.md | 247 +++-------- site/docs/questions/Q1074.md | 155 +++---- site/docs/questions/index.md | 48 +-- site/docs/scenarios/index.md | 4 +- site/mkdocs.yml | 26 ++ 27 files changed, 1442 insertions(+), 1630 deletions(-) delete mode 100644 dfiq/utils/approach_spec.yaml create mode 100644 site/docs/contributing/specification_1_0_1.md diff --git a/.github/workflows/yamale.yml b/.github/workflows/yamale.yml index f0a5f18..7f8696d 100644 --- a/.github/workflows/yamale.yml +++ b/.github/workflows/yamale.yml @@ -16,9 +16,8 @@ jobs: python -m pip install --upgrade pip pip install poetry poetry add yamale - - name: Validate Scenarios YAML + - name: Validate DFIQ YAML run: | - poetry run yamale -s utils/scenario_spec.yaml ./data/scenarios - poetry run yamale -s utils/facet_spec.yaml ./data/facets - poetry run yamale -s utils/question_spec.yaml ./data/questions - poetry run yamale -s utils/approach_spec.yaml ./data/approaches + poetry run yamale -s dfiq/utils/scenario_spec.yaml ./dfiq/data/scenarios + poetry run yamale -s dfiq/utils/facet_spec.yaml ./dfiq/data/facets + poetry run yamale -s dfiq/utils/question_spec.yaml ./dfiq/data/questions diff --git a/README.md b/README.md index c6b8b6c..bb420ec 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,6 @@ DFIQ Logo ---- -**Note:** This repository is currently under review for updates to align with DFIQ 1.1 and to ensure the website is up-to-date. (Last reviewed: 2026-03-10) ---- - DFIQ is a collection of Digital Forensics Investigative Questions and the approaches to answering them. The goal of the project is to build a comprehensive catalog of investigative knowledge to help drive consistent, thorough, and explainable investigations. diff --git a/dfiq/dfiq.py b/dfiq/dfiq.py index e505d91..e082b57 100644 --- a/dfiq/dfiq.py +++ b/dfiq/dfiq.py @@ -32,54 +32,50 @@ class Component(object): """Base class for DFIQ components. Components are the building blocks of DFIQ. They represent different logical - entities: Scenarios, Facets, Questions, and Approaches. This base class - defines the attributes that all components share. + entities: Scenarios, Facets, and Questions. This base class defines the + attributes that all components share. Attributes: - id (str): The unique ID of the component, as described at dfiq.org/spec. + id (str, optional): The DFIQ ID of the component, as described at dfiq.org/spec. + uuid (str): The unique UUID of the component. name (str): The name of the component, often in the form of a question. description (str, optional): A few sentence description of the component. type (str, optional): The type of component. tags (set[str], optional): A set of tags associated with the component. - parent_ids (set[str], optional): A set of IDs of the component's parents. - child_ids (set[str], optional): A set of IDs of the component's children. + parent_ids (set[str], optional): A set of IDs or UUIDs of the component's parents. + child_ids (list[str], optional): A list of IDs of the component's children. is_internal (bool): Whether the component is private and for internal use only. Methods: - set_children(child_ids: set[str]): Sets the component's children. + set_children(child_ids: list[str]): Sets the component's children. """ def __init__( self, - dfiq_id: str, + dfiq_id: str | None, uuid: str, name: str, description: str | None = None, - tags: set[str] | None = None, - parent_ids: set[str] | None = None, + tags: set[str] | list[str] | None = None, + parent_ids: set[str] | list[str] | None = None, + internal: bool = False, ) -> None: self.id = dfiq_id self.uuid = uuid self.name = name.rstrip() self.description = description self.type = None - self.tags = tags - self.parent_ids = parent_ids - self.child_ids = None - self.is_internal = False - - if not self.tags: - self.tags = set() + self.tags = set(tags) if tags else set() + self.parent_ids = set(parent_ids) if parent_ids else set() + self.child_ids = [] + self.is_internal = bool(internal) self.all_tags = set(self.tags) - if not self.parent_ids: - self.parent_ids = set() - if isinstance(description, str): self.description = description.rstrip() - if self.id[1] == "0": + if self.id and len(self.id) > 1 and self.id[1] == "0": self.is_internal = True def set_children(self, child_ids: list) -> None: @@ -87,36 +83,61 @@ def set_children(self, child_ids: list) -> None: self.child_ids = child_ids -class Approach(Component): +class Approach(object): """An Approach in DFIQ. Approaches are detailed explanations of how to answer a Question using a specific - method, including the required data, processing, and analysis steps. As there - is often more than one way to answer a question, there can be multiple Approaches - that answer a given Question using different techniques. + method, including the required data collection, processing, and analysis steps. + As there is often more than one way to answer a question, there can be multiple + Approaches that answer a given Question using different techniques. Attributes: - view (dict): A concise representation of how to perform this investigative approach. + name (str): The name of the approach. + description (str, optional): A detailed description of the approach. + tags (list[str]): A list of tags associated with the approach. + references (list[str]): Public reference links for the approach. + references_internal (list[str]): Internal reference links for the approach. + notes (dict): Coverage notes ('covered' and 'not_covered'). + steps (list[dict]): Ordered list of investigative steps (collection, processing, analysis). type (str): The type of component, which is always "approach". + is_internal (bool): Whether the approach is internal. """ def __init__( self, - dfiq_id: str, - uuid: str, name: str, - description: str, - tags: set[str] | None, - view: dict, + description: str | None = None, + tags: list[str] | None = None, + references: list[str] | None = None, + references_internal: list[str] | None = None, + notes: dict | None = None, + steps: list[dict] | None = None, + internal: bool = False, ) -> None: - super().__init__( - dfiq_id, uuid, name, description, tags, parent_ids={dfiq_id.split(".")[0]} + self.name = name.rstrip() + self.description = ( + description.rstrip() if isinstance(description, str) else description ) - self.view = view + self.tags = tags or [] + self.references = references or [] + self.references_internal = references_internal or [] + self.notes = notes or {} + self.steps = steps or [] self.type = "approach" - - if self.id[6] == "0": - self.is_internal = True + self.is_internal = bool(internal) + + @classmethod + def from_dict(cls, data: dict) -> "Approach": + return cls( + name=data["name"], + description=data.get("description"), + tags=data.get("tags"), + references=data.get("references"), + references_internal=data.get("references_internal"), + notes=data.get("notes"), + steps=data.get("steps"), + internal=data.get("internal", False), + ) class Question(Component): @@ -128,33 +149,38 @@ class Question(Component): Attributes: type (str): The type of component, which is always "question". + approaches (list[Approach]): All Approaches associated with the Question. """ def __init__( self, - dfiq_id: str, + dfiq_id: str | None, uuid: str, name: str, description: str | None, - tags: set[str] | None, - parent_ids: set[str], + tags: set[str] | list[str] | None, + parent_ids: set[str] | list[str] | None, + approaches: list[Approach] | None = None, + internal: bool = False, ) -> None: - super().__init__(dfiq_id, uuid, name, description, tags, parent_ids) + super().__init__( + dfiq_id, uuid, name, description, tags, parent_ids, internal=internal + ) self.type = "question" - - @property - def approaches(self) -> set[str]: - """All Approaches associated with a given Question.""" - return self.child_ids + self.approaches = approaches or [] + for approach in self.approaches: + if approach.tags: + self.all_tags.update(approach.tags) class Facet(Component): """A Facet in DFIQ. - Facets are used for intermediate-level grouping in DFIQ. A particular Facet can - be part of multiple different Scenarios and will contain multiple Questions. A - Facet breaks the larger Scenario into smaller logical pieces, but a Facet is - still too broad to answer directly; it must also be broken down (into Questions). + Facets are used for optional intermediate-level grouping in DFIQ. A particular + Facet can be part of multiple different Scenarios and will contain multiple + Questions. A Facet breaks the larger Scenario into smaller logical pieces, but + a Facet is still too broad to answer directly; it must also be broken down + (into Questions). Attributes: type (str): The type of component, which is always "facet". @@ -162,18 +188,21 @@ class Facet(Component): def __init__( self, - dfiq_id: str, + dfiq_id: str | None, uuid: str, name: str, description: str | None, - tags: set[str] | None, - parent_ids: set[str], + tags: set[str] | list[str] | None, + parent_ids: set[str] | list[str] | None, + internal: bool = False, ) -> None: - super().__init__(dfiq_id, uuid, name, description, tags, parent_ids) + super().__init__( + dfiq_id, uuid, name, description, tags, parent_ids, internal=internal + ) self.type = "facet" @property - def questions(self) -> set[str]: + def questions(self) -> list[str]: """All Questions associated with a given Facet.""" return self.child_ids @@ -182,22 +211,27 @@ class Scenario(Component): """A Scenario in DFIQ. A Scenario is the highest-level grouping in DFIQ. A Scenario is made of one or - more Facets (different "sides" of an investigation), which in turn are made up of - investigative Questions. + more Facets (different "sides" of an investigation) or directly linked Questions. Attributes: type (str): The type of component, which is always "scenario". """ def __init__( - self, dfiq_id: str, uuid: str, name: str, description: str, tags: set[str] | None + self, + dfiq_id: str | None, + uuid: str, + name: str, + description: str, + tags: set[str] | list[str] | None, + internal: bool = False, ): - super().__init__(dfiq_id, uuid, name, description, tags) + super().__init__(dfiq_id, uuid, name, description, tags, internal=internal) self.type = "scenario" @property - def facets(self) -> set[str]: - """All Facets associated with a given Scenario.""" + def facets(self) -> list[str]: + """All child Facets (or Questions) associated with a given Scenario.""" return self.child_ids @@ -236,7 +270,6 @@ def __init__( "Scenario": "scenarios", "Facet": "facets", "Question": "questions", - "Approach": "approaches", } self.components = {} self.graph = None @@ -249,7 +282,6 @@ def __init__( "Scenario": None, "Facet": None, "Question": None, - "Approach": None, } if self.yaml_data_path: @@ -266,29 +298,29 @@ def scenarios(self) -> list[Scenario]: """Returns a list of all Scenarios in the DFIQ knowledge base.""" return sorted( [c for c in self.components.values() if isinstance(c, Scenario)], - key=lambda x: x.id, + key=lambda x: x.id or x.uuid, ) def facets(self) -> list[Facet]: """Returns a list of all Facets in the DFIQ knowledge base.""" return sorted( [c for c in self.components.values() if isinstance(c, Facet)], - key=lambda x: x.id, + key=lambda x: x.id or x.uuid, ) def questions(self) -> list[Question]: """Returns a list of all Questions in the DFIQ knowledge base.""" return sorted( [c for c in self.components.values() if isinstance(c, Question)], - key=lambda x: x.id, + key=lambda x: x.id or x.uuid, ) def approaches(self) -> list[Approach]: """Returns a list of all Approaches in the DFIQ knowledge base.""" - return sorted( - [c for c in self.components.values() if isinstance(c, Approach)], - key=lambda x: x.id, - ) + all_approaches = [] + for question in self.questions(): + all_approaches.extend(question.approaches) + return all_approaches def add_child_ids(self) -> None: """Adds the list of their child IDs to a component's `child_ids` attribute. @@ -307,68 +339,63 @@ def add_child_ids(self) -> None: self.components[dfiq_id].set_children(children) def add_child_tags(self) -> None: - """Adds tags from a Question's Approaches to that Question's `all_tags attribute.""" - if not self.graph: - raise ValueError("DFIQ Graph needed before adding children.") - - for dfiq_id, component in self.components.items(): - parents = sorted(list(nx.DiGraph.predecessors(self.graph, dfiq_id))) - if self.components[dfiq_id].type == "approach": - for parent in parents: - self.components[parent].all_tags = self.components[ - parent - ].all_tags.union(self.components[dfiq_id].tags) + """Adds tags from a Question's Approaches to that Question's `all_tags` attribute.""" + for component in self.components.values(): + if isinstance(component, Question): + for approach in component.approaches: + if approach.tags: + component.all_tags = component.all_tags.union(approach.tags) @staticmethod def convert_yaml_object_to_dfiq_component( yaml_object: dict, - ) -> Scenario | Facet | Question | Approach | None: + ) -> Scenario | Facet | Question | None: """Takes a dict, loaded from a DFIQ YAML file, and converts to the appropriate dfiq.Component object.""" assert yaml_object["type"] in ( "scenario", "facet", "question", - "approach", ), "Object must be of known DFIQ type" + name = yaml_object.get("name") or yaml_object.get("display_name") + internal = yaml_object.get("internal", False) + if yaml_object["type"] == "scenario": return Scenario( - yaml_object["id"], + yaml_object.get("id"), yaml_object["uuid"], - yaml_object["display_name"], + name, yaml_object.get("description"), yaml_object.get("tags"), + internal=internal, ) elif yaml_object["type"] == "facet": return Facet( - yaml_object["id"], + yaml_object.get("id"), yaml_object["uuid"], - yaml_object["display_name"], + name, yaml_object.get("description"), yaml_object.get("tags"), yaml_object.get("parent_ids"), + internal=internal, ) elif yaml_object["type"] == "question": + approaches = [ + Approach.from_dict(a) + for a in (yaml_object.get("approaches") or []) + ] return Question( - yaml_object["id"], + yaml_object.get("id"), yaml_object["uuid"], - yaml_object["display_name"], + name, yaml_object.get("description"), yaml_object.get("tags"), yaml_object.get("parent_ids"), - ) - - elif yaml_object["type"] == "approach": - return Approach( - yaml_object["id"], - yaml_object["uuid"], - yaml_object["display_name"], - yaml_object.get("description"), - yaml_object.get("tags"), - yaml_object.get("view"), + approaches=approaches, + internal=internal, ) else: @@ -383,7 +410,7 @@ def load_yaml_files_by_type( dfiq_type, validate any YAML files there, and load them into a dict. Args: - dfiq_type (str): The component type (Scenario, Facet, Question, or Approach). + dfiq_type (str): The component type (Scenario, Facet, or Question). yaml_data_path (str, optional): The base path holding the YAML files. """ @@ -426,7 +453,8 @@ def load_yaml_files_by_type( ) if converted: - component_dict[component_from_yaml["id"]] = converted + key = component_from_yaml.get("id") or component_from_yaml["uuid"] + component_dict[key] = converted return component_dict @staticmethod @@ -463,9 +491,6 @@ def _load_dfiq_schema(self) -> None: self.schemas["Question"] = yamale.make_schema( self._get_dfiq_file("utils", "question_spec.yaml") ) - self.schemas["Approach"] = yamale.make_schema( - self._get_dfiq_file("utils", "approach_spec.yaml") - ) def validate_dfiq_schema(self, yaml_file_path: str, component_type: str) -> bool: """Validate that a YAML file adheres to the appropriate DFIQ Schema.""" @@ -478,12 +503,12 @@ def validate_dfiq_schema(self, yaml_file_path: str, component_type: str) -> bool return True def load_dfiq_items_from_yaml(self, yaml_data_path: str | None = None) -> None: - """Load all four types of DFIQ components from a base path.""" + """Load all types of DFIQ components from a base path.""" if not yaml_data_path: yaml_data_path = self.yaml_data_path self.components = {} - for dfiq_component in ["Scenario", "Facet", "Question", "Approach"]: + for dfiq_component in ["Scenario", "Facet", "Question"]: self.components.update( self.load_yaml_files_by_type(dfiq_component, yaml_data_path) ) @@ -491,15 +516,18 @@ def load_dfiq_items_from_yaml(self, yaml_data_path: str | None = None) -> None: def build_graph(self) -> None: """Create a nx.DiGraph linking all loaded DFIQ components.""" self.graph = nx.DiGraph() + uuid_to_key = {} for dfiq_id, content in self.components.items(): self.graph.add_node(dfiq_id) + uuid_to_key[content.uuid] = dfiq_id logging.debug(f"added node: {dfiq_id}") for dfiq_id, content in self.components.items(): if content.parent_ids: for parent_id in content.parent_ids: - self.graph.add_edge(parent_id, dfiq_id) - logging.debug(f"added edge: {parent_id} -> {dfiq_id}") + resolved_parent = uuid_to_key.get(parent_id, parent_id) + self.graph.add_edge(resolved_parent, dfiq_id) + logging.debug(f"added edge: {resolved_parent} -> {dfiq_id}") def display_graph(self) -> None: """Display the DFIQ graph.""" @@ -639,32 +667,36 @@ def generate_approach_glossary_md(self, allow_internal: bool = False) -> None: Args: allow_internal (bool): Check if generating from internal items is allowed. """ - data_type_and_value = {} - processor_and_analysis_names = {} + collection_type_and_value = {} + processing_type_and_value = {} analysis_step_types = set() step_variables = set() - for dfiq_id, component in self.components.items(): - if not isinstance(component, Approach): + for question in self.questions(): + if not allow_internal and question.is_internal: continue - if not allow_internal and component.is_internal: - continue - - for d in component.view.get("data"): - if not data_type_and_value.get(d["type"]): - data_type_and_value[d["type"]] = set() - data_type_and_value[d["type"]].add(d["value"]) - - for p in component.view.get("processors"): - if not processor_and_analysis_names.get(p["name"]): - processor_and_analysis_names[p["name"]] = set() - - for analysis in p["analysis"]: - processor_and_analysis_names[p["name"]].add(analysis["name"]) + for approach in question.approaches: + if not allow_internal and approach.is_internal: + continue - for step in analysis["steps"]: - analysis_step_types.add(step["type"]) - m = re.findall(r"\{[A-z0-9_ -]{2,}?\}", step["value"]) + for step in approach.steps: + stage = step.get("stage") + step_type = step.get("type") + step_value = step.get("value") + + if stage == "collection": + if not collection_type_and_value.get(step_type): + collection_type_and_value[step_type] = set() + collection_type_and_value[step_type].add(step_value) + elif stage == "processing": + if not processing_type_and_value.get(step_type): + processing_type_and_value[step_type] = set() + processing_type_and_value[step_type].add(step_value) + elif stage == "analysis": + analysis_step_types.add(step_type) + + if step_value: + m = re.findall(r"\{[A-z0-9_ -]{2,}?\}", step_value) if m: step_variables.update(m) @@ -677,15 +709,12 @@ def generate_approach_glossary_md(self, allow_internal: bool = False) -> None: "https://github.com/ForensicArtifacts/artifacts). Using this type is preferred when " "the data is a host-based file/artifact, but other methods are available as well (if " "there isn't an existing relevant ForensicArtifact).", - "description": "Text description of the data type. `description` is often using in conjunction with " - "another data type to provide more context. It can also be used alone, either as a " - "placeholder or when more robust, programmatic data types do not fit.", } template = self.jinja_env.get_template("approach_glossary.jinja2") context = { - "data_type_and_value": data_type_and_value, - "processor_and_analysis_names": processor_and_analysis_names, + "collection_type_and_value": collection_type_and_value, + "processing_type_and_value": processing_type_and_value, "analysis_step_types": analysis_step_types, "step_variables": step_variables, "descriptions": descriptions, diff --git a/dfiq/templates/approach_glossary.jinja2 b/dfiq/templates/approach_glossary.jinja2 index 2b1c676..23af803 100644 --- a/dfiq/templates/approach_glossary.jinja2 +++ b/dfiq/templates/approach_glossary.jinja2 @@ -6,32 +6,33 @@ part of DFIQ, due to the amount of structured information they contain. DFIQ has [specification](https://dfiq.org/contributing/specification) that is a useful reference for creating new Approaches. However, some parts of Approaches need user-defined values that are beyond the specification. This page is a glossary of currently-used values, generated from the -[DFIQ YAML files](https://github.com/google/dfiq/tree/main/data). +[DFIQ YAML files](https://github.com/google/dfiq/tree/main/dfiq/data). When writing new Approaches, check this glossary first to see if there's already an existing term that fits with what you're trying to do. If not, you are free to create a new one, but trying to reuse existing terms first will increase -consistency throughout DFIQ. These concepts (data type, processors, analysis steps) also may not be straight-forward at +consistency throughout DFIQ. These concepts (collection, processing, and analysis steps) also may not be straight-forward at first; the hope is that seeing some common values (and the linked usages) will help make them more clear. -## Data +## Collection Steps -This section (`view.data`) can have multiple ways describing the data needed for this approach. They should be thought -of as complementary or as alternates to each other (they can be "OR"d together, they do not need to be "AND"d). -Each is specified by a pair of `type` and `value`. +Steps with `stage: collection` describe the data needed for an approach. Each step is specified with `name`, `description` (optional), `stage: collection`, `type`, and `value`. -Example (from [Q1001.10](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L39)): +Example (from [Q1001](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L185-L190)): -``` -view: - data: - - type: ForensicArtifact - value: BrowserHistory +```yaml +steps: + - name: Collect ForensicArtifact data + description: Collect local browser history artifacts. These are often in the form + of SQLite databases and JSON files in multiple directories. + stage: collection + type: ForensicArtifact + value: BrowserHistory ``` -Below are the current values of `type`, along with the `value`s set for each. +Below are the current values of `type` for `stage: collection` steps, along with the `value`s set for each. -{% for data_type, values in data_type_and_value.items() | sort %} +{% for data_type, values in collection_type_and_value.items() | sort %} #### {{ data_type }} {% if descriptions.get(data_type) %} **Description**: {{ descriptions.get(data_type) }} @@ -45,55 +46,59 @@ For `type: {{ data_type }}`, current entries for `value`: {% endfor %} -## Processors +## Processing Steps -A processor is what takes the data collected and processes it in some way to produce structured data an investigator -reviews. Multiple processors can be defined, as there are often multiple programs capable of doing similar processing -(example: log2timeline, Magnet Axiom, and Hindsight can all process browser history artifacts and deliver similar -results). +A processor (`stage: processing`) takes the collected data and processes it in some way to produce structured data an investigator +reviews (for example: Plaso, Hindsight, or Splunk). -Example (from [Q1001.10](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L58)): +Example (from [Q1001](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L191-L195)): -``` - processors: - - name: Plaso +```yaml +steps: + - name: Process data with Plaso + description: + stage: processing + type: command + value: Plaso ``` -Below are the currently-defined processors: +Below are the currently-defined processing step types and values: -{% for processor in processor_and_analysis_names | sort %} -- {{ processor }} [🔎](https://github.com/google/dfiq/search?q="name:%20{{ processor | urlencode }}"+language%3AYAML) +{% for proc_type, values in processing_type_and_value.items() | sort %} +#### `type: {{ proc_type }}` + +{% for processor in values | sort %} +- {{ processor }} [🔎](https://github.com/google/dfiq/search?q="value:%20{{ processor | urlencode }}"+language%3AYAML) +{% endfor %} {% endfor %} ## Analysis Steps -Under each analysis method will be a sequence of one or more maps with keys `description`, `type`, and `value`. -If there is more than one map, they should be processed in sequence in the analysis method (if applicable). In this -way, we can describe multiple chained steps of analysis (with the `description` being a way to communicate to the user -what exactly each "step" is doing, enabling a "show-your-work"-type capability). - -Example (from [Q1001.10](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L63)): - -``` - analysis: - - name: OpenSearch - steps: - - description: &filter-desc Filter the results to just file downloads - type: opensearch-query - value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") - - name: Python Notebook - steps: - - description: *filter-desc - type: pandas - value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') +Steps with `stage: analysis` describe how to refine, filter, or query the processed data to answer the Question. +If there are multiple analysis steps, they describe the sequence or alternative analysis queries (such as OpenSearch queries, Splunk queries, or Pandas expressions) used to analyze the data. + +Example (from [Q1001](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L196-L205)): + +```yaml +steps: + - name: Filter the results to just file downloads + description: + stage: analysis + type: opensearch-query + value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") + - name: Filter the results to just file downloads + description: + stage: analysis + type: pandas + value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') ``` #### `type` -The contents of the `description` and `value` fields will vary wildly with little repetition, depending on what the +The contents of the `name`, `description`, and `value` fields will vary depending on what the analysis step is doing, but the step `type` should be one of a few common values. -Below are the currently-defined values of `type`: +Below are the currently-defined values of `type` for `stage: analysis` steps: {% for step in analysis_step_types | sort %} - {{ step }} [🔎](https://github.com/google/dfiq/search?q="type:%20{{ step | urlencode }}"+language%3AYAML) @@ -101,14 +106,14 @@ Below are the currently-defined values of `type`: #### Variable Substitution in step `value` -The step's `value` may benefit from some using a specific term to make the step more precise. Common examples of this +The step's `value` may benefit from using a specific term to make the step more precise. Common examples of this include adding time bounds and filtering down to a specific identifier (user name, host, FQDN, or PID, for example). DFIQ's convention for denoting a variable to be substituted when used is to wrap the term in **{ }**. ==More standardization is needed here to define common variables (such as timestamps in a particular format).== -Below are the currently-used variables in analysis steps: +Below are the currently-used variables in steps: {% for variable in step_variables | sort %} - {{ variable }} [🔎](https://github.com/google/dfiq/search?q="{{ variable | urlencode }}"+language%3AYAML) diff --git a/dfiq/templates/question_with_approaches.jinja2 b/dfiq/templates/question_with_approaches.jinja2 index 31522a9..2516bd4 100644 --- a/dfiq/templates/question_with_approaches.jinja2 +++ b/dfiq/templates/question_with_approaches.jinja2 @@ -15,7 +15,9 @@ hide: # {{ question.name }} **UUID**: {{ question.uuid }} +{% if question.id %} **ID**: {{ question.id }} +{% endif %} {% if question.description %} **Description**: {{ question.description }} @@ -24,11 +26,14 @@ hide: **Approaches to Answer** {% for approach in question.approaches %} -{% if components[approach].is_internal == False or allow_internal == True %} -- [{{ components[approach].name }} [{{ approach }}]](#{{ components[approach].name.replace(' ','-').replace('(','').replace(')','').lower() }}) - {% if components[approach]['description']['details'].split('\n\n')[0] %}- {{ components[approach]['description']['details'].split('\n\n')[0] }} -{% endif %} - - Tags: {{ components[approach]['tags']|join(' ') }} +{% if approach.is_internal == False or allow_internal == True %} +- [{{ approach.name }}](#{{ approach.name.replace(' ','-').replace('(','').replace(')','').replace('"','').lower() }}) +{% if approach.description and approach.description.split('\n')[0] %} + - {{ approach.description.split('\n')[0] }} +{% endif %} +{% if approach.tags %} + - Tags: {{ approach.tags|join(' ') }} +{% endif %} {% endif %} {% endfor %} @@ -40,31 +45,29 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -{% for _approach in question.approaches %} -{% if components[_approach].is_internal == False or allow_internal == True %} -{% set approach = components[_approach] %} +{% for approach in question.approaches %} +{% if approach.is_internal == False or allow_internal == True %} ## {{ approach.name }} ### 🗂️ Explanation {% if approach.description %} -{% if approach.description.get('details') %} -{{ approach.description['details'] }} -{% endif %} -{% if approach.description.get('references') %} +{{ approach.description }} +{% endif %} +{% if approach.references %} + #### References -{% for reference in approach.description['references'] %} +{% for reference in approach.references %} - {{ reference }} -{% endfor %} -{% endif %} -{% if approach.description.get('references_internal') and allow_internal == True %} +{% endfor %} +{% endif %} +{% if approach.references_internal and allow_internal == True %} ##### References (Internal) -{% for reference in approach.description['references_internal'] %} +{% for reference in approach.references_internal %} - {{ reference }} -{% endfor %} -{% endif %} +{% endfor %} {% endif %} -{% if approach.view.get('notes') %} +{% if approach.notes %} ### 📝 Notes Each approach comes with certain caveats or limitations. These can often @@ -73,121 +76,69 @@ don't). This can lead to incorrect assumptions and analysis. Explicitly stating what is covered and not covered by the approach reduces ambiguity. +{% if approach.notes.get('covered') %} !!! success "Covered" -{% for note in approach.view['notes']['covered'] %} +{% for note in approach.notes['covered'] %} - {{ note }} -{% endfor %} +{% endfor %} +{% endif %} +{% if approach.notes.get('not_covered') %} !!! failure "Not Covered" -{% for note in approach.view['notes']['not_covered'] %} +{% for note in approach.notes['not_covered'] %} - {{ note }} -{% endfor %} - -{% endif %} - -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -{% for data in approach.view['data'] %} -{% if data['type'] == 'description' %} -**Description** -: {{ data['value'] }} -{% endif %} -{% endfor %} - -{% for data in approach.view['data'] %} -{% if data['type'] == 'googlesql-query' %} -**Type** -: GoogleSQL Query - -**Query** - -```googlesql -{{ data['value'] }} -``` -{% elif data['type'] == 'ForensicArtifact' %} - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: {{ data['value'] }} ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q={{ data['value'] }})) -{% elif data['type'] != 'description' %} - - {{ data['type'] }}: {{ data['value'] }} -{% endif %} -{% endfor %} - -{% if approach.view.get('processors') %} -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -{% for processor in approach.view['processors'] %} -=== "{{ processor.name.title() }}" - More information on [{{ processor['name'].title() }}](https://forensics.wiki/{{ processor.name|lower }}). - -{% if processor.get('options') %} - Recommended options: - - ``` -{% for option in processor['options'] %} --{{ option['type'] }} {{ option['value'] }}{% endfor %} - - ``` +{% endfor %} {% endif %} -{% if processor.get('analysis') %} - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading {{ processor.name.title() }}'s output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. -{% for analysis in processor['analysis'] %} - - {{ analysis['name'] }} -{% for step in analysis.steps %} -{% if step.type == 'opensearch-query' %} - - 1. {{ step.description }} - - OpenSearch query: +{% endif %} +{% if approach.steps %} +### ⚙️ Steps + +{% for step in approach.steps %} +1. {{ step.stage }} **{{ step.name }}** +{% if step.description %} + - **Description**: {{ step.description }} +{% endif %} +{% if step.type == 'ForensicArtifact' %} + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: {{ step.value }} ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q={{ step.value }})) +{% elif step.type == 'opensearch-query' %} + - **Type**: OpenSearch query + - **Value**: ``` {{ step.value }} ``` -{% elif step.type == 'pandas' %} - - 1. {{ step.description }} - - Python code: +{% elif step.type == 'splunk-query' %} + - **Type**: Splunk query + - **Value**: ``` - df.{{ step.value }} + {{ step.value }} ``` -{% else %} +{% elif step.type == 'googlesql-query' %} + - **Type**: GoogleSQL query + - **Value**: - 1. {{ step.description }} - - Type: {{ step.type}} - - Value: {{ step.value }} + ```googlesql + {{ step.value }} + ``` +{% elif step.type == 'pandas' %} + - **Type**: Pandas (`pandas`) + - **Value**: -{% endif %} -{% endfor %} -{% endfor %} -{% endif %} -{% endfor %} + ```python + {% if step.value.startswith('df') %}{{ step.value }}{% else %}df.{{ step.value }}{% endif %} + + ``` +{% else %} + - **Type**: {{ step.type }} + - **Value**: {{ step.value.rstrip() }} +{% endif %} + +{% endfor %} {% endif %} {% endif %} {% endfor %} -{# ... #} diff --git a/dfiq/templates/questions_index.jinja2 b/dfiq/templates/questions_index.jinja2 index 58f0434..9220d67 100644 --- a/dfiq/templates/questions_index.jinja2 +++ b/dfiq/templates/questions_index.jinja2 @@ -13,7 +13,7 @@ is an index of all the Questions that are defined as part of DFIQ. Some quick facts about Questions in DFIQ: - Questions should be small enough in scope that they can be readily answered -- A single Question can be reused in multiple different Facets +- A single Question can be reused in multiple different Scenarios or Facets - If a Question has any Approaches defined, it will render as a link to the detailed Question page !!! Note diff --git a/dfiq/templates/scenario.jinja2 b/dfiq/templates/scenario.jinja2 index 26083d9..772462c 100644 --- a/dfiq/templates/scenario.jinja2 +++ b/dfiq/templates/scenario.jinja2 @@ -3,28 +3,47 @@ # {{ scenario.name }} **UUID**: {{ scenario.uuid }} +{% if scenario.id %} **ID**: {{ scenario.id }} +{% endif %} {% if scenario.description %} **Description**: {{ scenario.description }} {% endif %} -{% for facet in scenario.facets %} -{% if not components[facet].is_internal or allow_internal == True %} -## {{ components[facet].name }} {{ facet }} -{% if components[facet].description %} -{{ components[facet].description }} +{% for child in scenario.facets %} +{% if components[child].type == 'facet' and (not components[child].is_internal or allow_internal == True) %} +## {{ components[child].name }} {{ child }} +{% if components[child].description %} +{{ components[child].description }} {% endif %} -{% for question in components[facet].questions %} -{% if not components[question].is_internal or allow_internal == True %} -{% if components[question].approaches|length %} +{% for question in components[child].questions %} +{% if not components[question].is_internal or allow_internal == True %} +{% if components[question].approaches|length %} - {{ question }}  {{ components[question].name }} -{% else %} +{% else %} - {{ question }}  {{ components[question].name }} +{% endif %} {% endif %} -{% endif %} -{% endfor %} +{% endfor %} {% endif %} {% endfor %} +{% set direct_questions = [] %} +{% for child in scenario.facets %} +{% if components[child].type == 'question' and (not components[child].is_internal or allow_internal == True) %} +{% set _ = direct_questions.append(child) %} +{% endif %} +{% endfor %} +{% if direct_questions|length %} +## Questions + +{% for question in direct_questions %} +{% if components[question].approaches|length %} + - {{ question }}  {{ components[question].name }} +{% else %} + - {{ question }}  {{ components[question].name }} +{% endif %} +{% endfor %} +{% endif %} {% endif %} diff --git a/dfiq/utils/approach_spec.yaml b/dfiq/utils/approach_spec.yaml deleted file mode 100644 index 7af2c0e..0000000 --- a/dfiq/utils/approach_spec.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: str() -type: enum('approach') -description: - details: str() - references: list(str(), required=False) - references_internal: list(str(), required=False) -id: regex('^Q\d{4}\.\d{2}$') -uuid: regex('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') -internal: bool() -parent_id: - regex('^Q\d{4}$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$', - required=False) -dfiq_version: regex('\d{1,2}\.\d{1,2}\.\d{1,2}') -tags: list(str(), required=False) -contributors: list(str(), required=False) -view: - data: list(include('string_type_and_value')) - notes: - covered: list(str()) - not_covered: list(str()) - processors: list(include('processor')) ---- -string_type_and_value: - type: str() - value: str() -processor: - name: str() - options: list(include('string_type_and_value'), required=False) - analysis: list(include('analysis_object')) -analysis_object: - name: str() - steps: list(include('analysis_step')) -analysis_step: - description: str() - type: str() - value: str() diff --git a/dfiq/utils/facet_spec.yaml b/dfiq/utils/facet_spec.yaml index 80e1ade..998e195 100644 --- a/dfiq/utils/facet_spec.yaml +++ b/dfiq/utils/facet_spec.yaml @@ -2,10 +2,10 @@ name: str() type: enum('facet') description: str(required=False) -id: regex('^F\d{4}$') +id: regex('^F\d{4}$', required=False) uuid: regex('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') -internal: bool() +internal: bool(required=False) dfiq_version: regex('\d{1,2}\.\d{1,2}\.\d{1,2}') tags: list(str(), required=False) contributors: list(str(), required=False) -parent_ids: list(regex('S\d{4}|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$')) +parent_ids: list(regex('^S\d{4}$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$')) diff --git a/dfiq/utils/question_spec.yaml b/dfiq/utils/question_spec.yaml index 3ec0508..b6cb03b 100644 --- a/dfiq/utils/question_spec.yaml +++ b/dfiq/utils/question_spec.yaml @@ -2,10 +2,29 @@ name: str() type: enum('question') description: str(required=False) -id: regex('^Q\d{4}$') +id: regex('^Q\d{4}$', required=False) uuid: regex('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') -internal: bool() +internal: bool(required=False) dfiq_version: regex('\d{1,2}\.\d{1,2}\.\d{1,2}') tags: list(str(), required=False) contributors: list(str(), required=False) -parent_ids: list(regex('F\d{4}|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$')) +parent_ids: list(regex('^[FS]\d{4}$|^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$')) +approaches: list(include('approach'), required=False) +--- +approach: + name: str() + description: str(required=False) + tags: list(str(), required=False) + references: list(str(), required=False) + references_internal: list(str(), required=False) + notes: include('notes', required=False) + steps: list(include('step')) +notes: + covered: list(str(), required=False) + not_covered: list(str(), required=False) +step: + name: str() + description: str(required=False) + stage: enum('collection', 'processing', 'analysis') + type: str() + value: str() diff --git a/dfiq/utils/scenario_spec.yaml b/dfiq/utils/scenario_spec.yaml index 9222156..9df7325 100644 --- a/dfiq/utils/scenario_spec.yaml +++ b/dfiq/utils/scenario_spec.yaml @@ -2,9 +2,9 @@ name: str() type: enum('scenario') description: str() -id: regex('^S\d{4}$') +id: regex('^S\d{4}$', required=False) uuid: regex('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$') -internal: bool() +internal: bool(required=False) dfiq_version: regex('\d{1,2}\.\d{1,2}\.\d{1,2}') tags: list(str(), required=False) contributors: list(str(), required=False) diff --git a/pyproject.toml b/pyproject.toml index cdf4e0b..07990c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ Repository = "https://github.com/google/dfiq" [tool.poetry] name = "dfiq" -version = "1.1" +version = "1.1.0" description = "DFIQ is a collection of investigative questions and the approaches for answering them" authors = ["Ryan Benson , Thomas Chopitea "] readme = "README.md" diff --git a/site/docs/contributing/approach_glossary.md b/site/docs/contributing/approach_glossary.md index 238de0d..f0c76f3 100644 --- a/site/docs/contributing/approach_glossary.md +++ b/site/docs/contributing/approach_glossary.md @@ -5,29 +5,30 @@ part of DFIQ, due to the amount of structured information they contain. DFIQ has [specification](https://dfiq.org/contributing/specification) that is a useful reference for creating new Approaches. However, some parts of Approaches need user-defined values that are beyond the specification. This page is a glossary of currently-used values, generated from the -[DFIQ YAML files](https://github.com/google/dfiq/tree/main/data). +[DFIQ YAML files](https://github.com/google/dfiq/tree/main/dfiq/data). When writing new Approaches, check this glossary first to see if there's already an existing term that fits with what you're trying to do. If not, you are free to create a new one, but trying to reuse existing terms first will increase -consistency throughout DFIQ. These concepts (data type, processors, analysis steps) also may not be straight-forward at +consistency throughout DFIQ. These concepts (collection, processing, and analysis steps) also may not be straight-forward at first; the hope is that seeing some common values (and the linked usages) will help make them more clear. -## Data +## Collection Steps -This section (`view.data`) can have multiple ways describing the data needed for this approach. They should be thought -of as complementary or as alternates to each other (they can be "OR"d together, they do not need to be "AND"d). -Each is specified by a pair of `type` and `value`. +Steps with `stage: collection` describe the data needed for an approach. Each step is specified with `name`, `description` (optional), `stage: collection`, `type`, and `value`. -Example (from [Q1001.10](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L39)): +Example (from [Q1001](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L185-L190)): -``` -view: - data: - - type: ForensicArtifact - value: BrowserHistory +```yaml +steps: + - name: Collect ForensicArtifact data + description: Collect local browser history artifacts. These are often in the form + of SQLite databases and JSON files in multiple directories. + stage: collection + type: ForensicArtifact + value: BrowserHistory ``` -Below are the current values of `type`, along with the `value`s set for each. +Below are the current values of `type` for `stage: collection` steps, along with the `value`s set for each. #### CrowdStrike @@ -50,68 +51,59 @@ For `type: ForensicArtifact`, current entries for `value`: - WindowsPrefetchFiles - WindowsXMLEventLogSysmon -#### description -**Description**: Text description of the data type. `description` is often using in conjunction with another data type to provide more context. It can also be used alone, either as a placeholder or when more robust, programmatic data types do not fit. - -For `type: description`, current entries for `value`: - -- Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. -- Files used by the Windows Prefetch service. -- Santa logs stored on the local disk; they may also be centralized off-system, but this artifact does not include those. -- The NTFS $UsnJnrl file system metadata file. This ForensicArtifact definition does not include the $J alternate data stream, but many tools collect it anyway. -- Windows Event Log files +## Processing Steps -## Processors +A processor (`stage: processing`) takes the collected data and processes it in some way to produce structured data an investigator +reviews (for example: Plaso, Hindsight, or Splunk). -A processor is what takes the data collected and processes it in some way to produce structured data an investigator -reviews. Multiple processors can be defined, as there are often multiple programs capable of doing similar processing -(example: log2timeline, Magnet Axiom, and Hindsight can all process browser history artifacts and deliver similar -results). +Example (from [Q1001](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L191-L195)): -Example (from [Q1001.10](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L58)): - -``` - processors: - - name: Plaso +```yaml +steps: + - name: Process data with Plaso + description: + stage: processing + type: command + value: Plaso ``` -Below are the currently-defined processors: +Below are the currently-defined processing step types and values: -- Crowdstrike Investigate (UI) [🔎](https://github.com/google/dfiq/search?q="name:%20Crowdstrike%20Investigate%20%28UI%29"+language%3AYAML) -- Hindsight [🔎](https://github.com/google/dfiq/search?q="name:%20Hindsight"+language%3AYAML) -- Plaso [🔎](https://github.com/google/dfiq/search?q="name:%20Plaso"+language%3AYAML) -- Splunk [🔎](https://github.com/google/dfiq/search?q="name:%20Splunk"+language%3AYAML) +#### `type: command` -## Analysis Steps - -Under each analysis method will be a sequence of one or more maps with keys `description`, `type`, and `value`. -If there is more than one map, they should be processed in sequence in the analysis method (if applicable). In this -way, we can describe multiple chained steps of analysis (with the `description` being a way to communicate to the user -what exactly each "step" is doing, enabling a "show-your-work"-type capability). +- Crowdstrike Investigate (UI) [🔎](https://github.com/google/dfiq/search?q="value:%20Crowdstrike%20Investigate%20%28UI%29"+language%3AYAML) +- Hindsight [🔎](https://github.com/google/dfiq/search?q="value:%20Hindsight"+language%3AYAML) +- Plaso [🔎](https://github.com/google/dfiq/search?q="value:%20Plaso"+language%3AYAML) +- Splunk [🔎](https://github.com/google/dfiq/search?q="value:%20Splunk"+language%3AYAML) -Example (from [Q1001.10](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L63)): +## Analysis Steps -``` - analysis: - - name: OpenSearch - steps: - - description: &filter-desc Filter the results to just file downloads - type: opensearch-query - value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") - - name: Python Notebook - steps: - - description: *filter-desc - type: pandas - value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') +Steps with `stage: analysis` describe how to refine, filter, or query the processed data to answer the Question. +If there are multiple analysis steps, they describe the sequence or alternative analysis queries (such as OpenSearch queries, Splunk queries, or Pandas expressions) used to analyze the data. + +Example (from [Q1001](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L196-L205)): + +```yaml +steps: + - name: Filter the results to just file downloads + description: + stage: analysis + type: opensearch-query + value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") + - name: Filter the results to just file downloads + description: + stage: analysis + type: pandas + value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') ``` #### `type` -The contents of the `description` and `value` fields will vary wildly with little repetition, depending on what the +The contents of the `name`, `description`, and `value` fields will vary depending on what the analysis step is doing, but the step `type` should be one of a few common values. -Below are the currently-defined values of `type`: +Below are the currently-defined values of `type` for `stage: analysis` steps: - GUI [🔎](https://github.com/google/dfiq/search?q="type:%20GUI"+language%3AYAML) - manual [🔎](https://github.com/google/dfiq/search?q="type:%20manual"+language%3AYAML) @@ -121,14 +113,14 @@ Below are the currently-defined values of `type`: #### Variable Substitution in step `value` -The step's `value` may benefit from some using a specific term to make the step more precise. Common examples of this +The step's `value` may benefit from using a specific term to make the step more precise. Common examples of this include adding time bounds and filtering down to a specific identifier (user name, host, FQDN, or PID, for example). DFIQ's convention for denoting a variable to be substituted when used is to wrap the term in **{ }**. ==More standardization is needed here to define common variables (such as timestamps in a particular format).== -Below are the currently-used variables in analysis steps: +Below are the currently-used variables in steps: - {file_reference value} [🔎](https://github.com/google/dfiq/search?q="%7Bfile_reference%20value%7D"+language%3AYAML) - {hostname} [🔎](https://github.com/google/dfiq/search?q="%7Bhostname%7D"+language%3AYAML) diff --git a/site/docs/contributing/specification.md b/site/docs/contributing/specification.md index 8262007..8fdd7ca 100644 --- a/site/docs/contributing/specification.md +++ b/site/docs/contributing/specification.md @@ -1,5 +1,5 @@ # DFIQ Specification -**Version: 1.0.0** +**Version: 1.1.0** ## Introduction The DFIQ (Digital Forensics Investigative Questions) Specification defines a standard, language-agnostic interface for @@ -22,85 +22,87 @@ A DFIQ document must include a _dfiq_version_ field with the version. A DFIQ document that conforms to the DFIQ Specification is represented in YAML. ## Identifiers +Every DFIQ component (`Scenario`, `Facet`, or `Question`) is canonically identified by a Universally Unique Identifier (`uuid`), which never changes throughout the object's lifecycle. UUIDs should be randomly generated (UUIDv4) by the tools used to create or process DFIQ objects. + +Components may also include an optional human-readable `id` field: ``` - Q1024.12 - └──┼───┼── First character indicates type (Scenario, Facet, or Question) - └───┼── 4-digit number*, unique per type - └── [optional] 2-digit number* indicates this is an Approach, - specific to the Question + Q1024 + └──┼──── First character indicates type (Scenario, Facet, or Question) + └──── 4-digit number, unique per type ``` -Both the 4- and 2-digit numbers start with a 1 (or higher) for components appropriate for external use. Numbers -starting with a 0 are reserved for internal use (think of it like private IP address space). Users of DFIQ can use -these IDs for their internal components without worrying about collisions with public components. -[DFIQ on GitHub](https://github.com/google/dfiq) will serve as the definitive central repository to manage -public DFIQ components (and their IDs). +The `id` field is optional and is only required when a component is merged into the official [DFIQ repository on GitHub](https://github.com/google/dfiq), which serves as the definitive central repository to manage public DFIQ IDs. To ensure backwards compatibility, existing DFIQ users may continue using internal IDs (where the 4-digit number starts with `0`), or use the optional `internal` boolean field to designate private components. + +Components that link to parent objects via `parent_ids` may reference parents using either their `uuid` or their legacy DFIQ `id`. ## Schema -Below are the schemas for the different DFIQ components: [Scenario](#scenario), [Facet](#facet), [Question](#question), -and [Approach](#approach). Each DFIQ component is typically saved as its own YAML file, named after its DFIQ ID -(example: `S1001.yaml`). +Below are the schemas for the different DFIQ components: [Scenario](#scenario), [Facet](#facet), and [Question](#question) (which contains [Approaches](#approach)). Each top-level DFIQ component (`Scenario`, `Facet`, `Question`) is typically saved as its own YAML file (example: `S1001.yaml`), while `Approaches` are defined inline within their parent `Question`. If a field is not explicitly OPTIONAL, it can be considered REQUIRED. ### Scenario A Scenario is the highest-level grouping in DFIQ. A Scenario is made of one or more [Facets](#facet) (different -"sides" of an investigation), which in turn are made up of investigative [Questions](#question). +"sides" of an investigation), which in turn are made up of investigative [Questions](#question), or a Scenario may link directly to [Questions](#question) as its children. | Field name | Type | Description | |----------------|------------|------------------------------------------------------------------------------------------| -| `display_name` | `string` | A human readable name for the scenario. | +| `name` | `string` | A human readable name for the scenario. | | `description` | `string` | A description of the scenario. Markdown syntax MAY be used for rich text representation. | | `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | -| `type` | `string` | Represent the type of DFIQ object. Should be `scenario` for scenarios. | -| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). | +| `type` | `string` | Represents the type of DFIQ object. Should be `scenario` for scenarios. | +| `uuid` | `string` | A Universally Unique Identifier (UUIDv4) that uniquely identifies this component. | +| `id` | `string` | Optional. Identifier using the format defined in [identifiers](#identifiers). | +| `internal` | `boolean` | Optional. Whether the component is internal (private) or public. | | `tags` | `[string]` | Optional. List of tags. | -| `contributors` | `[Object]` | Optional. List of people who contributed to this component. | +| `contributors` | `[string]` | Optional. List of people who contributed to this component. | -Example ([source](https://github.com/google/dfiq/blob/main/data/scenarios/S1001.yaml)): +Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/scenarios/S1001.yaml)): ```yaml -display_name: Data Exfiltration +name: Data Exfiltration type: scenario description: > - An employee is suspected of unauthorized copying of sensitive data (code, - trade secrets, etc) from internal systems to those outside of the company's - control. + An employee is suspected of unauthorized copying of sensitive data (code, trade + secrets, etc) from internal systems to those outside of the company's control. +uuid: aba6b02b-2ee7-49ab-9cbe-20b7259d4661 id: S1001 -dfiq_version: 1.0.0 +dfiq_version: 1.1.0 tags: - Insider ``` ### Facet -Facets are used for intermediate-level grouping in DFIQ. A particular Facet can be part of multiple different +Facets are used for optional intermediate-level grouping in DFIQ. A particular Facet can be part of multiple different [Scenarios](#scenario) and will contain multiple [Questions](#question). A Facet breaks the larger Scenario into smaller logical pieces, but a Facet is still too broad to answer directly; it must also be broken down (into Questions). | Field name | Type | Description | |----------------|------------|-------------------------------------------------------------------------------------------------| -| `display_name` | `string` | A human readable name for the facet. | +| `name` | `string` | A human readable name for the facet. | | `description` | `string` | Optional. A description of the facet. Markdown syntax MAY be used for rich text representation. | | `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | -| `type` | `string` | Represent the type of DFIQ object. Should be `facet` for facets. | -| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). | +| `type` | `string` | Represents the type of DFIQ object. Should be `facet` for facets. | +| `uuid` | `string` | A Universally Unique Identifier (UUIDv4) that uniquely identifies this component. | +| `id` | `string` | Optional. Identifier using the format defined in [identifiers](#identifiers). | +| `internal` | `boolean` | Optional. Whether the component is internal (private) or public. | | `tags` | `[string]` | Optional. List of tags. | | `contributors` | `[string]` | Optional. List of people who contributed to this component. | -| `parent_ids` | `[string]` | List of DFIQ scenario IDs that this facet belongs to. | +| `parent_ids` | `[string]` | List of DFIQ scenario UUIDs or IDs that this facet belongs to. | -Example ([source](https://github.com/google/dfiq/blob/main/data/facets/F1008.yaml)): +Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/facets/F1008.yaml)): ```yaml -display_name: Are there signs of staging data for future exfiltration? +name: Are there signs of staging data for future exfiltration? type: facet description: > - "Staging" refers to the collection of data of interest onto a local system, - as a precursor step for future exfiltration of that data. When reviewing - data from Questions in this Facet, look for unusual volumes of results - (number or size of files downloaded or sent, for example). + "Staging" refers to the collection of data of interest onto a local system, as a + precursor step for future exfiltration of that data. When reviewing data from Questions + in this Facet, look for unusual volumes of results (number or size of files downloaded + or sent, for example). +uuid: d95ef023-4246-41f5-b33b-73d924649986 id: F1008 -dfiq_version: 1.0.0 +dfiq_version: 1.1.0 tags: - - TA0009 + - TA0009 parent_ids: - - S1001 + - S1001 ``` ### Question @@ -109,126 +111,82 @@ Questions are the fundamental "building blocks" of DFIQ. All other DFIQ componen the Questions logically. A Question should be specific enough that it can be readily answered, and not easily divided into multiple parts (if it -can be, it likely should be multiple Questions). A single Question can be reused in multiple different Facets. +can be, it likely should be multiple Questions). A single Question can be reused in multiple different Facets or Scenarios. | Field name | Type | Description | |----------------|------------|----------------------------------------------------------------------------------------------------| -| `display_name` | `string` | A human readable name for the question. | +| `name` | `string` | A human readable name for the question. | | `description` | `string` | Optional. A description of the question. Markdown syntax MAY be used for rich text representation. | | `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | -| `type` | `string` | Represent the type of DFIQ object. Should be `question` for questions. | -| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). | +| `type` | `string` | Represents the type of DFIQ object. Should be `question` for questions. | +| `uuid` | `string` | A Universally Unique Identifier (UUIDv4) that uniquely identifies this component. | +| `id` | `string` | Optional. Identifier using the format defined in [identifiers](#identifiers). | +| `internal` | `boolean` | Optional. Whether the component is internal (private) or public. | | `tags` | `[string]` | Optional. List of tags. | | `contributors` | `[string]` | Optional. List of people who contributed to this component. | -| `parent_ids` | `[string]` | List of DFIQ facet IDs that this question belongs to. | +| `parent_ids` | `[string]` | List of DFIQ facet or scenario UUIDs or IDs that this question belongs to. | +| `approaches` | `[Object]` | Optional. List of [Approach](#approach) objects describing how to answer this question. | -Example ([source](https://github.com/google/dfiq/blob/main/data/questions/Q1001.yaml)): +Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml)): ```yaml -display_name: What files were downloaded using a web browser? +name: What files were downloaded using a web browser? type: question -description: Downloading files via a web browser is a common way to introduce - files to a computer. Determining what files were downloaded can be helpful - in variety of scenarios, ranging from malware investigations to insider cases. +description: +uuid: 8620a183-d67f-481e-a63c-d8b8dfa5e968 id: Q1001 -dfiq_version: 1.0.0 +dfiq_version: 1.1.0 tags: - - Web Browser parent_ids: - - F1008 - - F1002 + - F1008 + - F1002 +approaches: + - name: Collect download records from local browser artifacts (Plaso) + ... ``` ### Approach Approaches are detailed explanations of how to answer a [Question](#question) using a specific method, including the -required data, processing, and analysis steps. As there is often more than one way to answer a question, there can be -multiple Approaches that answer a given Question using different techniques. - -Approaches are tightly linked to their Question. Whereas a Question can be a part of multiple Facets, and a Facet can -be part of multiple Scenario, an Approach can only apply to a single specific Question. - -| Field name | Type | Description | -|----------------|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `display_name` | `string` | A human readable name for the approach. | -| `description` | `Object` | See Approach Description schema. | -| `type` | `string` | Represent the type of DFIQ object. Should be `approach` for approaches. | -| `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | -| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). An Approach identifier will share the first five characters with the Question it relates to, and end with a two-digit suffix. Example: `Q1024.12`. | -| `tags` | `[string]` | Optional. List of tags. | -| `contributors` | `[string]` | Optional. List of people who contributed to this component. | -| `view` | `Object` | The view aims to be a concise representation of how to perform this investigative approach. See the [View schema](#view). | - -#### Description -The `description` is a bit that goes before the details on how to implement the approach. It can introduce important -concepts and terms. If reasonable, long form explanations of forensic concepts should be added to the -ForensicsWiki, and then a link to that page added in `references` to avoid duplication. +required data collection, processing, and analysis steps. As there is often more than one way to answer a question, there can be +multiple Approaches that answer a given Question using different techniques. + +Approaches are tightly linked to their Question and are defined inline under the `approaches` field of a Question. | Field name | Type | Description | |-----------------------|------------|--------------------------------------------------------------------------------------------------------------------------| -| `summary` | `string` | A human readable summary for the approach. | -| `details` | `string` | A description of the approach. Markdown syntax MAY be used for rich text representation. | +| `name` | `string` | A human readable name for the approach. | +| `description` | `string` | Optional. A description of the approach. Markdown syntax MAY be used for rich text representation. | +| `tags` | `[string]` | Optional. List of tags. | | `references` | `[string]` | Optional. List of URLs of public references to this approach. Markdown syntax MAY be used for rich text representation. | | `references_internal` | `[string]` | Optional. List of URLs of private references to this approach. Markdown syntax MAY be used for rich text representation. | +| `notes` | `Object` | Optional. Coverage caveats for the approach. See the [Notes schema](#notes). | +| `steps` | `[Object]` | Ordered sequence of investigative steps (`collection`, `processing`, `analysis`). See the [Steps schema](#steps). | -Example ([source](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L26;L37)): +Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L153-L205)): ```yaml -description: - summary: Parse download records from web browsers' own databases. - details: > - Most web browsers track file downloads (at least in non-Incognito/private - sessions) in local artifacts on the system. We can collect and review - these records. This approach is useful when you have remote access to a - system (via GRR for example) or a disk image. +- name: Collect download records from local browser artifacts (Plaso) + description: >- + Parse download records from web browsers' own databases. + + Most web browsers track file downloads (at least in non-Incognito/private sessions) + in local artifacts on the system. We can collect and review these records. This + approach is useful when you have remote access to a system (via GRR for example) + or a disk image. + tags: + - Web Browser + - SQLite + - Chrome + - Safari + - Edge + - Plaso references: - - "[Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), - [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and - [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on - ForensicsWiki" -``` - -#### View -The `view` aims to be a concise representation of how to perform this investigative approach, with some omissions. -The `data` section describes the data that will need to be collected, but _not_ how to collect it. Similarly, -each object in `processors` may provide configuration or filtering information, but doesn't explain how to run the processor. - -| Field name | Type | Description | -|--------------|------------|------------------------------------------------------------------------------------------| -| `data` | `[Object]` | The data required to answer the question via this approach. | -| `notes` | `Object` | A description of the approach. Markdown syntax MAY be used for rich text representation. | -| `processors` | `[Object]` | Optional. List of Processor objects. | - -##### Data -This section (`view.data`) can have multiple ways describing the data needed for -this approach. They should be thought of as complementary or as alternates -to each other (they can be "OR"d together, they do not need to be "AND"d). -Each is specified by a pair of `type` and `value`. Current `type`s are -`artifact` and `description`, but more can be added as needs arise. - -* `artifact` corresponds to the name of a [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts), an existing -repository of machine-readable digital forensic artifacts. -Specifying a value for `artifact` is preferred when the data is a host-based -file/artifact, but other methods are available as well. -* `description` is a string describing the data that's needed. This can be used -alone to describe the data, if an `artifact` isn't available or appropriate, or -in conjunction with an `artifact` to better describe it. - -| Field name | Type | Description | -|------------|----------|--------------------------------------------------------------------------------------| -| `type` | `string` | The type of the data. Example: `artifact` for ForensicArtifact definition. | -| `value` | `string` | The value of the type. Example: `BrowserHistory` (the name of the ForensicArtifact). | - -Example ([source](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L40;L45)): -```yaml -data: - - type: artifact - value: BrowserHistory - - type: description - value: Collect local browser history artifacts. These are often in the - form of SQLite databases and JSON files in multiple directories. + - '[Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), + and [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on ForensicsWiki' + - '[Web Browsers on ForensicArtifacts](https://github.com/ForensicArtifacts/artifacts/blob/main/data/webbrowser.yaml)' ``` -##### Notes -The data specified often comes with certain caveats; these can often be tacit knowledge or assumed that "everyone +#### Notes +The approach often comes with certain caveats; these can often be tacit knowledge or assumed that "everyone knows that". This can lead to incorrect assumptions and analysis. Explicitly stating them reduces ambiguity. | Field name | Type | Description | @@ -236,94 +194,62 @@ knows that". This can lead to incorrect assumptions and analysis. Explicitly sta | `covered` | `[string]` | List of strings describing what this data is covering in the context of the approach. | | `not_covered` | `[string]` | List of strings describing what this data is NOT covering in the context of the approach. | -Example ([source](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L46;L57)): +Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L172-L183)): ```yaml notes: covered: - - Chrome downloads. Beyond "stable" Chrome, this also includes - Chromium, Chrome Canary, Chrome Beta, and other Chromium-based browsers - (Microsoft Edge, Brave, and Opera) on Windows, macOS, and Linux + - Chrome downloads. Beyond "stable" Chrome, this also includes Chromium, Chrome + Canary, Chrome Beta, and other Chromium-based browsers (Microsoft Edge, Brave, + and Opera) on Windows, macOS, and Linux - Safari downloads - Includes downloads from all Chrome profiles not_covered: + - Firefox downloads + - Downloads on any other browsers - Browsers installed in non-standard paths - Downloads made during Incognito sessions ``` -#### Processors -A processor is what takes the data collected and processes it in some way to produce structured data an investigator -reviews. Multiple processors can be defined, as there are often multiple programs capable of doing similar processing -(example: log2timeline, Magnet Axiom, and Hindsight can all process browser history artifacts and deliver similar results). +#### Steps +The `steps` list aims to be a concise, ordered representation of how to perform the investigative approach across three stages: +`collection`, `processing`, and `analysis`. -| Field name | Type | Description | -|------------|------------|----------------------------------------------------| -| `name` | `string` | Name of the processor. | -| `options` | `[Object]` | Optional. Configuration options for the processor. | -| `analysis` | `Object` | Optional. Analysis methods and steps. | +* `collection` steps describe the data that needs to be collected (for example, `type: ForensicArtifact` with `value: BrowserHistory`, corresponding to a [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts) definition). +* `processing` steps describe the processor or tool used to transform raw collected data into structured data (for example, `type: command` with `value: Plaso`). +* `analysis` steps describe how to filter, query, or manipulate the processed data to answer the question (for example, `type: opensearch-query`, `type: splunk-query`, or `type: pandas`). -##### Options -The named processor may benefit from some configuration options. +| Field name | Type | Description | +|---------------|----------|----------------------------------------------------------------------------------------------------| +| `name` | `string` | Human readable summary of the step. | +| `description` | `string` | Optional. Detailed description or additional context for the step. | +| `stage` | `string` | The stage of the step: `collection`, `processing`, or `analysis`. | +| `type` | `string` | The type of the step (e.g. `ForensicArtifact`, `command`, `opensearch-query`, `pandas`). | +| `value` | `string` | The value of the step (e.g. `BrowserHistory`, `Plaso`, or an analysis query). | -| Field name | Type | Description | -|------------|----------|-------------------------------------------------------------| -| `type` | `string` | Type of option. This is dependent on the type of processor. | -| `value` | `string` | Value of the option. | - -Example ([source](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L60;L62)): +Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L184-L205)): ```yaml -options: - - type: parsers - value: webhist -``` - -##### Analysis -After running the processor against the `data` (possibly using the `options`), -we may want to take further analysis steps to refine that information. -This could take the form of filtering the data, sorting or otherwise -manipulating it, or something specific to a given analysis platform (for -example, Timesketch may produce a graph). - -Each object in `analysis` is an analysis method, consisting of its `name` -and the analysis `steps`. Broadly speaking, each analysis method should produce -similar output; the user can choose whichever method is available to them and -get similar results. This will not always be the case (a Timesketch graph is -different from a pandas DataFrame), but it is the intent. - -| Field name | Type | Description | -|------------|------------|-----------------------------------| -| `name` | `string` | Name of the analysis method. | -| `steps` | `[Object]` | The steps of the analysis method. | - -###### Steps -Under each analysis method will be a sequence of one or more maps with -keys `description`, `type`, and `value`. If there is more than one map, -they should be processed in sequence in the analysis method (if applicable). -In this way, we can describe multiple chained steps of -analysis (with the `description` being a way to communicate to the user -what exactly each "step" is doing, enabling a "show-your-work"-type capability). - -| Field name | Type | Description | -|---------------|----------|--------------------------------------------------| -| `description` | `string` | Human readable description of the analysis step. | -| `type` | `string` | The type of the analysis step. | -| `value` | `string` | The value of the analysis step. | - -Example ([source](https://github.com/google/dfiq/blob/main/data/approaches/Q1001.10.yaml#L63;L73)): -```yaml -analysis: - - name: OpenSearch - steps: - - description: Filter the results to just file downloads - type: opensearch-query - value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") - - name: Python Notebook - steps: - - description: Filter the results to just file downloads - type: pandas - value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') - - description: Not necessary, but wanted to show two steps - type: pandas - value: sort_values(by='timestamp').head(5) +steps: + - name: Collect ForensicArtifact data + description: Collect local browser history artifacts. These are often in the form + of SQLite databases and JSON files in multiple directories. + stage: collection + type: ForensicArtifact + value: BrowserHistory + - name: Process data with Plaso + description: + stage: processing + type: command + value: Plaso + - name: Filter the results to just file downloads + description: + stage: analysis + type: opensearch-query + value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") + - name: Filter the results to just file downloads + description: + stage: analysis + type: pandas + value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') ``` Python notebooks (Jupyter, Colab, etc) have become powerful tools for @@ -333,8 +259,7 @@ in a notebook makes the analysis more accessible and easier to demonstrate. `type: pandas` refers to pandas [DataFrame](https://pandas.pydata.org/docs/reference/frame.html) methods. They allow chaining, which is very powerful and flexible. One would apply the operation in `value` by assuming the -data from the previous step (either the results from `data` -or the prior analysis step) was saved into a Pandas DataFrame (`df`), +data from the previous step was saved into a Pandas DataFrame (`df`), then applying the operation to it. For example, the -first `pandas` step in the example is equivalent to: +`pandas` step in the example is equivalent to: `df.query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")')`. diff --git a/site/docs/contributing/specification_1_0_1.md b/site/docs/contributing/specification_1_0_1.md new file mode 100644 index 0000000..571513c --- /dev/null +++ b/site/docs/contributing/specification_1_0_1.md @@ -0,0 +1,343 @@ +# DFIQ Specification +**Version: 1.0.1** + +!!! info "Historical Specification" + This is the specification for DFIQ **1.0.1**. For the latest specification, see [DFIQ Specification 1.1.0](/contributing/specification/). + +## Introduction +The DFIQ (Digital Forensics Investigative Questions) Specification defines a standard, language-agnostic interface for +digital forensic investigations. This means that it can be used with any type of data, regardless of the tool or +platform it is stored in. This allows both humans and machines to work together on digital forensic investigations. +Machines can be used to automate tasks, such as data collection and processing, while humans can use their expertise +to interpret the data and identify potential evidence. The DFIQ Specification also helps to ensure that digital +forensic investigations are conducted in a consistent and reliable manner. + +## Versions +The DFIQ Specification is versioned using a major.minor.patch scheme (semantic versioning). The `major.minor` portion +designates the feature set. Patch versions address errors or provide clarifications. + +Tooling which supports version 1.1 SHOULD be compatible with all 1.1.* versions. The patch version SHOULD NOT be +considered by tooling, making no distinction between 3.1.0 and 3.1.1 for example. + +A DFIQ document must include a _dfiq_version_ field with the version. + +## Format +A DFIQ document that conforms to the DFIQ Specification is represented in YAML. + +## Identifiers +``` + Q1024.12 + └──┼───┼── First character indicates type (Scenario, Facet, or Question) + └───┼── 4-digit number*, unique per type + └── [optional] 2-digit number* indicates this is an Approach, + specific to the Question +``` +Both the 4- and 2-digit numbers start with a 1 (or higher) for components appropriate for external use. Numbers +starting with a 0 are reserved for internal use (think of it like private IP address space). Users of DFIQ can use +these IDs for their internal components without worrying about collisions with public components. +[DFIQ on GitHub](https://github.com/google/dfiq) will serve as the definitive central repository to manage +public DFIQ components (and their IDs). + +## Schema +Below are the schemas for the different DFIQ components: [Scenario](#scenario), [Facet](#facet), [Question](#question), +and [Approach](#approach). Each DFIQ component is typically saved as its own YAML file, named after its DFIQ ID +(example: `S1001.yaml`). + +If a field is not explicitly OPTIONAL, it can be considered REQUIRED. + +### Scenario +A Scenario is the highest-level grouping in DFIQ. A Scenario is made of one or more [Facets](#facet) (different +"sides" of an investigation), which in turn are made up of investigative [Questions](#question). + +| Field name | Type | Description | +|----------------|------------|------------------------------------------------------------------------------------------| +| `display_name` | `string` | A human readable name for the scenario. | +| `description` | `string` | A description of the scenario. Markdown syntax MAY be used for rich text representation. | +| `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | +| `type` | `string` | Represent the type of DFIQ object. Should be `scenario` for scenarios. | +| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). | +| `tags` | `[string]` | Optional. List of tags. | +| `contributors` | `[Object]` | Optional. List of people who contributed to this component. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/scenarios/S1001.yaml)): +```yaml +display_name: Data Exfiltration +type: scenario +description: > + An employee is suspected of unauthorized copying of sensitive data (code, + trade secrets, etc) from internal systems to those outside of the company's + control. +id: S1001 +dfiq_version: 1.0.0 +tags: + - Insider +``` + +### Facet +Facets are used for intermediate-level grouping in DFIQ. A particular Facet can be part of multiple different +[Scenarios](#scenario) and will contain multiple [Questions](#question). A Facet breaks the larger Scenario into +smaller logical pieces, but a Facet is still too broad to answer directly; it must also be broken down (into Questions). + +| Field name | Type | Description | +|----------------|------------|-------------------------------------------------------------------------------------------------| +| `display_name` | `string` | A human readable name for the facet. | +| `description` | `string` | Optional. A description of the facet. Markdown syntax MAY be used for rich text representation. | +| `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | +| `type` | `string` | Represent the type of DFIQ object. Should be `facet` for facets. | +| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). | +| `tags` | `[string]` | Optional. List of tags. | +| `contributors` | `[string]` | Optional. List of people who contributed to this component. | +| `parent_ids` | `[string]` | List of DFIQ scenario IDs that this facet belongs to. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/facets/F1008.yaml)): +```yaml +display_name: Are there signs of staging data for future exfiltration? +type: facet +description: > + "Staging" refers to the collection of data of interest onto a local system, + as a precursor step for future exfiltration of that data. When reviewing + data from Questions in this Facet, look for unusual volumes of results + (number or size of files downloaded or sent, for example). +id: F1008 +dfiq_version: 1.0.0 +tags: + - TA0009 +parent_ids: + - S1001 +``` + +### Question +Questions are the fundamental "building blocks" of DFIQ. All other DFIQ components are relative to Questions: +[Approaches](#approach) describe how to answer the Questions, and [Scenarios](#scenario) and [Facets](#facet) organize +the Questions logically. + +A Question should be specific enough that it can be readily answered, and not easily divided into multiple parts (if it +can be, it likely should be multiple Questions). A single Question can be reused in multiple different Facets. + +| Field name | Type | Description | +|----------------|------------|----------------------------------------------------------------------------------------------------| +| `display_name` | `string` | A human readable name for the question. | +| `description` | `string` | Optional. A description of the question. Markdown syntax MAY be used for rich text representation. | +| `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | +| `type` | `string` | Represent the type of DFIQ object. Should be `question` for questions. | +| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). | +| `tags` | `[string]` | Optional. List of tags. | +| `contributors` | `[string]` | Optional. List of people who contributed to this component. | +| `parent_ids` | `[string]` | List of DFIQ facet IDs that this question belongs to. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/questions/Q1001.yaml)): +```yaml +display_name: What files were downloaded using a web browser? +type: question +description: Downloading files via a web browser is a common way to introduce + files to a computer. Determining what files were downloaded can be helpful + in variety of scenarios, ranging from malware investigations to insider cases. +id: Q1001 +dfiq_version: 1.0.0 +tags: + - Web Browser +parent_ids: + - F1008 + - F1002 +``` + +### Approach + +Approaches are detailed explanations of how to answer a [Question](#question) using a specific method, including the +required data, processing, and analysis steps. As there is often more than one way to answer a question, there can be +multiple Approaches that answer a given Question using different techniques. + +Approaches are tightly linked to their Question. Whereas a Question can be a part of multiple Facets, and a Facet can +be part of multiple Scenario, an Approach can only apply to a single specific Question. + +| Field name | Type | Description | +|----------------|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `display_name` | `string` | A human readable name for the approach. | +| `description` | `Object` | See Approach Description schema. | +| `type` | `string` | Represent the type of DFIQ object. Should be `approach` for approaches. | +| `dfiq_version` | `string` | A semantic version format major.minor.patch scheme. | +| `id` | `string` | Identifier using the format defined in [identifiers](#identifiers). An Approach identifier will share the first five characters with the Question it relates to, and end with a two-digit suffix. Example: `Q1024.12`. | +| `tags` | `[string]` | Optional. List of tags. | +| `contributors` | `[string]` | Optional. List of people who contributed to this component. | +| `view` | `Object` | The view aims to be a concise representation of how to perform this investigative approach. See the [View schema](#view). | + +#### Description +The `description` is a bit that goes before the details on how to implement the approach. It can introduce important +concepts and terms. If reasonable, long form explanations of forensic concepts should be added to the +ForensicsWiki, and then a link to that page added in `references` to avoid duplication. + +| Field name | Type | Description | +|-----------------------|------------|--------------------------------------------------------------------------------------------------------------------------| +| `summary` | `string` | A human readable summary for the approach. | +| `details` | `string` | A description of the approach. Markdown syntax MAY be used for rich text representation. | +| `references` | `[string]` | Optional. List of URLs of public references to this approach. Markdown syntax MAY be used for rich text representation. | +| `references_internal` | `[string]` | Optional. List of URLs of private references to this approach. Markdown syntax MAY be used for rich text representation. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/approaches/Q1001.10.yaml#L26-L37)): +```yaml +description: + summary: Parse download records from web browsers' own databases. + details: > + Most web browsers track file downloads (at least in non-Incognito/private + sessions) in local artifacts on the system. We can collect and review + these records. This approach is useful when you have remote access to a + system (via GRR for example) or a disk image. + references: + - "[Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), + [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and + [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on + ForensicsWiki" +``` + +#### View +The `view` aims to be a concise representation of how to perform this investigative approach, with some omissions. +The `data` section describes the data that will need to be collected, but _not_ how to collect it. Similarly, +each object in `processors` may provide configuration or filtering information, but doesn't explain how to run the processor. + +| Field name | Type | Description | +|--------------|------------|------------------------------------------------------------------------------------------| +| `data` | `[Object]` | The data required to answer the question via this approach. | +| `notes` | `Object` | A description of the approach. Markdown syntax MAY be used for rich text representation. | +| `processors` | `[Object]` | Optional. List of Processor objects. | + +##### Data +This section (`view.data`) can have multiple ways describing the data needed for +this approach. They should be thought of as complementary or as alternates +to each other (they can be "OR"d together, they do not need to be "AND"d). +Each is specified by a pair of `type` and `value`. Current `type`s are +`artifact` and `description`, but more can be added as needs arise. + +* `artifact` corresponds to the name of a [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts), an existing +repository of machine-readable digital forensic artifacts. +Specifying a value for `artifact` is preferred when the data is a host-based +file/artifact, but other methods are available as well. +* `description` is a string describing the data that's needed. This can be used +alone to describe the data, if an `artifact` isn't available or appropriate, or +in conjunction with an `artifact` to better describe it. + +| Field name | Type | Description | +|------------|----------|--------------------------------------------------------------------------------------| +| `type` | `string` | The type of the data. Example: `artifact` for ForensicArtifact definition. | +| `value` | `string` | The value of the type. Example: `BrowserHistory` (the name of the ForensicArtifact). | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/approaches/Q1001.10.yaml#L40-L45)): +```yaml +data: + - type: artifact + value: BrowserHistory + - type: description + value: Collect local browser history artifacts. These are often in the + form of SQLite databases and JSON files in multiple directories. +``` + +##### Notes +The data specified often comes with certain caveats; these can often be tacit knowledge or assumed that "everyone +knows that". This can lead to incorrect assumptions and analysis. Explicitly stating them reduces ambiguity. + +| Field name | Type | Description | +|---------------|------------|-------------------------------------------------------------------------------------------| +| `covered` | `[string]` | List of strings describing what this data is covering in the context of the approach. | +| `not_covered` | `[string]` | List of strings describing what this data is NOT covering in the context of the approach. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/approaches/Q1001.10.yaml#L46-L57)): +```yaml +notes: + covered: + - Chrome downloads. Beyond "stable" Chrome, this also includes + Chromium, Chrome Canary, Chrome Beta, and other Chromium-based browsers + (Microsoft Edge, Brave, and Opera) on Windows, macOS, and Linux + - Safari downloads + - Includes downloads from all Chrome profiles + not_covered: + - Browsers installed in non-standard paths + - Downloads made during Incognito sessions +``` + +#### Processors +A processor is what takes the data collected and processes it in some way to produce structured data an investigator +reviews. Multiple processors can be defined, as there are often multiple programs capable of doing similar processing +(example: log2timeline, Magnet Axiom, and Hindsight can all process browser history artifacts and deliver similar results). + +| Field name | Type | Description | +|------------|------------|----------------------------------------------------| +| `name` | `string` | Name of the processor. | +| `options` | `[Object]` | Optional. Configuration options for the processor. | +| `analysis` | `Object` | Optional. Analysis methods and steps. | + +##### Options +The named processor may benefit from some configuration options. + +| Field name | Type | Description | +|------------|----------|-------------------------------------------------------------| +| `type` | `string` | Type of option. This is dependent on the type of processor. | +| `value` | `string` | Value of the option. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/approaches/Q1001.10.yaml#L60-L62)): +```yaml +options: + - type: parsers + value: webhist +``` + +##### Analysis +After running the processor against the `data` (possibly using the `options`), +we may want to take further analysis steps to refine that information. +This could take the form of filtering the data, sorting or otherwise +manipulating it, or something specific to a given analysis platform (for +example, Timesketch may produce a graph). + +Each object in `analysis` is an analysis method, consisting of its `name` +and the analysis `steps`. Broadly speaking, each analysis method should produce +similar output; the user can choose whichever method is available to them and +get similar results. This will not always be the case (a Timesketch graph is +different from a pandas DataFrame), but it is the intent. + +| Field name | Type | Description | +|------------|------------|-----------------------------------| +| `name` | `string` | Name of the analysis method. | +| `steps` | `[Object]` | The steps of the analysis method. | + +###### Steps +Under each analysis method will be a sequence of one or more maps with +keys `description`, `type`, and `value`. If there is more than one map, +they should be processed in sequence in the analysis method (if applicable). +In this way, we can describe multiple chained steps of +analysis (with the `description` being a way to communicate to the user +what exactly each "step" is doing, enabling a "show-your-work"-type capability). + +| Field name | Type | Description | +|---------------|----------|--------------------------------------------------| +| `description` | `string` | Human readable description of the analysis step. | +| `type` | `string` | The type of the analysis step. | +| `value` | `string` | The value of the analysis step. | + +Example ([source](https://github.com/google/dfiq/blob/634f9f9/dfiq/data/approaches/Q1001.10.yaml#L63-L73)): +```yaml +analysis: + - name: OpenSearch + steps: + - description: Filter the results to just file downloads + type: opensearch-query + value: data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") + - name: Python Notebook + steps: + - description: Filter the results to just file downloads + type: pandas + value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') + - description: Not necessary, but wanted to show two steps + type: pandas + value: sort_values(by='timestamp').head(5) +``` + +Python notebooks (Jupyter, Colab, etc) have become powerful tools for +security analysts. Recording the analysis steps in a way that would work +in a notebook makes the analysis more accessible and easier to demonstrate. + +`type: pandas` refers to pandas [DataFrame](https://pandas.pydata.org/docs/reference/frame.html) +methods. They allow chaining, which is very powerful and flexible. +One would apply the operation in `value` by assuming the +data from the previous step (either the results from `data` +or the prior analysis step) was saved into a Pandas DataFrame (`df`), +then applying the operation to it. For example, the +first `pandas` step in the example is equivalent to: +`df.query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")')`. diff --git a/site/docs/index.md b/site/docs/index.md index 2afe8fa..2dea6fb 100644 --- a/site/docs/index.md +++ b/site/docs/index.md @@ -5,10 +5,11 @@ hide: - toc --- -
-# Digital Forensics Investigative Questions -DFIQ Logo -
+# Digital Forensics Investigative Questions { style="text-align: center" } + +

+ DFIQ Logo +

DFIQ is a collection of Digital Forensics Investigative Questions and the approaches to answering them. The goal of the project is to build a comprehensive catalog of investigative knowledge to help drive @@ -20,8 +21,7 @@ consistent, thorough, and explainable investigations. * Uses the concept of [Scenarios](/scenarios) to logically group Questions and help structure investigations * Stores data in an easily-readable, tool-agnostic format (YAML) to be used by others -
-## Get Started! +## Get Started! { style="text-align: center" } [View Questions](/questions){ .md-button }   [View Scenarios](/scenarios){ .md-button } -
\ No newline at end of file +{ style="text-align: center" } \ No newline at end of file diff --git a/site/docs/questions/Q1001.md b/site/docs/questions/Q1001.md index d510d35..f4f10de 100644 --- a/site/docs/questions/Q1001.md +++ b/site/docs/questions/Q1001.md @@ -2,8 +2,10 @@ tags: - Chrome - Edge + - Hindsight - macOS - NTFS + - Plaso - Safari - SQLite - USN Journal @@ -23,19 +25,18 @@ hide: **Approaches to Answer** -- [Collect download records from local browser artifacts [Q1001.10]](#collect-download-records-from-local-browser-artifacts) +- [Detect browser downloads via change journal records](#detect-browser-downloads-via-change-journal-records) + - File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using NTFS change journal (USN journal) records. + - Tags: Web Browser Windows USN Journal NTFS Plaso +- [Detect browser downloads via file system event logs](#detect-browser-downloads-via-file-system-event-logs) + - File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using file system logs (like Santa). + - Tags: Web Browser macOS Plaso +- [Collect download records from local browser artifacts (Plaso)](#collect-download-records-from-local-browser-artifacts-plaso) - Parse download records from web browsers' own databases. - - Tags: Web Browser SQLite Chrome Safari Edge -- [Detect browser downloads via file system event logs [Q1001.11]](#detect-browser-downloads-via-file-system-event-logs) - - File downloads by some web browsers create a specific pattern of events -on the file system. We can use this to see browser downloads using file system -logs (like Santa). - - Tags: Web Browser macOS -- [Detect browser downloads via change journal records [Q1001.12]](#detect-browser-downloads-via-change-journal-records) - - File downloads by some web browsers create a specific pattern of events -on the file system. We can use this to see browser downloads using NTFS change -journal (USN journal) records. - - Tags: Web Browser Windows USN Journal NTFS + - Tags: Web Browser SQLite Chrome Safari Edge Plaso +- [Collect download records from local browser artifacts (Hindsight)](#collect-download-records-from-local-browser-artifacts-hindsight) + - Parse download records from web browsers' own databases. + - Tags: Web Browser SQLite Chrome Safari Edge Hindsight # Approaches @@ -45,18 +46,27 @@ journal (USN journal) records. benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -## Collect download records from local browser artifacts +## Detect browser downloads via change journal records ### 🗂️ Explanation -Parse download records from web browsers' own databases. - -Most web browsers track file downloads (at least in non-Incognito/private -sessions) in local artifacts on the system. We can collect and review -these records. This approach is useful when you have remote access to a -system (via GRR for example) or a disk image. +File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using NTFS change journal (USN journal) records. +Chrome downloads on Windows create a specific pattern of events on the file system: +1. **Download starts with a `FILE CREATE` event to `.tmp` file; older Chrome versions + have been observed creating four character file names (like `7DEE.tmp`) + while newer versions use file names consistent with Version 4 UUIDs + (like `183011a0-f96c-4c98-b71b-ab8754fb0e0e.tmp`). +1. That `.tmp` file might be `RENAME`d to `Unconfirmed [6 digits].crdownload`. 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the `.tmp` file is + renamed to the eventual filename (with extension) with `.crdownload` +appended + at the end (like `cat.jpg.crdownload`). **In either case ([2] or [3]), +at + this point we have a file ending in .crdownload.** +1. Once the download completes, the `.crdownload` suffix is removed via a + `USN_REASON_RENAME_OLD_NAME` event, leaving the downloaded file with its +final name. +Since [4] above captures the key information about the file download, we can search change journal records for it. #### References - - [Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on ForensicsWiki - - [Web Browsers on ForensicArtifacts](https://github.com/ForensicArtifacts/artifacts/blob/main/data/webbrowser.yaml) + - [Change Journals](https://learn.microsoft.com/en-gb/windows/win32/fileio/change-journals) ### 📝 Notes @@ -68,138 +78,59 @@ ambiguity. !!! success "Covered" - - Chrome downloads. Beyond "stable" Chrome, this also includes Chromium, Chrome Canary, Chrome Beta, and other Chromium-based browsers (Microsoft Edge, Brave, and Opera) on Windows, macOS, and Linux - - Safari downloads - - Includes downloads from all Chrome profiles + - Chrome downloads to an NTFS volume !!! failure "Not Covered" - - Firefox downloads - - Downloads on any other browsers - - Browsers installed in non-standard paths - - Downloads made during Incognito sessions - - -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: BrowserHistory ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=BrowserHistory)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers webhist - ``` - - #### 📊 Analysis + - All other browsers. + - Downloads from other Chromium/Chrome-based browsers _might_ be collected via this method, but testing is necessary to confirm. + - Downloads on file systems other than NTFS. + - Downloads that would be covered, but happened long enough ago that the USN Journal records that would show it have been deleted. - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +### ⚙️ Steps +1. collection **Collect ForensicArtifact data** + - **Description**: The NTFS $UsnJnrl file system metadata file. This ForensicArtifact definition does not include the $J alternate data stream, but many tools collect it anyway. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: NTFSUSNJournal ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=NTFSUSNJournal)) - OpenSearch +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - 1. Filter the results to just file downloads - - OpenSearch query: +1. analysis **Filter the results to file system rename events where the original file name ended with `.crdownload`.** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") + data_type:"fs:ntfs:usn_change" filename:crdownload "USN_REASON_RENAME_OLD_NAME" ``` - Python Notebook +1. analysis **Select and search for the `file_reference` value for an event of interest from the previous query. There should be one with the same timestamp as your previous event and its `filename` value is the download's final name.** + - **Type**: OpenSearch query + - **Value**: - 1. Filter the results to just file downloads - - Python code: - - ``` - df.query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') ``` -=== "Hindsight" - More information on [Hindsight](https://forensics.wiki/hindsight). - - Recommended options: - - ``` - --format jsonl - ``` - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Hindsight's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - - - OpenSearch - - 1. Filter the results to just file downloads. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari. - - - OpenSearch query: - - ``` - data_type:"chrome:history:file_downloaded" + data_type:"fs:ntfs:usn_change" {file_reference value} "USN_REASON_RENAME_NEW_NAME" ``` - Python Notebook - - 1. Filter the results to just file downloads. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari. - - - Python code: - - ``` - df.query('data_type == "chrome:history:file_downloaded"') - ``` ## Detect browser downloads via file system event logs ### 🗂️ Explanation -File downloads by some web browsers create a specific pattern of events -on the file system. We can use this to see browser downloads using file system -logs (like Santa). - +File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using file system logs (like Santa). Chrome downloads on macOS create a specific pattern of file system events: - 1. **Download starts with a `WRITE` event to a temp file named like - `.com.google.Chrome.avXx0U`** (the suffix looks to be 6 letters/numbers). -1. That .com.google.Chrome... temp file might be `RENAME`d to `Unconfirmed [6 - digits].crdownload`. + `.com.google.Chrome.avXx0U`** (the suffix looks to be 6 +letters/numbers). 1. That .com.google.Chrome... temp file might be `RENAME`d to `Unconfirmed [6 + digits].crdownload`. 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the .com.google. temp file is renamed to the eventual filename (with extension) with - `.crdownload` appended at the end (like `cat.jpg.crdownload`). **In either + `.crdownload` appended at the end (like `cat.jpg.crdownload`). **In +either case ([2] or [3]), at this point we have a file ending in .crdownload.** 1. Once the download completes, the `.crdownload` suffix is removed via a `RENAME` event, leaving the downloaded file with its final name. -Since [4] above captures the key information about the file download, we can -search file system logs for it. - +Since [4] above captures the key information about the file download, we can search file system logs for it. ### 📝 Notes @@ -219,85 +150,33 @@ ambiguity. - Downloads from other Chromium/Chrome-based browsers _might_ be collected via this method, but testing is necessary to confirm. - Downloads that occurred on macOS with Santa, but during a time period for which there are no Santa logs (out of retention or Santa was disabled). +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Santa logs stored on the local disk; they may also be centralized off-system, but this artifact does not include those. - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) +1. collection **Collect ForensicArtifact data** + - **Description**: Santa logs stored on the local disk; they may also be centralized off-system, but this artifact does not include those. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: SantaLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=SantaLogs)) -**Value** -: SantaLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=SantaLogs)) +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers santa - ``` - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - - - OpenSearch - - 1. Filter the results to file system rename events where the original file name ended with `.crdownload`. - - OpenSearch query: +1. analysis **Filter the results to file system rename events where the original file name ended with `.crdownload`.** + - **Type**: OpenSearch query + - **Value**: ``` data_type:"santa:file_system_event" action:RENAME file_path:"*\.crdownload" ``` -## Detect browser downloads via change journal records -### 🗂️ Explanation -File downloads by some web browsers create a specific pattern of events -on the file system. We can use this to see browser downloads using NTFS change -journal (USN journal) records. -Chrome downloads on Windows create a specific pattern of events on the file system: - -1. **Download starts with a `FILE CREATE` event to `.tmp` file; older Chrome versions - have been observed creating four character file names (like `7DEE.tmp`) - while newer versions use file names consistent with Version 4 UUIDs - (like `183011a0-f96c-4c98-b71b-ab8754fb0e0e.tmp`). -1. That `.tmp` file might be `RENAME`d to `Unconfirmed [6 digits].crdownload`. -1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the `.tmp` file is - renamed to the eventual filename (with extension) with `.crdownload` appended - at the end (like `cat.jpg.crdownload`). **In either case ([2] or [3]), at - this point we have a file ending in .crdownload.** -1. Once the download completes, the `.crdownload` suffix is removed via a - `USN_REASON_RENAME_OLD_NAME` event, leaving the downloaded file with its final name. - -Since [4] above captures the key information about the file download, we can -search change journal records for it. +## Collect download records from local browser artifacts (Plaso) +### 🗂️ Explanation +Parse download records from web browsers' own databases. +Most web browsers track file downloads (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. #### References - - [Change Journals](https://learn.microsoft.com/en-gb/windows/win32/fileio/change-journals) + - [Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on ForensicsWiki + - [Web Browsers on ForensicArtifacts](https://github.com/ForensicArtifacts/artifacts/blob/main/data/webbrowser.yaml) ### 📝 Notes @@ -309,73 +188,98 @@ ambiguity. !!! success "Covered" - - Chrome downloads to an NTFS volume + - Chrome downloads. Beyond "stable" Chrome, this also includes Chromium, Chrome Canary, Chrome Beta, and other Chromium-based browsers (Microsoft Edge, Brave, and Opera) on Windows, macOS, and Linux + - Safari downloads + - Includes downloads from all Chrome profiles !!! failure "Not Covered" - - All other browsers. - - Downloads from other Chromium/Chrome-based browsers _might_ be collected via this method, but testing is necessary to confirm. - - Downloads on file systems other than NTFS. - - Downloads that would be covered, but happened long enough ago that the USN Journal records that would show it have been deleted. + - Firefox downloads + - Downloads on any other browsers + - Browsers installed in non-standard paths + - Downloads made during Incognito sessions +### ⚙️ Steps -### 💾 Data +1. collection **Collect ForensicArtifact data** + - **Description**: Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: BrowserHistory ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=BrowserHistory)) -The following data source(s) are needed for this approach to the question. +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso -**Description** -: The NTFS $UsnJnrl file system metadata file. This ForensicArtifact definition does not include the $J alternate data stream, but many tools collect it anyway. +1. analysis **Filter the results to just file downloads** + - **Type**: OpenSearch query + - **Value**: + ``` + data_type:("chrome:history:file_downloaded" OR "safari:downloads:entry") + ``` -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) +1. analysis **Filter the results to just file downloads** + - **Type**: Pandas (`pandas`) + - **Value**: -**Value** -: NTFSUSNJournal ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=NTFSUSNJournal)) + ```python + df.query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') + ``` -### ⚙️ Processors +## Collect download records from local browser artifacts (Hindsight) +### 🗂️ Explanation +Parse download records from web browsers' own databases. +Most web browsers track file downloads (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. +#### References + - [Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on ForensicsWiki + - [Web Browsers on ForensicArtifacts](https://github.com/ForensicArtifacts/artifacts/blob/main/data/webbrowser.yaml) -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. +### 📝 Notes +Each approach comes with certain caveats or limitations. These can often +be tacit knowledge or assumed that "everyone knows that" (even though they +don't). This can lead to incorrect assumptions and analysis. +Explicitly stating what is covered and not covered by the approach reduces +ambiguity. -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). +!!! success "Covered" - Recommended options: + - Chrome downloads. Beyond "stable" Chrome, this also includes Chromium, Chrome Canary, Chrome Beta, and other Chromium-based browsers (Microsoft Edge, Brave, and Opera) on Windows, macOS, and Linux + - Safari downloads + - Includes downloads from all Chrome profiles - ``` - --parsers usnjrnl - ``` +!!! failure "Not Covered" - #### 📊 Analysis + - Firefox downloads + - Downloads on any other browsers + - Browsers installed in non-standard paths + - Downloads made during Incognito sessions - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +### ⚙️ Steps +1. collection **Collect ForensicArtifact data** + - **Description**: Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: BrowserHistory ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=BrowserHistory)) - OpenSearch +1. processing **Process data with Hindsight** + - **Type**: command + - **Value**: Hindsight - 1. Filter the results to file system rename events where the original file name ended with `.crdownload`. - - OpenSearch query: +1. analysis **Filter the results to just file downloads. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari.** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:"fs:ntfs:usn_change" filename:crdownload "USN_REASON_RENAME_OLD_NAME" + data_type:"chrome:history:file_downloaded" ``` - 1. Select and search for the `file_reference` value for an event of interest from the previous query. There should be one with the same timestamp as your previous event and its `filename` value is the download's final name. - - OpenSearch query: +1. analysis **Filter the results to just file downloads. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari.** + - **Type**: Pandas (`pandas`) + - **Value**: + ```python + df.query('data_type == "chrome:history:file_downloaded"') ``` - data_type:"fs:ntfs:usn_change" {file_reference value} "USN_REASON_RENAME_NEW_NAME" - ``` + diff --git a/site/docs/questions/Q1018.md b/site/docs/questions/Q1018.md index 12416fd..908dfe1 100644 --- a/site/docs/questions/Q1018.md +++ b/site/docs/questions/Q1018.md @@ -1,7 +1,10 @@ --- tags: - CrowdStrike + - Crowdstrike Investigate (UI) - DNS + - Plaso + - Splunk - Sysmon - Windows @@ -18,15 +21,18 @@ hide: **Approaches to Answer** -- [Use Crowdstrike "Bulk Domains" to link source processes to DNS queries [Q1018.10]](#use-crowdstrike-"bulk-domains"-to-link-source-processes-to-dns-queries) +- [Use Crowdstrike event search to link source processes to DNS queries](#use-crowdstrike-event-search-to-link-source-processes-to-dns-queries) - CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. - - Tags: CrowdStrike DNS -- [Use Crowdstrike event search to link source processes to DNS queries [Q1018.11]](#use-crowdstrike-event-search-to-link-source-processes-to-dns-queries) + - Tags: CrowdStrike DNS Splunk +- [Use Crowdstrike "Bulk Domains" to link source processes to DNS queries](#use-crowdstrike-bulk-domains-to-link-source-processes-to-dns-queries) - CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. - - Tags: CrowdStrike DNS -- [Use Sysmon (Event ID 22) to link source processes to DNS queries [Q1018.12]](#use-sysmon-event-id-22-to-link-source-processes-to-dns-queries) + - Tags: CrowdStrike DNS Crowdstrike Investigate (UI) +- [Use Sysmon (Event ID 22) to link source processes to DNS queries (Splunk)](#use-sysmon-event-id-22-to-link-source-processes-to-dns-queries-splunk) - Sysmon Event ID 22 DnsQuery stores source process ID - - Tags: Sysmon DNS Windows + - Tags: Sysmon DNS Windows Splunk +- [Use Sysmon (Event ID 22) to link source processes to DNS queries (Plaso)](#use-sysmon-event-id-22-to-link-source-processes-to-dns-queries-plaso) + - Sysmon Event ID 22 DnsQuery stores source process ID + - Tags: Sysmon DNS Windows Plaso # Approaches @@ -36,12 +42,10 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -## Use Crowdstrike "Bulk Domains" to link source processes to DNS queries +## Use Crowdstrike event search to link source processes to DNS queries ### 🗂️ Explanation CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. - -Crowdstrike is a detection platform, not a logging platform, so not all DNS requests are logged. -Content Filter needs to be enabled to capture DNS request queries. +Crowdstrike is a detection platform, not a logging platform, so not all DNS requests are logged. Content Filter needs to be enabled to capture DNS request queries. #### References - https://www.crowdstrike.com/blog/hunt-threat-activity-falcon-host-endpoint-protection/bulk-domain-search-results/ @@ -62,53 +66,28 @@ ambiguity. - Hosts with the Falcon agent, but where the Content Filter is not enabled +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - - - - CrowdStrike: DnsRequest - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. +1. collection **Collect DnsRequest from CrowdStrike** + - **Type**: CrowdStrike + - **Value**: DnsRequest -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. +1. processing **Process data with Splunk** + - **Type**: command + - **Value**: Splunk +1. analysis **Query joining DNS Request events and executions gives the source for each DNS query** + - **Type**: Splunk query + - **Value**: -=== "Crowdstrike Investigate (Ui)" - More information on [Crowdstrike Investigate (Ui)](https://forensics.wiki/crowdstrike investigate (ui)). - - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Crowdstrike Investigate (Ui)'s output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - - - Manual - - 1. UI steps in Investigate Bulk domains - - Type: GUI - - Value: In the second table, `Process that looked up specified Domain(s)` the columns `PID`, `Process ID`, and `File Name` give the source process information for the DNS query. - + ``` + ComputerName="{hostname}" event_simpleName=ProcessRollup* | rename TargetProcessId_decimal as ContextProcessId_decimal | join ContextProcessId_decimal [search ComputerName="{hostname}" event_simpleName=DnsRequest | fields ContextProcessId_decimal, DomainName] | table _time, DomainName, ImageFileName + ``` -## Use Crowdstrike event search to link source processes to DNS queries +## Use Crowdstrike "Bulk Domains" to link source processes to DNS queries ### 🗂️ Explanation CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. - -Crowdstrike is a detection platform, not a logging platform, so not all DNS requests are logged. -Content Filter needs to be enabled to capture DNS request queries. +Crowdstrike is a detection platform, not a logging platform, so not all DNS requests are logged. Content Filter needs to be enabled to capture DNS request queries. #### References - https://www.crowdstrike.com/blog/hunt-threat-activity-falcon-host-endpoint-protection/bulk-domain-search-results/ @@ -129,50 +108,23 @@ ambiguity. - Hosts with the Falcon agent, but where the Content Filter is not enabled +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - - - - CrowdStrike: DnsRequest - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. +1. collection **Collect DnsRequest from CrowdStrike** + - **Type**: CrowdStrike + - **Value**: DnsRequest -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. +1. processing **Process data with Crowdstrike Investigate (UI)** + - **Type**: command + - **Value**: Crowdstrike Investigate (UI) +1. analysis **UI steps in Investigate Bulk domains** + - **Type**: GUI + - **Value**: In the second table, `Process that looked up specified Domain(s)` the columns `PID`, `Process ID`, and `File Name` give the source process information for the DNS query. -=== "Splunk" - More information on [Splunk](https://forensics.wiki/splunk). - - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Splunk's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - - - Splunk-Query - - 1. Query joining DNS Request events and executions gives the source for each DNS query - - Type: splunk-query - - Value: ComputerName="{hostname}" event_simpleName=ProcessRollup* | rename TargetProcessId_decimal as ContextProcessId_decimal | join ContextProcessId_decimal [search ComputerName="{hostname}" event_simpleName=DnsRequest | fields ContextProcessId_decimal, DomainName] | table _time, DomainName, ImageFileName - -## Use Sysmon (Event ID 22) to link source processes to DNS queries +## Use Sysmon (Event ID 22) to link source processes to DNS queries (Splunk) ### 🗂️ Explanation Sysmon Event ID 22 DnsQuery stores source process ID - DNS Query, event ID 22, records a DNS query being issued by a specific host and the originating process. #### References @@ -194,104 +146,99 @@ ambiguity. - Windows hosts without Sysmon installed +### ⚙️ Steps -### 💾 Data +1. collection **Collect ForensicArtifact data** + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsXMLEventLogSysmon ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsXMLEventLogSysmon)) -The following data source(s) are needed for this approach to the question. +1. processing **Process data with Splunk** + - **Type**: command + - **Value**: Splunk +1. analysis **Query for Sysmon Event ID 22 and extracting the parent process ID and path.** + - **Type**: Splunk query + - **Value**: + ``` + source="xmlwineventlog:microsoft-windows-sysmon/operational" EventCode=22 | table _time, host, process_id, process_path + ``` -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsXMLEventLogSysmon ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsXMLEventLogSysmon)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Splunk" - More information on [Splunk](https://forensics.wiki/splunk). - - - #### 📊 Analysis +## Use Sysmon (Event ID 22) to link source processes to DNS queries (Plaso) +### 🗂️ Explanation +Sysmon Event ID 22 DnsQuery stores source process ID +DNS Query, event ID 22, records a DNS query being issued by a specific host and the originating process. - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Splunk's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +#### References + - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=90022 +### 📝 Notes - Splunk-Query +Each approach comes with certain caveats or limitations. These can often +be tacit knowledge or assumed that "everyone knows that" (even though they +don't). This can lead to incorrect assumptions and analysis. +Explicitly stating what is covered and not covered by the approach reduces +ambiguity. - 1. Query for Sysmon Event ID 22 and extracting the parent process ID and path. - - Type: splunk-query - - Value: source="xmlwineventlog:microsoft-windows-sysmon/operational" EventCode=22 | table _time, host, process_id, process_path +!!! success "Covered" -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). + - Windows +!!! failure "Not Covered" - #### 📊 Analysis + - Windows hosts without Sysmon installed - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +### ⚙️ Steps +1. collection **Collect ForensicArtifact data** + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsXMLEventLogSysmon ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsXMLEventLogSysmon)) - OpenSearch +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - 1. Query for Sysmon Event ID 22 events - - OpenSearch query: +1. analysis **Query for Sysmon Event ID 22 events** + - **Type**: OpenSearch query + - **Value**: ``` data_type:"windows:evtx:record" source_name:"Microsoft-Windows-Sysmon" event_identifier:22 ``` - 1. Determine the source process in relevant event(s) - - Type: manual - - Value: Plaso (as of v20230717) doesn't parse the `xml_string` into attributes. Examine the `xml_string`; the value after `` is the process that made the DNS query. +1. analysis **Determine the source process in relevant event(s)** + - **Type**: manual + - **Value**: Plaso (as of v20230717) doesn't parse the `xml_string` into attributes. Examine the `xml_string`; the value after `` is the process that made the DNS query. +1. analysis **Query for Sysmon Event ID 22 events** + - **Type**: Pandas (`pandas`) + - **Value**: - - Python Notebook - - 1. Query for Sysmon Event ID 22 events - - Python code: - - ``` - df.df.query('data_type == "windows:evtx:record" and source_name == "Microsoft-Windows-Sysmon" and event_identifier == 22') + ```python + df.query('data_type == "windows:evtx:record" and source_name == "Microsoft-Windows-Sysmon" and event_identifier == 22') ``` - 1. Extract `Image` attribute - - Python code: +1. analysis **Extract `Image` attribute** + - **Type**: Pandas (`pandas`) + - **Value**: - ``` - df.df['process'] = df['xml_string'].str.extract(r'(.*?)') + ```python + df['process'] = df['xml_string'].str.extract(r'(.*?)') ``` - 1. Extract `QueryName` attribute - - Python code: +1. analysis **Extract `QueryName` attribute** + - **Type**: Pandas (`pandas`) + - **Value**: - ``` - df.df['query'] = df['xml_string'].str.extract(r'(.*?)') + ```python + df['query'] = df['xml_string'].str.extract(r'(.*?)') ``` - 1. Filter down to DNS query of interest - - Python code: +1. analysis **Filter down to DNS query of interest** + - **Type**: Pandas (`pandas`) + - **Value**: + ```python + df[df.query.str.contains('')] ``` - df.df[df.query.str.contains('')] - ``` + diff --git a/site/docs/questions/Q1019.md b/site/docs/questions/Q1019.md index fd7dbd2..04b892f 100644 --- a/site/docs/questions/Q1019.md +++ b/site/docs/questions/Q1019.md @@ -2,6 +2,7 @@ tags: - CrowdStrike - Process Execution + - Splunk - Web Browser hide: @@ -17,9 +18,9 @@ hide: **Approaches to Answer** -- [Collect process executions in Crowdstrike event search [Q1019.10]](#collect-process-executions-in-crowdstrike-event-search) +- [Collect process executions in Crowdstrike event search](#collect-process-executions-in-crowdstrike-event-search) - CrowdStrike records process executions in ProcessRollup event. - - Tags: CrowdStrike Process Execution + - Tags: CrowdStrike Process Execution Splunk # Approaches @@ -32,7 +33,6 @@ hide: ## Collect process executions in Crowdstrike event search ### 🗂️ Explanation CrowdStrike records process executions in ProcessRollup event. - CrowdStrike is a detection platform, not a logging platform, so not all ProcessRollup events might be logged. #### References @@ -56,43 +56,21 @@ ambiguity. - Other browsers (including Chromium) - One of those four browsers, but have had their process name changed +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - - - - CrowdStrike: ProcessRollup - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Splunk" - More information on [Splunk](https://forensics.wiki/splunk). - - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Splunk's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +1. collection **Collect ProcessRollup from CrowdStrike** + - **Type**: CrowdStrike + - **Value**: ProcessRollup +1. processing **Process data with Splunk** + - **Type**: command + - **Value**: Splunk - Splunk-Query +1. analysis **Query filtering the known browsers in execution event logs.** + - **Type**: Splunk query + - **Value**: - 1. Query filtering the known browsers in execution event logs. - - Type: splunk-query - - Value: ComputerName="{hostname}" event_simpleName=ProcessRollup* ImageFileName IN ("*chrome*", "*firefox*", "*safari*", "*edge*") | table _time, CommandLine, ImageFileName + ``` + ComputerName="{hostname}" event_simpleName=ProcessRollup* ImageFileName IN ("*chrome*", "*firefox*", "*safari*", "*edge*") | table _time, CommandLine, ImageFileName + ``` diff --git a/site/docs/questions/Q1020.md b/site/docs/questions/Q1020.md index 18baf73..5cecbec 100644 --- a/site/docs/questions/Q1020.md +++ b/site/docs/questions/Q1020.md @@ -3,7 +3,9 @@ tags: - Chrome - Edge - Firefox + - Hindsight - Internet Explorer + - Plaso - Safari - SQLite - Web Browser @@ -21,9 +23,12 @@ hide: **Approaches to Answer** -- [Collect URL visit records from local browser artifacts [Q1020.10]](#collect-url-visit-records-from-local-browser-artifacts) +- [Collect URL visit records from local browser artifacts (Plaso)](#collect-url-visit-records-from-local-browser-artifacts-plaso) - Parse URL visit records from web browsers' own databases. - - Tags: Web Browser SQLite Chrome Safari Firefox Edge Internet Explorer + - Tags: Web Browser SQLite Chrome Safari Firefox Edge Internet Explorer Plaso +- [Collect URL visit records from local browser artifacts (Hindsight)](#collect-url-visit-records-from-local-browser-artifacts-hindsight) + - Parse URL visit records from web browsers' own databases. + - Tags: Web Browser SQLite Chrome Safari Firefox Edge Internet Explorer Hindsight # Approaches @@ -33,14 +38,10 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -## Collect URL visit records from local browser artifacts +## Collect URL visit records from local browser artifacts (Plaso) ### 🗂️ Explanation Parse URL visit records from web browsers' own databases. - -Most web browsers track URL visits (at least in non-Incognito/private -sessions) in local artifacts on the system. We can collect and review -these records. This approach is useful when you have remote access to a -system (via GRR for example) or a disk image. +Most web browsers track URL visits (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. #### References - [Chrome](https://forensics.wiki/google_chrome/#history), [Firefox](https://forensics.wiki/mozilla_firefox/#history), and [Safari](https://forensics.wiki/apple_safari/#history) History on ForensicsWiki @@ -68,102 +69,88 @@ ambiguity. - Browsers installed in non-standard paths - Visits made in Incognito/Private sessions +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: BrowserHistory ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=BrowserHistory)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). +1. collection **Collect ForensicArtifact data** + - **Description**: Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: BrowserHistory ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=BrowserHistory)) - Recommended options: +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - ``` - --parsers webhist - ``` - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - - - OpenSearch - - 1. Filter the results to just URL page visits - - OpenSearch query: +1. analysis **Filter the results to just URL page visits** + - **Type**: OpenSearch query + - **Value**: ``` data_type:("chrome:history:page_visited" OR "firefox:places:page_visited" OR "safari:history:visit_sqlite") ``` - Python Notebook - - 1. Filter the results to just URL page visits - - Python code: +1. analysis **Filter the results to just URL page visits** + - **Type**: Pandas (`pandas`) + - **Value**: - ``` + ```python df.query('data_type in ("chrome:history:page_visited", "firefox:places:page_visited", "safari:history:visit_sqlite")') ``` -=== "Hindsight" - More information on [Hindsight](https://forensics.wiki/hindsight). - Recommended options: +## Collect URL visit records from local browser artifacts (Hindsight) +### 🗂️ Explanation +Parse URL visit records from web browsers' own databases. +Most web browsers track URL visits (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. + +#### References + - [Chrome](https://forensics.wiki/google_chrome/#history), [Firefox](https://forensics.wiki/mozilla_firefox/#history), and [Safari](https://forensics.wiki/apple_safari/#history) History on ForensicsWiki + - [Web Browsers on ForensicArtifacts](https://github.com/ForensicArtifacts/artifacts/blob/main/data/webbrowser.yaml) + +### 📝 Notes + +Each approach comes with certain caveats or limitations. These can often +be tacit knowledge or assumed that "everyone knows that" (even though they +don't). This can lead to incorrect assumptions and analysis. +Explicitly stating what is covered and not covered by the approach reduces +ambiguity. + +!!! success "Covered" - ``` - --format jsonl - ``` + - Chrome URL visits. Beyond "stable" Chrome, this also includes Chromium, Chrome Canary, Chrome Beta, and other Chromium-based browsers (Microsoft Edge, Brave, and Opera) on Windows, macOS, and Linux + - Includes URL visits from all Chrome profiles + - Firefox URL visits + - Safari URL visits on Windows and macOS + - Internet Explorer (4 - 10) URL visits - #### 📊 Analysis +!!! failure "Not Covered" - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Hindsight's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. + - Other Chromium-based browsers not specified above + - Browsers installed in non-standard paths + - Visits made in Incognito/Private sessions +### ⚙️ Steps - OpenSearch +1. collection **Collect ForensicArtifact data** + - **Description**: Collect local browser history artifacts. These are often in the form of SQLite databases and JSON files in multiple directories. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: BrowserHistory ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=BrowserHistory)) - 1. Filter the results to just URL page visits. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari. +1. processing **Process data with Hindsight** + - **Type**: command + - **Value**: Hindsight - - OpenSearch query: +1. analysis **Filter the results to just URL page visits. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari.** + - **Type**: OpenSearch query + - **Value**: ``` data_type:"chrome:history:page_visited" ``` - Python Notebook - - 1. Filter the results to just URL page visits. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari. +1. analysis **Filter the results to just URL page visits. Hindsight only supports Chromium-based browsers (including Microsoft Edge) and not Firefox or Safari.** + - **Type**: Pandas (`pandas`) + - **Value**: - - Python code: - - ``` + ```python df.query('data_type == "chrome:history:page_visited"') ``` + diff --git a/site/docs/questions/Q1024.md b/site/docs/questions/Q1024.md index 451e927..8d63491 100644 --- a/site/docs/questions/Q1024.md +++ b/site/docs/questions/Q1024.md @@ -2,6 +2,7 @@ tags: - CrowdStrike - Process Execution + - Splunk - Web Browser hide: @@ -17,9 +18,9 @@ hide: **Approaches to Answer** -- [Search CrowdStrike logs for Incognito Chrome processes [Q1024.10]](#search-crowdstrike-logs-for-incognito-chrome-processes) +- [Search CrowdStrike logs for Incognito Chrome processes](#search-crowdstrike-logs-for-incognito-chrome-processes) - CrowdStrike records the source process ID (ContextProcessId) for ProcessRollup events. - - Tags: CrowdStrike Process Execution Web Browser + - Tags: CrowdStrike Process Execution Web Browser Splunk # Approaches @@ -32,11 +33,7 @@ hide: ## Search CrowdStrike logs for Incognito Chrome processes ### 🗂️ Explanation CrowdStrike records the source process ID (ContextProcessId) for ProcessRollup events. - -Crowdstrike is a detection platform, not a logging platform, so not all executions are logged. -We cannot always connect a running browser process with observed DNS requests. When we do see -DNS requests coming from a browser process, yet we don't see browsing history, there are -several possible explanations, including browser extensions or private browsing. +Crowdstrike is a detection platform, not a logging platform, so not all executions are logged. We cannot always connect a running browser process with observed DNS requests. When we do see DNS requests coming from a browser process, yet we don't see browsing history, there are several possible explanations, including browser extensions or private browsing. #### References - https://www.crowdstrike.com/blog/tech-center/hunt-threat-activity-falcon-endpoint-protection/ @@ -58,42 +55,21 @@ ambiguity. - Chrome instances with a renamed process - Other Chromium-based browsers +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - - - - CrowdStrike: ProcessRollup - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Splunk" - More information on [Splunk](https://forensics.wiki/splunk). - - - #### 📊 Analysis +1. collection **Collect ProcessRollup from CrowdStrike** + - **Type**: CrowdStrike + - **Value**: ProcessRollup - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Splunk's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +1. processing **Process data with Splunk** + - **Type**: command + - **Value**: Splunk +1. analysis **Query searching for browser processes executed in private mode** + - **Type**: Splunk query + - **Value**: - Splunk-Query + ``` + ComputerName="{hostname}" event_simpleName=ProcessRollup* CommandLine IN ("*chrome*") CommandLine IN (*disable-databases*) | table _time, DomainName, CommandLine + ``` - 1. Query searching for browser processes executed in private mode - - Type: splunk-query - - Value: ComputerName="{hostname}" event_simpleName=ProcessRollup* CommandLine IN ("*chrome*") CommandLine IN (*disable-databases*) | table _time, DomainName, CommandLine diff --git a/site/docs/questions/Q1036.md b/site/docs/questions/Q1036.md index 3aad63f..b8a90d2 100644 --- a/site/docs/questions/Q1036.md +++ b/site/docs/questions/Q1036.md @@ -1,6 +1,7 @@ --- tags: - Event Logs + - Plaso - Prefetch - Windows @@ -18,12 +19,12 @@ hide: **Approaches to Answer** -- [Examine Windows Prefetch for evidence of PsExec usage [Q1036.10]](#examine-windows-prefetch-for-evidence-of-psexec-usage) - - Parse Windows Prefetch files and look for PsExec. - - Tags: Windows Prefetch -- [Examine Windows Event Logs for PsExec executions [Q1036.11]](#examine-windows-event-logs-for-psexec-executions) +- [Examine Windows Event Logs for PsExec executions](#examine-windows-event-logs-for-psexec-executions) - Parse the Windows Security Event Log and look for PsExec processes being created. - - Tags: Windows Event Logs + - Tags: Windows Event Logs Plaso +- [Examine Windows Prefetch for evidence of PsExec usage](#examine-windows-prefetch-for-evidence-of-psexec-usage) + - Parse Windows Prefetch files and look for PsExec. + - Tags: Windows Prefetch Plaso # Approaches @@ -33,16 +34,13 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -## Examine Windows Prefetch for evidence of PsExec usage +## Examine Windows Event Logs for PsExec executions ### 🗂️ Explanation -Parse Windows Prefetch files and look for PsExec. - -Windows Prefetch files are designed to speed up application start times. To do this, they -store information about recently launched applications, including the file name of the -executable and the number of times it has been run. +Parse the Windows Security Event Log and look for PsExec processes being created. +Windows systems can be set to log new process creation events to the Security event log. The logs contain the new process name, process ID, parent process name, process creation time, and many more useful fields. #### References - - [Prefetch on the ForensicsWiki](https://forensics.wiki/prefetch/) + - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) - [PsExec on MITRE ATT&CK](https://attack.mitre.org/software/S0029/) - [Detecting PsExec Usage by 13Cubed](https://www.youtube.com/watch?v=oVM1nQhDZQc) @@ -56,79 +54,39 @@ ambiguity. !!! success "Covered" - - Executions of PsExec on Windows systems with Prefetch enabled. + - Executions of PsExec on Windows systems with logging enabled. !!! failure "Not Covered" - - Systems where the Prefetch service has been disabled. - - There is a maximum number of `.pf` allowed by Windows (the number varies by Windows version). If too many other Prefetch files were created, the PsExec Prefetch file may have been deleted, and thus will not be parsed. + - Many factors can impact log retention; if the event log containing the relevant event has been deleted, it won't be found by this approach. - Instances when the PsExec executable has been renamed. - - Non-Windows systems, as the Prefetch service is Windows-only. - -### 💾 Data +### ⚙️ Steps -The following data source(s) are needed for this approach to the question. +1. collection **Collect ForensicArtifact data** + - **Description**: Windows Event Log files + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) -**Description** -: Files used by the Windows Prefetch service. +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsPrefetchFiles ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsPrefetchFiles)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers prefetch - ``` - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - - - OpenSearch - - 1. Filter the results to just Prefetch files for psexec.exe - - OpenSearch query: +1. analysis **Filter the results to Process Creation events containing "psexec.exe"** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:"windows:prefetch:execution" AND executable:psexec\.exe + data_type:"windows:evtx:record" event_identifier:4688 source_name:Microsoft-Windows-Security-Auditing xml_string:"psexec.exe" ``` -## Examine Windows Event Logs for PsExec executions -### 🗂️ Explanation -Parse the Windows Security Event Log and look for PsExec processes being created. -Windows systems can be set to log new process creation events to the Security event log. The -logs contain the new process name, process ID, parent process name, process creation time, and -many more useful fields. +## Examine Windows Prefetch for evidence of PsExec usage +### 🗂️ Explanation +Parse Windows Prefetch files and look for PsExec. +Windows Prefetch files are designed to speed up application start times. To do this, they store information about recently launched applications, including the file name of the executable and the number of times it has been run. #### References - - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) + - [Prefetch on the ForensicsWiki](https://forensics.wiki/prefetch/) - [PsExec on MITRE ATT&CK](https://attack.mitre.org/software/S0029/) - [Detecting PsExec Usage by 13Cubed](https://www.youtube.com/watch?v=oVM1nQhDZQc) @@ -142,64 +100,31 @@ ambiguity. !!! success "Covered" - - Executions of PsExec on Windows systems with logging enabled. + - Executions of PsExec on Windows systems with Prefetch enabled. !!! failure "Not Covered" - - Many factors can impact log retention; if the event log containing the relevant event has been deleted, it won't be found by this approach. + - Systems where the Prefetch service has been disabled. + - There is a maximum number of `.pf` allowed by Windows (the number varies by Windows version). If too many other Prefetch files were created, the PsExec Prefetch file may have been deleted, and thus will not be parsed. - Instances when the PsExec executable has been renamed. + - Non-Windows systems, as the Prefetch service is Windows-only. +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Windows Event Log files - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers winevtx - ``` - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - +1. collection **Collect ForensicArtifact data** + - **Description**: Files used by the Windows Prefetch service. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsPrefetchFiles ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsPrefetchFiles)) - OpenSearch +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - 1. Filter the results to Process Creation events containing "psexec.exe" - - OpenSearch query: +1. analysis **Filter the results to just Prefetch files for psexec.exe** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:"windows:evtx:record" event_identifier:4688 source_name:Microsoft-Windows-Security-Auditing xml_string:"psexec.exe" + data_type:"windows:prefetch:execution" AND executable:psexec\.exe ``` + diff --git a/site/docs/questions/Q1037.md b/site/docs/questions/Q1037.md index 8efdcde..934080d 100644 --- a/site/docs/questions/Q1037.md +++ b/site/docs/questions/Q1037.md @@ -1,6 +1,7 @@ --- tags: - Event Logs + - Plaso - Prefetch - Windows @@ -18,15 +19,15 @@ hide: **Approaches to Answer** -- [Examine Windows Prefetch for evidence of PsExeSvc [Q1037.10]](#examine-windows-prefetch-for-evidence-of-psexesvc) +- [Examine Windows Event Logs for PsExeSvc Service Installations](#examine-windows-event-logs-for-psexesvc-service-installations) + - Parse the Windows Security Event Log and look for the PsExeSvc service being installed. + - Tags: Windows Event Logs Plaso +- [Examine Windows Prefetch for evidence of PsExeSvc](#examine-windows-prefetch-for-evidence-of-psexesvc) - Parse Windows Prefetch files and look for PsExeSvc. - - Tags: Windows Prefetch -- [Examine Windows Event Logs for PsExeSvc executions [Q1037.11]](#examine-windows-event-logs-for-psexesvc-executions) + - Tags: Windows Prefetch Plaso +- [Examine Windows Event Logs for PsExeSvc executions](#examine-windows-event-logs-for-psexesvc-executions) - Parse the Windows Security Event Log and look for PsExeSvc processes being created. - - Tags: Windows Event Logs -- [Examine Windows Event Logs for PsExeSvc Service Installations [Q1037.12]](#examine-windows-event-logs-for-psexesvc-service-installations) - - Parse the Windows Security Event Log and look for the PsExeSvc service being installed. - - Tags: Windows Event Logs + - Tags: Windows Event Logs Plaso # Approaches @@ -36,16 +37,13 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -## Examine Windows Prefetch for evidence of PsExeSvc +## Examine Windows Event Logs for PsExeSvc Service Installations ### 🗂️ Explanation -Parse Windows Prefetch files and look for PsExeSvc. - -Windows Prefetch files are designed to speed up application start times. To do this, they -store information about recently launched applications, including the file name of the -executable and the number of times it has been run. +Parse the Windows Security Event Log and look for the PsExeSvc service being installed. +Windows systems can be set to log new service installations to the System event log. The logs contain the new service name, service file name, and more. When used to access a remote system, PsExec installs a service (by default named `PSEXESVC`) on the target system. #### References - - [Prefetch on the ForensicsWiki](https://forensics.wiki/prefetch/) + - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) - [PsExec on MITRE ATT&CK](https://attack.mitre.org/software/S0029/) - [Detecting PsExec Usage by 13Cubed](https://www.youtube.com/watch?v=oVM1nQhDZQc) @@ -59,79 +57,39 @@ ambiguity. !!! success "Covered" - - Executions of PsExeSvc on Windows systems with Prefetch enabled. + - Installations of the PsExeSvc Service on Windows systems with logging enabled. !!! failure "Not Covered" - - Systems where the Prefetch service has been disabled. - - There is a maximum number of `.pf` allowed by Windows (the number varies by Windows version). If too many other Prefetch files were created, the PsExec Prefetch file may have been deleted, and thus will not be parsed. - - Instances when the PsExeSvc executable has been renamed. - - Non-Windows systems, as the Prefetch service is Windows-only. - - -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Files used by the Windows Prefetch service. - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsPrefetchFiles ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsPrefetchFiles)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers prefetch - ``` - - #### 📊 Analysis + - Many factors can impact log retention; if the event log containing the relevant event has been deleted, it won't be found by this approach. + - Instances when the PsExeSvc service has been renamed. - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +### ⚙️ Steps +1. collection **Collect ForensicArtifact data** + - **Description**: Windows Event Log files + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) - OpenSearch +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - 1. Filter the results to just Prefetch files for psexesvc.exe - - OpenSearch query: +1. analysis **Filter the results to Service Install events for `PSEXESVC`** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:"windows:prefetch:execution" AND executable:psexesvc\.exe + data_type:"windows:evtx:record" event_identifier:7045 source_name:"Service Control Manager" xml_string:"Name=\"ServiceName\">PSEXESVC" ``` -## Examine Windows Event Logs for PsExeSvc executions -### 🗂️ Explanation -Parse the Windows Security Event Log and look for PsExeSvc processes being created. -Windows systems can be set to log new process creation events to the Security event log. The -logs contain the new process name, process ID, parent process name, process creation time, and -many more useful fields. +## Examine Windows Prefetch for evidence of PsExeSvc +### 🗂️ Explanation +Parse Windows Prefetch files and look for PsExeSvc. +Windows Prefetch files are designed to speed up application start times. To do this, they store information about recently launched applications, including the file name of the executable and the number of times it has been run. #### References - - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) + - [Prefetch on the ForensicsWiki](https://forensics.wiki/prefetch/) - [PsExec on MITRE ATT&CK](https://attack.mitre.org/software/S0029/) - [Detecting PsExec Usage by 13Cubed](https://www.youtube.com/watch?v=oVM1nQhDZQc) @@ -145,74 +103,38 @@ ambiguity. !!! success "Covered" - - Executions of PsExeSvc on Windows systems with logging enabled. + - Executions of PsExeSvc on Windows systems with Prefetch enabled. !!! failure "Not Covered" - - Many factors can impact log retention; if the event log containing the relevant event has been deleted, it won't be found by this approach. + - Systems where the Prefetch service has been disabled. + - There is a maximum number of `.pf` allowed by Windows (the number varies by Windows version). If too many other Prefetch files were created, the PsExec Prefetch file may have been deleted, and thus will not be parsed. - Instances when the PsExeSvc executable has been renamed. + - Non-Windows systems, as the Prefetch service is Windows-only. +### ⚙️ Steps -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Windows Event Log files - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers winevtx - ``` - - #### 📊 Analysis - - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. - +1. collection **Collect ForensicArtifact data** + - **Description**: Files used by the Windows Prefetch service. + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsPrefetchFiles ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsPrefetchFiles)) - OpenSearch +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - 1. Filter the results to Process Creation events containing "psexesvc.exe" - - OpenSearch query: +1. analysis **Filter the results to just Prefetch files for psexesvc.exe** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:"windows:evtx:record" event_identifier:4688 source_name:Microsoft-Windows-Security-Auditing xml_string:"psexesvc.exe" + data_type:"windows:prefetch:execution" AND executable:psexesvc\.exe ``` -## Examine Windows Event Logs for PsExeSvc Service Installations -### 🗂️ Explanation -Parse the Windows Security Event Log and look for the PsExeSvc service being installed. -Windows systems can be set to log new service installations to the System event log. The -logs contain the new service name, service file name, and more. When used to access a remote -system, PsExec installs a service (by default named `PSEXESVC`) on the target system. +## Examine Windows Event Logs for PsExeSvc executions +### 🗂️ Explanation +Parse the Windows Security Event Log and look for PsExeSvc processes being created. +Windows systems can be set to log new process creation events to the Security event log. The logs contain the new process name, process ID, parent process name, process creation time, and many more useful fields. #### References - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) @@ -229,64 +151,29 @@ ambiguity. !!! success "Covered" - - Installations of the PsExeSvc Service on Windows systems with logging enabled. + - Executions of PsExeSvc on Windows systems with logging enabled. !!! failure "Not Covered" - Many factors can impact log retention; if the event log containing the relevant event has been deleted, it won't be found by this approach. - - Instances when the PsExeSvc service has been renamed. - - -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Windows Event Log files - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers winevtx - ``` - - #### 📊 Analysis + - Instances when the PsExeSvc executable has been renamed. - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +### ⚙️ Steps +1. collection **Collect ForensicArtifact data** + - **Description**: Windows Event Log files + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) - OpenSearch +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - 1. Filter the results to Service Install events for `PSEXESVC` - - OpenSearch query: +1. analysis **Filter the results to Process Creation events containing "psexesvc.exe"** + - **Type**: OpenSearch query + - **Value**: ``` - data_type:"windows:evtx:record" event_identifier:7045 source_name:"Service Control Manager" xml_string:"Name=\"ServiceName\">PSEXESVC" + data_type:"windows:evtx:record" event_identifier:4688 source_name:Microsoft-Windows-Security-Auditing xml_string:"psexesvc.exe" ``` + diff --git a/site/docs/questions/Q1074.md b/site/docs/questions/Q1074.md index eaf38b1..1fbc3ce 100644 --- a/site/docs/questions/Q1074.md +++ b/site/docs/questions/Q1074.md @@ -4,6 +4,8 @@ tags: - Event Logs - Linux - macOS + - Plaso + - Splunk - T1070.001 - T1070.002 - Windows @@ -21,12 +23,12 @@ hide: **Approaches to Answer** -- [Search CrowdStrike logs for indicator removal on host [Q1074.10]](#search-crowdstrike-logs-for-indicator-removal-on-host) - - CrowdStrike has built-in detections for "indicator removal on host" events. - - Tags: CrowdStrike Linux Windows macOS -- [Examine Windows Event Logs for Audit Log cleared [Q1074.11]](#examine-windows-event-logs-for-audit-log-cleared) +- [Examine Windows Event Logs for Audit Log cleared](#examine-windows-event-logs-for-audit-log-cleared) - Parse the Windows Security Event Log and look for "the audit log was cleared" event. - - Tags: Windows Event Logs + - Tags: Windows Event Logs Plaso +- [Search CrowdStrike logs for indicator removal on host](#search-crowdstrike-logs-for-indicator-removal-on-host) + - CrowdStrike has built-in detections for "indicator removal on host" events. + - Tags: CrowdStrike Linux Windows macOS Splunk # Approaches @@ -36,16 +38,14 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -## Search CrowdStrike logs for indicator removal on host +## Examine Windows Event Logs for Audit Log cleared ### 🗂️ Explanation -CrowdStrike has built-in detections for "indicator removal on host" events. - -Clearance/deletion of system logs would be recorded in CrowdStrike as a part of their -"indicator removal on host" detections. +Parse the Windows Security Event Log and look for "the audit log was cleared" event. +On Windows systems, log clearance events for Security event log will be logged with event ID 1102. The logs contain the actor account name, domain name, logon id fields. #### References - - https://www.crowdstrike.com/blog/tech-center/hunt-threat-activity-falcon-endpoint-protection/ - - [Indicator Removal on MITRE ATT&CK](https://attack.mitre.org/techniques/T1070/) + - [1102(S): The audit log was cleared.](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-1102) + - [Indicator Removal: Clear Windows Event Logs on MITRE ATT&CK](https://attack.mitre.org/techniques/T1070/001/) ### 📝 Notes @@ -57,62 +57,40 @@ ambiguity. !!! success "Covered" - - CrowdStrike's built-in detection for "indicator removal on host" events. + - Security event log clearance events on Windows systems. !!! failure "Not Covered" - - CrowdStrike may not have all log clear/delete events as part of this detection. - - -### 💾 Data - -The following data source(s) are needed for this approach to the question. - - - - CrowdStrike: PlatformEvents - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Splunk" - More information on [Splunk](https://forensics.wiki/splunk). - + - If the log is deleted or otherwise altered, this event may not be logged. + - Only applies to Windows Security audit logs. - #### 📊 Analysis +### ⚙️ Steps - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Splunk's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +1. collection **Collect ForensicArtifact data** + - **Description**: Windows Event Log files + - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) + - **Value**: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) +1. processing **Process data with Plaso** + - **Type**: command + - **Value**: Plaso - Splunk-Query +1. analysis **Filter the results to events containing audit log clearance.** + - **Type**: OpenSearch query + - **Value**: - 1. Query searching for indicator removal on host events. - - Type: splunk-query - - Value: ComputerName="{hostname}" Technique="Indicator Removal on Host" + ``` + data_type:"windows:evtx:record" event_identifier:1102 source_name:"Microsoft-Windows-Security-Auditing" + ``` -## Examine Windows Event Logs for Audit Log cleared +## Search CrowdStrike logs for indicator removal on host ### 🗂️ Explanation -Parse the Windows Security Event Log and look for "the audit log was cleared" event. - -On Windows systems, log clearance events for Security event log will be logged with event ID -1102. The logs contain the actor account name, domain name, logon id fields. +CrowdStrike has built-in detections for "indicator removal on host" events. +Clearance/deletion of system logs would be recorded in CrowdStrike as a part of their "indicator removal on host" detections. #### References - - [1102(S): The audit log was cleared.](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-1102) - - [Indicator Removal: Clear Windows Event Logs on MITRE ATT&CK](https://attack.mitre.org/techniques/T1070/001/) + - https://www.crowdstrike.com/blog/tech-center/hunt-threat-activity-falcon-endpoint-protection/ + - [Indicator Removal on MITRE ATT&CK](https://attack.mitre.org/techniques/T1070/) ### 📝 Notes @@ -124,64 +102,27 @@ ambiguity. !!! success "Covered" - - Security event log clearance events on Windows systems. + - CrowdStrike's built-in detection for "indicator removal on host" events. !!! failure "Not Covered" - - If the log is deleted or otherwise altered, this event may not be logged. - - Only applies to Windows Security audit logs. - - -### 💾 Data - -The following data source(s) are needed for this approach to the question. - -**Description** -: Windows Event Log files - - -**Type** -: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - -**Value** -: WindowsEventLogs ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q=WindowsEventLogs)) - -### ⚙️ Processors - -A processor is what takes the [data](#💾-data) collected and processes it in -some way to produce structured data for an investigator to review. Multiple -processor options can be defined, as there are often multiple programs capable -of doing similar processing. Plaso is an example of a processor (it processes -raw artifacts into a timeline). After the data is processed, additional analysis -steps may be needed to answer the question. - -The following processors can process the raw data specified above. Explicit -instructions on how to run the processor are *not* included here, but any -relevant configuration options are. - - -=== "Plaso" - More information on [Plaso](https://forensics.wiki/plaso). - - Recommended options: - - ``` - --parsers winevtx - ``` - - #### 📊 Analysis + - CrowdStrike may not have all log clear/delete events as part of this detection. - After processing the raw data, further analysis steps are necessary to answer - the question. After loading Plaso's output into one of these - analysis platforms, use the following steps to refine the data to answer the - question. +### ⚙️ Steps +1. collection **Collect PlatformEvents from CrowdStrike** + - **Type**: CrowdStrike + - **Value**: PlatformEvents - OpenSearch +1. processing **Process data with Splunk** + - **Type**: command + - **Value**: Splunk - 1. Filter the results to events containing audit log clearance. - - OpenSearch query: +1. analysis **Query searching for indicator removal on host events.** + - **Type**: Splunk query + - **Value**: ``` - data_type:"windows:evtx:record" event_identifier:1102 source_name:"Microsoft-Windows-Security-Auditing" + ComputerName="{hostname}" Technique="Indicator Removal on Host" ``` + diff --git a/site/docs/questions/index.md b/site/docs/questions/index.md index f637dd4..4d7ca4b 100644 --- a/site/docs/questions/index.md +++ b/site/docs/questions/index.md @@ -12,7 +12,7 @@ is an index of all the Questions that are defined as part of DFIQ. Some quick facts about Questions in DFIQ: - Questions should be small enough in scope that they can be readily answered -- A single Question can be reused in multiple different Facets +- A single Question can be reused in multiple different Scenarios or Facets - If a Question has any Approaches defined, it will render as a link to the detailed Question page !!! Note @@ -24,7 +24,7 @@ Some quick facts about Questions in DFIQ: | ID | Question | Tags | Approaches | | ----------- | ------------------------------------ | ---- | ---------- | -| Q1001 | What files were downloaded using a web browser? | Safari Windows Edge macOS NTFS SQLite USN Journal Chrome Web Browser | 3 | +| Q1001 | What files were downloaded using a web browser? | USN Journal Plaso Hindsight Web Browser macOS NTFS SQLite Chrome Safari Windows Edge | 4 | | Q1002 | What USB devices were attached to a computer? | | 0 | | Q1003 | What files were copied from a computer to a USB device? | | 0 | | Q1004 | What screenshots were taken on a computer? | | 0 | @@ -41,13 +41,13 @@ Some quick facts about Questions in DFIQ: | Q1015 | What syncing activities did external "cloud storage" applications do on a computer? | | 0 | | Q1016 | What files were sent externally via email attachments? | | 0 | | Q1017 | Were any files collected into a container? | | 0 | -| Q1018 | What process made the DNS query? | DNS CrowdStrike Windows Sysmon | 3 | -| Q1019 | What web browsers were running at a given time? | Process Execution CrowdStrike Web Browser | 1 | -| Q1020 | What pages did web browsers visit? | Safari Edge SQLite Internet Explorer Chrome Web Browser Firefox | 1 | +| Q1018 | What process made the DNS query? | Plaso CrowdStrike Sysmon Windows Crowdstrike Investigate (UI) DNS Splunk | 4 | +| Q1019 | What web browsers were running at a given time? | Process Execution CrowdStrike Web Browser Splunk | 1 | +| Q1020 | What pages did web browsers visit? | Internet Explorer Plaso Hindsight Web Browser SQLite Chrome Safari Firefox Edge | 2 | | Q1021 | What Chrome extensions are installed? | Web Browser | 0 | -| Q1022 | What actions did a Chrome extension perform? | Chrome Browser Extension Web Browser | 0 | -| Q1023 | Is a given Chrome extension associated with a given domain? | Chrome T1176 | 0 | -| Q1024 | Was an Incognito/Private browser session used? | Process Execution CrowdStrike Web Browser | 1 | +| Q1022 | What actions did a Chrome extension perform? | Web Browser Browser Extension Chrome | 0 | +| Q1023 | Is a given Chrome extension associated with a given domain? | T1176 Chrome | 0 | +| Q1024 | Was an Incognito/Private browser session used? | Process Execution CrowdStrike Web Browser Splunk | 1 | | Q1025 | What external accounts has the actor used in their web browser? | | 0 | | Q1026 | What files were downloaded from messaging apps? | | 0 | | Q1027 | Are there any sudden changes in the number of files on a device? | | 0 | @@ -59,8 +59,8 @@ Some quick facts about Questions in DFIQ: | Q1033 | Was shell history cleared? | | 0 | | Q1034 | Was content copied from a file? | | 0 | | Q1035 | Were any copies made of sensitive files? | | 0 | -| Q1036 | Have there been any executions of PsExec? | Event Logs Prefetch Windows | 2 | -| Q1037 | Have there been any executions of PsExeSrv? | Event Logs Prefetch Windows | 3 | +| Q1036 | Have there been any executions of PsExec? | Windows Event Logs Plaso Prefetch | 2 | +| Q1037 | Have there been any executions of PsExeSrv? | Windows Event Logs Plaso Prefetch | 3 | | Q1038 | Were any files sent via CLI utilities? | | 0 | | Q1039 | Are there any detections of exposed service account credentials? | | 0 | | Q1040 | Are there any interaction with the cloud project resources from an unknown external IP address (including Tor Exit nodes, C2 tagged addresses)? | | 0 | @@ -77,27 +77,27 @@ Some quick facts about Questions in DFIQ: | Q1051 | Are there any signs of data within the cloud project being transferred externally? | | 0 | | Q1052 | What browser extensions (non-Chrome) are installed? | Web Browser | 0 | | Q1053 | What Launch Agents are configured? | macOS T1543.001 | 0 | -| Q1054 | What Launch Daemons are configured? | macOS T1543.004 | 0 | +| Q1054 | What Launch Daemons are configured? | T1543.004 macOS | 0 | | Q1055 | What Windows logon scripts are configured? | T1037.001 Windows | 0 | -| Q1056 | What login hooks are configured? | T1037.002 macOS | 0 | -| Q1057 | What network logon scripts are configured? | T1037.003 Windows | 0 | -| Q1058 | What domain accounts have been created? | T1136.002 Windows | 0 | -| Q1059 | What local accounts have been created? | T1136.001 macOS Windows Linux | 0 | -| Q1060 | What AT jobs are configured? | T1053.002 macOS Linux | 0 | -| Q1061 | What Scheduled Tasks are configured? | T1053.005 Windows | 0 | -| Q1062 | What cron jobs are configured? | T1053.003 macOS Linux | 0 | +| Q1056 | What login hooks are configured? | macOS T1037.002 | 0 | +| Q1057 | What network logon scripts are configured? | Windows T1037.003 | 0 | +| Q1058 | What domain accounts have been created? | Windows T1136.002 | 0 | +| Q1059 | What local accounts have been created? | Linux T1136.001 Windows macOS | 0 | +| Q1060 | What AT jobs are configured? | Linux macOS T1053.002 | 0 | +| Q1061 | What Scheduled Tasks are configured? | Windows T1053.005 | 0 | +| Q1062 | What cron jobs are configured? | Linux macOS T1053.003 | 0 | | Q1063 | What periodic scripts are configured? | macOS | 0 | -| Q1064 | What systemd timers are configured? | T1053.006 Linux | 0 | +| Q1064 | What systemd timers are configured? | Linux T1053.006 | 0 | | Q1065 | What files are referenced in Registry "Run" keys? | T1547.001 Windows | 0 | | Q1066 | What items are in startup folders? | T1547.001 Windows | 0 | -| Q1067 | What system services are installed? | macOS Windows Linux | 0 | -| Q1068 | When were system services last modified? | macOS Windows Linux | 0 | +| Q1067 | What system services are installed? | Linux macOS Windows | 0 | +| Q1068 | When were system services last modified? | Linux macOS Windows | 0 | | Q1069 | Are there any indications of dylib hijacking? | macOS T1574.004 | 0 | | Q1070 | Are there any indications of dylib proxying? | macOS | 0 | -| Q1071 | Are there any indications of dynamic linker hijacking? | T1574.006 macOS Linux | 0 | -| Q1072 | Did Chrome's DNS Prefetching cause a DNS query? | DNS Web Browser | 0 | +| Q1071 | Are there any indications of dynamic linker hijacking? | Linux T1574.006 macOS | 0 | +| Q1072 | Did Chrome's DNS Prefetching cause a DNS query? | Web Browser DNS | 0 | | Q1073 | Have there been any modifications to the "hosts" file? | | 0 | -| Q1074 | Were any system event logs cleared? | Event Logs CrowdStrike Windows Linux macOS T1070.002 T1070.001 | 2 | +| Q1074 | Were any system event logs cleared? | Plaso Event Logs T1070.001 Splunk Linux T1070.002 macOS CrowdStrike Windows | 2 | | Q1075 | Is the recipient account controlled by the sender? | | 0 | | Q1076 | Were the files screenshots? | | 0 | | Q1077 | Were there bulk downloads from Google Drive? | | 0 | diff --git a/site/docs/scenarios/index.md b/site/docs/scenarios/index.md index 0b9b46f..78f4e94 100644 --- a/site/docs/scenarios/index.md +++ b/site/docs/scenarios/index.md @@ -7,5 +7,5 @@ hide: A Scenario is a starting place for a particular type of investigation. While each case is unique, many have common aspects and can be roughly grouped together. -A Scenario is the highest-level grouping in DFIQ. A Scenario is made of one or more Facets -(different "sides" of an investigation), which in turn are made up of investigative [Questions](/questions). +A Scenario is the highest-level grouping in DFIQ. A Scenario is made up of investigative [Questions](/questions), +which can optionally be grouped into intermediate Facets (different "sides" of an investigation). diff --git a/site/mkdocs.yml b/site/mkdocs.yml index 6cc3555..0996beb 100644 --- a/site/mkdocs.yml +++ b/site/mkdocs.yml @@ -40,3 +40,29 @@ extra_javascript: - javascripts/tablesort.js extra_css: - stylesheets/extra.css +nav: + - Home: index.md + - Tags: tags.md + - Contributing: + - Approach Glossary: contributing/approach_glossary.md + - DFIQ Specifications: + - latest (1.1.0): contributing/specification.md + - 1.0.1: contributing/specification_1_0_1.md + - Questions: + - questions/index.md + - questions/Q1001.md + - questions/Q1018.md + - questions/Q1019.md + - questions/Q1020.md + - questions/Q1024.md + - questions/Q1036.md + - questions/Q1037.md + - questions/Q1074.md + - Scenarios: + - scenarios/index.md + - scenarios/S1001.md + - scenarios/S1002.md + - scenarios/S1003.md + - scenarios/S1005.md + - scenarios/S1007.md + - scenarios/S1008.md From 759ff713c968d43ae251a9cfb007118a98c987bf Mon Sep 17 00:00:00 2001 From: tomchop Date: Sun, 15 Nov 2026 17:32:01 +0100 Subject: [PATCH 2/3] Fix CI checks: pin workflow actions, sync poetry.lock, and format with black --- .github/workflows/yamale.yml | 17 +++++++++++------ dfiq/dfiq.py | 4 +--- dfiq/scripts/generate_site_markdown.py | 7 +++---- poetry.lock | 11 ++++++++--- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/yamale.yml b/.github/workflows/yamale.yml index 7f8696d..1df5552 100644 --- a/.github/workflows/yamale.yml +++ b/.github/workflows/yamale.yml @@ -1,21 +1,26 @@ name: Validate DFIQ YAML -on: - [push] +on: [push, pull_request] + +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + persist-credentials: false - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 with: - python-version: 3.11 + python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install poetry - poetry add yamale + poetry install - name: Validate DFIQ YAML run: | poetry run yamale -s dfiq/utils/scenario_spec.yaml ./dfiq/data/scenarios diff --git a/dfiq/dfiq.py b/dfiq/dfiq.py index e082b57..1ea607b 100644 --- a/dfiq/dfiq.py +++ b/dfiq/dfiq.py @@ -22,7 +22,6 @@ import yaml from pathlib import Path - logging.basicConfig( level=logging.DEBUG, format="%(filename)s | %(levelname)s | %(message)s" ) @@ -384,8 +383,7 @@ def convert_yaml_object_to_dfiq_component( elif yaml_object["type"] == "question": approaches = [ - Approach.from_dict(a) - for a in (yaml_object.get("approaches") or []) + Approach.from_dict(a) for a in (yaml_object.get("approaches") or []) ] return Question( yaml_object.get("id"), diff --git a/dfiq/scripts/generate_site_markdown.py b/dfiq/scripts/generate_site_markdown.py index 6e44231..a063f07 100644 --- a/dfiq/scripts/generate_site_markdown.py +++ b/dfiq/scripts/generate_site_markdown.py @@ -15,19 +15,18 @@ import os from dfiq import DFIQ - # This file should be called from the repository root: # PYTHONPATH=. python dfiq/scripts/generate_site_markdown.py file_path = os.path.abspath(__file__) -templates_dir = os.path.join(os.path.dirname(os.path.dirname(file_path)), 'templates') +templates_dir = os.path.join(os.path.dirname(os.path.dirname(file_path)), "templates") dfiq_instance = DFIQ(templates_path=templates_dir, markdown_output_path="site/docs") for scenario in dfiq_instance.scenarios(): - dfiq_instance.generate_scenario_md(scenario.id) + dfiq_instance.generate_scenario_md(scenario.id or scenario.uuid) for question in dfiq_instance.questions(): - dfiq_instance.generate_question_md(question.id) + dfiq_instance.generate_question_md(question.id or question.uuid) dfiq_instance.generate_question_index_md() dfiq_instance.generate_approach_glossary_md() diff --git a/poetry.lock b/poetry.lock index f38d820..364985b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.4.1 and should not be changed by hand. [[package]] name = "jinja2" @@ -6,6 +6,7 @@ version = "3.1.4" description = "A very fast and expressive template engine." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "jinja2-3.1.4-py3-none-any.whl", hash = "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d"}, {file = "jinja2-3.1.4.tar.gz", hash = "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369"}, @@ -23,6 +24,7 @@ version = "2.1.5" description = "Safely add untrusted strings to HTML/XML markup." optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc"}, {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5"}, @@ -92,6 +94,7 @@ version = "3.3" description = "Python package for creating and manipulating graphs and networks" optional = false python-versions = ">=3.10" +groups = ["main"] files = [ {file = "networkx-3.3-py3-none-any.whl", hash = "sha256:28575580c6ebdaf4505b22c6256a2b9de86b316dc63ba9e93abde3d78dfdbcf2"}, {file = "networkx-3.3.tar.gz", hash = "sha256:0c127d8b2f4865f59ae9cb8aafcd60b5c70f3241ebd66f7defad7c4ab90126c9"}, @@ -110,6 +113,7 @@ version = "6.0.2" description = "YAML parser and emitter for Python" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"}, {file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"}, @@ -172,6 +176,7 @@ version = "5.2.1" description = "A schema and validator for YAML." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "yamale-5.2.1-py3-none-any.whl", hash = "sha256:e44cd30cf3055ee4b34c1c71d6fe35490a127dcbd36f82f27859d105a9989922"}, {file = "yamale-5.2.1.tar.gz", hash = "sha256:19bbe713d588f07177bc519a46070c0793ed126ea37f425a76055b99703f835a"}, @@ -181,6 +186,6 @@ files = [ pyyaml = "*" [metadata] -lock-version = "2.0" +lock-version = "2.1" python-versions = "^3.10" -content-hash = "b60f93c18fda66474a22515c57db2c026207abe048924e9fa8bdbe644bbe3148" +content-hash = "8ca4b56e0ffdfc537e86a71ce1fe2db81bb8647228ef8b78c9ad2485723caadd" From 05ffdb1d0d4e61f767e4f174a781d614067d6386 Mon Sep 17 00:00:00 2001 From: tomchop Date: Sun, 15 Nov 2026 20:01:29 +0100 Subject: [PATCH 3/3] Address DFIQ 1.1.0 PR review feedback and add unit tests - Fix multi-paragraph Markdown folding (`>-` -> `|-`) across Question approaches and repair numbered lists in Q1001 - Add optional `internal` boolean to Approach schema/spec and exclude internal approaches and tags from public counts, pages, and indexes when `allow_internal=False` - Guard optional subdirectories (e.g. missing `facets/`) and non-YAML files in `load_yaml_files_by_type` - Indent multi-line query steps properly in `question_with_approaches.jinja2`, separate UUID/ID lines, and sort tags in `questions_index.jinja2` - Sync `Questions` and `Scenarios` navigation in `site/mkdocs.yml` during site generation - Update GitHub issue templates for DFIQ 1.1.0 (`name`, `1.1.0`, UUID/Scenario parent support) - Add unit test suite (`tests/test_dfiq.py`) and run it in CI --- .github/ISSUE_TEMPLATE/1_DFIQ_Question.yml | 12 +- .github/ISSUE_TEMPLATE/2_DFIQ_Facet.yml | 10 +- .github/ISSUE_TEMPLATE/3_DFIQ_Scenario.yml | 10 +- .github/workflows/yamale.yml | 2 + dfiq/__init__.py | 2 +- dfiq/data/questions/Q1001.yaml | 43 ++-- dfiq/data/questions/Q1018.yaml | 8 +- dfiq/data/questions/Q1019.yaml | 2 +- dfiq/data/questions/Q1020.yaml | 4 +- dfiq/data/questions/Q1024.yaml | 2 +- dfiq/data/questions/Q1036.yaml | 4 +- dfiq/data/questions/Q1037.yaml | 6 +- dfiq/data/questions/Q1074.yaml | 4 +- dfiq/dfiq.py | 57 ++--- dfiq/scripts/generate_site_markdown.py | 39 +++- .../templates/question_with_approaches.jinja2 | 101 +++++---- dfiq/templates/questions_index.jinja2 | 6 +- dfiq/templates/scenario.jinja2 | 7 +- dfiq/utils/question_spec.yaml | 1 + site/docs/contributing/specification.md | 3 +- site/docs/questions/Q1001.md | 66 ++++-- site/docs/questions/Q1018.md | 18 +- site/docs/questions/Q1019.md | 6 +- site/docs/questions/Q1020.md | 14 +- site/docs/questions/Q1024.md | 12 +- site/docs/questions/Q1036.md | 11 +- site/docs/questions/Q1037.md | 17 +- site/docs/questions/Q1074.md | 14 +- site/docs/questions/index.md | 34 +-- site/docs/scenarios/S1001.md | 1 + site/docs/scenarios/S1002.md | 1 + site/docs/scenarios/S1003.md | 1 + site/docs/scenarios/S1005.md | 1 + site/docs/scenarios/S1007.md | 1 + site/docs/scenarios/S1008.md | 1 + tests/test_dfiq.py | 206 ++++++++++++++++++ 36 files changed, 521 insertions(+), 206 deletions(-) create mode 100644 tests/test_dfiq.py diff --git a/.github/ISSUE_TEMPLATE/1_DFIQ_Question.yml b/.github/ISSUE_TEMPLATE/1_DFIQ_Question.yml index ae26111..fae3745 100644 --- a/.github/ISSUE_TEMPLATE/1_DFIQ_Question.yml +++ b/.github/ISSUE_TEMPLATE/1_DFIQ_Question.yml @@ -17,7 +17,7 @@ body: A Question should be specific enough that it can be readily answered and not easily divided into multiple parts (if it can be, it likely should be multiple Questions). A single Question can be reused in - multiple different Facets. + multiple different Facets or Scenarios. ## Fields from the DFIQ Specification @@ -26,9 +26,9 @@ body: The required fields are marked, but filling out as many as you can now will make creating the DFIQ YAML file easier later. - type: input - id: display_name + id: name attributes: - label: Display Name + label: Name description: "The Question, in natural language. Example: _What files were downloaded using a web browser?_" validations: required: true @@ -44,7 +44,7 @@ body: attributes: label: DFIQ Version description: The [DFIQ Specification](https://dfiq.org/spec) version in the major.minor.patch scheme (probably leave this as-is). - value: "1.0.0" + value: "1.1.0" validations: required: true - type: dropdown @@ -77,8 +77,8 @@ body: id: parent_ids attributes: label: Parent IDs - description: List of DFIQ Facet IDs that this Question belongs to. Optional. - placeholder: F1234, F5678 + description: List of DFIQ Facet or Scenario IDs (or UUIDs) that this Question belongs to. Optional. + placeholder: F1234, S5678 validations: required: false - type: markdown diff --git a/.github/ISSUE_TEMPLATE/2_DFIQ_Facet.yml b/.github/ISSUE_TEMPLATE/2_DFIQ_Facet.yml index ec258ea..8b0d197 100644 --- a/.github/ISSUE_TEMPLATE/2_DFIQ_Facet.yml +++ b/.github/ISSUE_TEMPLATE/2_DFIQ_Facet.yml @@ -9,7 +9,7 @@ body: # DFIQ: Facets - Facets are used for intermediate-level grouping in DFIQ. A particular Facet + Facets are used for optional intermediate-level grouping in DFIQ. A particular Facet can be part of multiple different Scenarios and will contain multiple Questions. A Facet breaks the larger Scenario into smaller logical pieces, but a Facet is still too broad to answer directly; it must also be broken down (into Questions). @@ -22,9 +22,9 @@ body: The required fields are marked, but filling out as many as you can now will make creating the DFIQ YAML file easier later. - type: input - id: display_name + id: name attributes: - label: Display Name + label: Name description: "The Facet, in natural language. Example: _Are there signs of staging data for future exfiltration?_" validations: required: true @@ -40,7 +40,7 @@ body: attributes: label: DFIQ Version description: The [DFIQ Specification](https://dfiq.org/spec) version in the major.minor.patch scheme (probably leave this as-is). - value: "1.0.0" + value: "1.1.0" validations: required: true - type: dropdown @@ -73,7 +73,7 @@ body: id: parent_ids attributes: label: Parent IDs - description: List of DFIQ Scenario IDs that this Facet belongs to. Optional. + description: List of DFIQ Scenario IDs (or UUIDs) that this Facet belongs to. Optional. placeholder: S1234, S5678 validations: required: false diff --git a/.github/ISSUE_TEMPLATE/3_DFIQ_Scenario.yml b/.github/ISSUE_TEMPLATE/3_DFIQ_Scenario.yml index 3250cd9..c1a65df 100644 --- a/.github/ISSUE_TEMPLATE/3_DFIQ_Scenario.yml +++ b/.github/ISSUE_TEMPLATE/3_DFIQ_Scenario.yml @@ -10,8 +10,8 @@ body: A Scenario is the highest-level grouping in DFIQ. A Scenario is made of - one or more Facets (different "sides" of an investigation), which in - turn are made up of investigative Questions. + one or more Facets (different "sides" of an investigation) or directly + linked investigative Questions. ## Fields from the DFIQ Specification @@ -21,9 +21,9 @@ body: The required fields are marked, but filling out as many as you can now will make creating the DFIQ YAML file easier later. - type: input - id: display_name + id: name attributes: - label: Display Name + label: Name description: "A human-readable name for the Scenario. Example: _Data Exfiltration_" validations: required: true @@ -42,7 +42,7 @@ body: attributes: label: DFIQ Version description: The [DFIQ Specification](https://dfiq.org/spec) version in the major.minor.patch scheme (probably leave this as-is). - value: "1.0.0" + value: "1.1.0" validations: required: true - type: dropdown diff --git a/.github/workflows/yamale.yml b/.github/workflows/yamale.yml index 1df5552..1c84dfb 100644 --- a/.github/workflows/yamale.yml +++ b/.github/workflows/yamale.yml @@ -26,3 +26,5 @@ jobs: poetry run yamale -s dfiq/utils/scenario_spec.yaml ./dfiq/data/scenarios poetry run yamale -s dfiq/utils/facet_spec.yaml ./dfiq/data/facets poetry run yamale -s dfiq/utils/question_spec.yaml ./dfiq/data/questions + - name: Run unit tests + run: poetry run python -m unittest discover -s tests -v diff --git a/dfiq/__init__.py b/dfiq/__init__.py index 50eb89c..e1c8de8 100644 --- a/dfiq/__init__.py +++ b/dfiq/__init__.py @@ -1,6 +1,6 @@ from .dfiq import DFIQ, Scenario, Facet, Question, Approach __all__ = ["DFIQ", "Scenario", "Facet", "Question", "Approach"] -__version__ = "1.0.1" +__version__ = "1.1.0" __author__ = "Ryan Benson" __email__ = "ryan@dfir.blog" diff --git a/dfiq/data/questions/Q1001.yaml b/dfiq/data/questions/Q1001.yaml index 40e5782..867665e 100644 --- a/dfiq/data/questions/Q1001.yaml +++ b/dfiq/data/questions/Q1001.yaml @@ -25,29 +25,25 @@ parent_ids: - F1002 approaches: - name: Detect browser downloads via change journal records - description: >- + description: |- File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using NTFS change journal (USN journal) records. Chrome downloads on Windows create a specific pattern of events on the file system: - 1. **Download starts with a `FILE CREATE` event to `.tmp` file; older Chrome - versions - have been observed creating four character file names (like `7DEE.tmp`) + 1. **Download starts with a `FILE CREATE` event to `.tmp` file**; older Chrome + versions have been observed creating four character file names (like `7DEE.tmp`) while newer versions use file names consistent with Version 4 UUIDs (like `183011a0-f96c-4c98-b71b-ab8754fb0e0e.tmp`). 1. That `.tmp` file might be `RENAME`d to `Unconfirmed [6 digits].crdownload`. - 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the `.tmp` file - is - renamed to the eventual filename (with extension) with `.crdownload` - appended - at the end (like `cat.jpg.crdownload`). **In either case ([2] or [3]), - at - this point we have a file ending in .crdownload.** + 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the `.tmp` file is + renamed to the eventual filename (with extension) with `.crdownload` appended + at the end (like `cat.jpg.crdownload`). **In either case ([2] or [3]), at + this point we have a file ending in `.crdownload`.** 1. Once the download completes, the `.crdownload` suffix is removed via a `USN_REASON_RENAME_OLD_NAME` event, leaving the downloaded file with its - final name. + final name. Since [4] above captures the key information about the file download, we can search change journal records for it. @@ -96,7 +92,7 @@ approaches: type: opensearch-query value: data_type:"fs:ntfs:usn_change" {file_reference value} "USN_REASON_RENAME_NEW_NAME" - name: Detect browser downloads via file system event logs - description: >- + description: |- File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using file system logs (like Santa). @@ -104,15 +100,14 @@ approaches: Chrome downloads on macOS create a specific pattern of file system events: 1. **Download starts with a `WRITE` event to a temp file named like - `.com.google.Chrome.avXx0U`** (the suffix looks to be 6 - letters/numbers). 1. That .com.google.Chrome... temp file might be `RENAME`d - to `Unconfirmed [6 - digits].crdownload`. - 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the .com.google. - temp file is renamed to the eventual filename (with extension) with - `.crdownload` appended at the end (like `cat.jpg.crdownload`). **In - either - case ([2] or [3]), at this point we have a file ending in .crdownload.** + `.com.google.Chrome.avXx0U`** (the suffix looks to be 6 letters/numbers). + 1. That `.com.google.Chrome...` temp file might be `RENAME`d to + `Unconfirmed [6 digits].crdownload`. + 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the + `.com.google.Chrome...` temp file is renamed to the eventual filename (with + extension) with `.crdownload` appended at the end (like `cat.jpg.crdownload`). + **In either case ([2] or [3]), at this point we have a file ending in + `.crdownload`.** 1. Once the download completes, the `.crdownload` suffix is removed via a `RENAME` event, leaving the downloaded file with its final name. @@ -151,7 +146,7 @@ approaches: type: opensearch-query value: data_type:"santa:file_system_event" action:RENAME file_path:"*\.crdownload" - name: Collect download records from local browser artifacts (Plaso) - description: >- + description: |- Parse download records from web browsers' own databases. Most web browsers track file downloads (at least in non-Incognito/private sessions) @@ -204,7 +199,7 @@ approaches: type: pandas value: query('data_type in ("chrome:history:file_downloaded", "safari:downloads:entry")') - name: Collect download records from local browser artifacts (Hindsight) - description: >- + description: |- Parse download records from web browsers' own databases. Most web browsers track file downloads (at least in non-Incognito/private sessions) diff --git a/dfiq/data/questions/Q1018.yaml b/dfiq/data/questions/Q1018.yaml index 5c2773a..5ffd9e4 100644 --- a/dfiq/data/questions/Q1018.yaml +++ b/dfiq/data/questions/Q1018.yaml @@ -25,7 +25,7 @@ parent_ids: - F1004 approaches: - name: Use Crowdstrike event search to link source processes to DNS queries - description: >- + description: |- CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. Crowdstrike is a detection platform, not a logging platform, so not all DNS requests @@ -62,7 +62,7 @@ approaches: event_simpleName=DnsRequest | fields ContextProcessId_decimal, DomainName] | table _time, DomainName, ImageFileName - name: Use Crowdstrike "Bulk Domains" to link source processes to DNS queries - description: >- + description: |- CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. Crowdstrike is a detection platform, not a logging platform, so not all DNS requests @@ -98,7 +98,7 @@ approaches: `PID`, `Process ID`, and `File Name` give the source process information for the DNS query. - name: Use Sysmon (Event ID 22) to link source processes to DNS queries (Splunk) - description: >- + description: |- Sysmon Event ID 22 DnsQuery stores source process ID DNS Query, event ID 22, records a DNS query being issued by a specific host and @@ -133,7 +133,7 @@ approaches: value: source="xmlwineventlog:microsoft-windows-sysmon/operational" EventCode=22 | table _time, host, process_id, process_path - name: Use Sysmon (Event ID 22) to link source processes to DNS queries (Plaso) - description: >- + description: |- Sysmon Event ID 22 DnsQuery stores source process ID DNS Query, event ID 22, records a DNS query being issued by a specific host and diff --git a/dfiq/data/questions/Q1019.yaml b/dfiq/data/questions/Q1019.yaml index 514d3a6..787d006 100644 --- a/dfiq/data/questions/Q1019.yaml +++ b/dfiq/data/questions/Q1019.yaml @@ -25,7 +25,7 @@ parent_ids: - F1005 approaches: - name: Collect process executions in Crowdstrike event search - description: >- + description: |- CrowdStrike records process executions in ProcessRollup event. CrowdStrike is a detection platform, not a logging platform, so not all ProcessRollup diff --git a/dfiq/data/questions/Q1020.yaml b/dfiq/data/questions/Q1020.yaml index dc4405d..d715cac 100644 --- a/dfiq/data/questions/Q1020.yaml +++ b/dfiq/data/questions/Q1020.yaml @@ -26,7 +26,7 @@ parent_ids: - F1029 approaches: - name: Collect URL visit records from local browser artifacts (Plaso) - description: >- + description: |- Parse URL visit records from web browsers' own databases. Most web browsers track URL visits (at least in non-Incognito/private sessions) @@ -84,7 +84,7 @@ approaches: value: query('data_type in ("chrome:history:page_visited", "firefox:places:page_visited", "safari:history:visit_sqlite")') - name: Collect URL visit records from local browser artifacts (Hindsight) - description: >- + description: |- Parse URL visit records from web browsers' own databases. Most web browsers track URL visits (at least in non-Incognito/private sessions) diff --git a/dfiq/data/questions/Q1024.yaml b/dfiq/data/questions/Q1024.yaml index 899040a..0562a72 100644 --- a/dfiq/data/questions/Q1024.yaml +++ b/dfiq/data/questions/Q1024.yaml @@ -26,7 +26,7 @@ parent_ids: - F1005 approaches: - name: Search CrowdStrike logs for Incognito Chrome processes - description: >- + description: |- CrowdStrike records the source process ID (ContextProcessId) for ProcessRollup events. diff --git a/dfiq/data/questions/Q1036.yaml b/dfiq/data/questions/Q1036.yaml index 5b19612..380f32d 100644 --- a/dfiq/data/questions/Q1036.yaml +++ b/dfiq/data/questions/Q1036.yaml @@ -31,7 +31,7 @@ parent_ids: - F1027 approaches: - name: Examine Windows Event Logs for PsExec executions - description: >- + description: |- Parse the Windows Security Event Log and look for PsExec processes being created. Windows systems can be set to log new process creation events to the Security @@ -70,7 +70,7 @@ approaches: value: data_type:"windows:evtx:record" event_identifier:4688 source_name:Microsoft-Windows-Security-Auditing xml_string:"psexec.exe" - name: Examine Windows Prefetch for evidence of PsExec usage - description: >- + description: |- Parse Windows Prefetch files and look for PsExec. Windows Prefetch files are designed to speed up application start times. To do diff --git a/dfiq/data/questions/Q1037.yaml b/dfiq/data/questions/Q1037.yaml index 4e6ca1d..c480ef1 100644 --- a/dfiq/data/questions/Q1037.yaml +++ b/dfiq/data/questions/Q1037.yaml @@ -31,7 +31,7 @@ parent_ids: - F1028 approaches: - name: Examine Windows Event Logs for PsExeSvc Service Installations - description: >- + description: |- Parse the Windows Security Event Log and look for the PsExeSvc service being installed. Windows systems can be set to log new service installations to the System event @@ -71,7 +71,7 @@ approaches: value: data_type:"windows:evtx:record" event_identifier:7045 source_name:"Service Control Manager" xml_string:"Name=\"ServiceName\">PSEXESVC" - name: Examine Windows Prefetch for evidence of PsExeSvc - description: >- + description: |- Parse Windows Prefetch files and look for PsExeSvc. Windows Prefetch files are designed to speed up application start times. To do @@ -112,7 +112,7 @@ approaches: type: opensearch-query value: data_type:"windows:prefetch:execution" AND executable:psexesvc\.exe - name: Examine Windows Event Logs for PsExeSvc executions - description: >- + description: |- Parse the Windows Security Event Log and look for PsExeSvc processes being created. Windows systems can be set to log new process creation events to the Security diff --git a/dfiq/data/questions/Q1074.yaml b/dfiq/data/questions/Q1074.yaml index 02228d1..825a382 100644 --- a/dfiq/data/questions/Q1074.yaml +++ b/dfiq/data/questions/Q1074.yaml @@ -29,7 +29,7 @@ parent_ids: - F1007 approaches: - name: Examine Windows Event Logs for Audit Log cleared - description: >- + description: |- Parse the Windows Security Event Log and look for "the audit log was cleared" event. @@ -66,7 +66,7 @@ approaches: type: opensearch-query value: data_type:"windows:evtx:record" event_identifier:1102 source_name:"Microsoft-Windows-Security-Auditing" - name: Search CrowdStrike logs for indicator removal on host - description: >- + description: |- CrowdStrike has built-in detections for "indicator removal on host" events. Clearance/deletion of system logs would be recorded in CrowdStrike as a part of diff --git a/dfiq/dfiq.py b/dfiq/dfiq.py index 1ea607b..13e2f9d 100644 --- a/dfiq/dfiq.py +++ b/dfiq/dfiq.py @@ -167,9 +167,21 @@ def __init__( ) self.type = "question" self.approaches = approaches or [] - for approach in self.approaches: + self.all_tags = self.visible_tags(allow_internal=False) + + def visible_approaches(self, allow_internal: bool = False) -> list[Approach]: + """Returns Approaches visible under `allow_internal`.""" + if allow_internal: + return list(self.approaches) + return [a for a in self.approaches if not a.is_internal] + + def visible_tags(self, allow_internal: bool = False) -> set[str]: + """Returns Question tags combined with tags from visible Approaches.""" + tags = set(self.tags) + for approach in self.visible_approaches(allow_internal): if approach.tags: - self.all_tags.update(approach.tags) + tags.update(approach.tags) + return tags class Facet(Component): @@ -291,7 +303,6 @@ def __init__( self.load_dfiq_items_from_yaml() self.build_graph() self.add_child_ids() - self.add_child_tags() def scenarios(self) -> list[Scenario]: """Returns a list of all Scenarios in the DFIQ knowledge base.""" @@ -337,14 +348,6 @@ def add_child_ids(self) -> None: children = sorted(list(nx.DiGraph.successors(self.graph, dfiq_id))) self.components[dfiq_id].set_children(children) - def add_child_tags(self) -> None: - """Adds tags from a Question's Approaches to that Question's `all_tags` attribute.""" - for component in self.components.values(): - if isinstance(component, Question): - for approach in component.approaches: - if approach.tags: - component.all_tags = component.all_tags.union(approach.tags) - @staticmethod def convert_yaml_object_to_dfiq_component( yaml_object: dict, @@ -400,7 +403,7 @@ def convert_yaml_object_to_dfiq_component( return None def load_yaml_files_by_type( - self, dfiq_type: str, yaml_data_path: str | None = None + self, dfiq_type: str, yaml_data_path: Path | str | None = None ) -> dict: """Load all DFIQ YAML files of a given type from the appropriate path. @@ -409,7 +412,7 @@ def load_yaml_files_by_type( Args: dfiq_type (str): The component type (Scenario, Facet, or Question). - yaml_data_path (str, optional): The base path holding the YAML files. + yaml_data_path (Path | str, optional): The base path holding the YAML files. """ component_dict = {} @@ -426,16 +429,15 @@ def load_yaml_files_by_type( yaml_file_paths.append(str(data_file_path)) if yaml_data_path: - dfiq_files = os.listdir( - os.path.join(yaml_data_path, self.plural_map.get(dfiq_type)) - ) - for dfiq_file in dfiq_files: - if dfiq_file.endswith(("-template.yaml", "-blank.yaml")): + target_dir = os.path.join(yaml_data_path, self.plural_map[dfiq_type]) + if not os.path.isdir(target_dir): + return component_dict + for dfiq_file in sorted(os.listdir(target_dir)): + if not dfiq_file.endswith(".yaml") or dfiq_file.endswith( + ("-template.yaml", "-blank.yaml") + ): continue - file_to_open = os.path.join( - yaml_data_path, self.plural_map.get(dfiq_type), dfiq_file - ) - yaml_file_paths.append(file_to_open) + yaml_file_paths.append(os.path.join(target_dir, dfiq_file)) for file_to_open in yaml_file_paths: if not self.validate_yaml_file(file_to_open): @@ -500,7 +502,9 @@ def validate_dfiq_schema(self, yaml_file_path: str, component_type: str) -> bool return False return True - def load_dfiq_items_from_yaml(self, yaml_data_path: str | None = None) -> None: + def load_dfiq_items_from_yaml( + self, yaml_data_path: Path | str | None = None + ) -> None: """Load all types of DFIQ components from a base path.""" if not yaml_data_path: yaml_data_path = self.yaml_data_path @@ -595,7 +599,7 @@ def generate_question_md( ) return - if skip_if_no_approaches and not question.approaches: + if skip_if_no_approaches and not question.visible_approaches(allow_internal): logging.debug( f"Skipped writing Markdown for {question_id}; it had no Approaches" ) @@ -673,10 +677,7 @@ def generate_approach_glossary_md(self, allow_internal: bool = False) -> None: if not allow_internal and question.is_internal: continue - for approach in question.approaches: - if not allow_internal and approach.is_internal: - continue - + for approach in question.visible_approaches(allow_internal): for step in approach.steps: stage = step.get("stage") step_type = step.get("type") diff --git a/dfiq/scripts/generate_site_markdown.py b/dfiq/scripts/generate_site_markdown.py index a063f07..e97f0da 100644 --- a/dfiq/scripts/generate_site_markdown.py +++ b/dfiq/scripts/generate_site_markdown.py @@ -13,6 +13,8 @@ # limitations under the License. import os +import re +from pathlib import Path from dfiq import DFIQ # This file should be called from the repository root: @@ -20,7 +22,13 @@ file_path = os.path.abspath(__file__) templates_dir = os.path.join(os.path.dirname(os.path.dirname(file_path)), "templates") -dfiq_instance = DFIQ(templates_path=templates_dir, markdown_output_path="site/docs") +docs_dir = Path("site/docs") +dfiq_instance = DFIQ(templates_path=templates_dir, markdown_output_path=docs_dir) + +for subdir in ("scenarios", "questions"): + for existing_md in (docs_dir / subdir).glob("*.md"): + if existing_md.name != "index.md": + existing_md.unlink() for scenario in dfiq_instance.scenarios(): dfiq_instance.generate_scenario_md(scenario.id or scenario.uuid) @@ -30,3 +38,32 @@ dfiq_instance.generate_question_index_md() dfiq_instance.generate_approach_glossary_md() + +mkdocs_path = Path("site/mkdocs.yml") +question_nav = [" - questions/index.md"] + [ + f" - questions/{q.id or q.uuid}.md" + for q in dfiq_instance.questions() + if not q.is_internal and q.visible_approaches() +] +scenario_nav = [" - scenarios/index.md"] + [ + f" - scenarios/{s.id or s.uuid}.md" + for s in dfiq_instance.scenarios() + if not s.is_internal +] +nav_block = ( + " - Questions:\n" + + "\n".join(question_nav) + + "\n - Scenarios:\n" + + "\n".join(scenario_nav) + + "\n" +) +mkdocs_text, count = re.subn( + r" - Questions:\n(?: - .*\n)+ - Scenarios:\n(?: - .*(?:\n|$))+", + nav_block, + mkdocs_path.read_text(encoding="utf-8"), +) +if count != 1: + raise ValueError( + "Expected to update Questions and Scenarios nav in site/mkdocs.yml" + ) +mkdocs_path.write_text(mkdocs_text, encoding="utf-8") diff --git a/dfiq/templates/question_with_approaches.jinja2 b/dfiq/templates/question_with_approaches.jinja2 index 2516bd4..d85f2b9 100644 --- a/dfiq/templates/question_with_approaches.jinja2 +++ b/dfiq/templates/question_with_approaches.jinja2 @@ -1,8 +1,8 @@ {# templates/question_with_approaches #} --- -{% if question.all_tags %} +{% if question.visible_tags(allow_internal) %} tags: -{% for tag in question.all_tags|sort %} +{% for tag in question.visible_tags(allow_internal)|sort %} - {{ tag }} {% endfor %} {% endif %} @@ -16,25 +16,24 @@ hide: **UUID**: {{ question.uuid }} {% if question.id %} + **ID**: {{ question.id }} {% endif %} - {% if question.description %} + **Description**: {{ question.description }} {% endif %} **Approaches to Answer** -{% for approach in question.approaches %} -{% if approach.is_internal == False or allow_internal == True %} +{% for approach in question.visible_approaches(allow_internal) %} - [{{ approach.name }}](#{{ approach.name.replace(' ','-').replace('(','').replace(')','').replace('"','').lower() }}) -{% if approach.description and approach.description.split('\n')[0] %} - - {{ approach.description.split('\n')[0] }} -{% endif %} -{% if approach.tags %} +{% if approach.description and approach.description.split('\n\n')[0] %} + - {{ approach.description.split('\n\n')[0].replace('\n', ' ') }} +{% endif %} +{% if approach.tags %} - Tags: {{ approach.tags|join(' ') }} -{% endif %} -{% endif %} +{% endif %} {% endfor %} # Approaches @@ -45,29 +44,28 @@ hide: benefits or drawbacks to each. All these approaches have different pros and cons. They can be used individually or in conjunction. -{% for approach in question.approaches %} -{% if approach.is_internal == False or allow_internal == True %} +{% for approach in question.visible_approaches(allow_internal) %} ## {{ approach.name }} ### 🗂️ Explanation -{% if approach.description %} +{% if approach.description %} {{ approach.description }} -{% endif %} -{% if approach.references %} +{% endif %} +{% if approach.references %} #### References -{% for reference in approach.references %} +{% for reference in approach.references %} - {{ reference }} -{% endfor %} -{% endif %} -{% if approach.references_internal and allow_internal == True %} +{% endfor %} +{% endif %} +{% if approach.references_internal and allow_internal == True %} ##### References (Internal) -{% for reference in approach.references_internal %} +{% for reference in approach.references_internal %} - {{ reference }} -{% endfor %} -{% endif %} +{% endfor %} +{% endif %} -{% if approach.notes %} +{% if approach.notes %} ### 📝 Notes Each approach comes with certain caveats or limitations. These can often @@ -76,69 +74,68 @@ don't). This can lead to incorrect assumptions and analysis. Explicitly stating what is covered and not covered by the approach reduces ambiguity. -{% if approach.notes.get('covered') %} +{% if approach.notes.get('covered') %} !!! success "Covered" -{% for note in approach.notes['covered'] %} +{% for note in approach.notes['covered'] %} - {{ note }} -{% endfor %} -{% endif %} +{% endfor %} +{% endif %} -{% if approach.notes.get('not_covered') %} +{% if approach.notes.get('not_covered') %} !!! failure "Not Covered" -{% for note in approach.notes['not_covered'] %} +{% for note in approach.notes['not_covered'] %} - {{ note }} -{% endfor %} -{% endif %} - +{% endfor %} {% endif %} -{% if approach.steps %} + +{% endif %} +{% if approach.steps %} ### ⚙️ Steps -{% for step in approach.steps %} +{% for step in approach.steps %} 1. {{ step.stage }} **{{ step.name }}** -{% if step.description %} +{% if step.description %} - **Description**: {{ step.description }} -{% endif %} -{% if step.type == 'ForensicArtifact' %} +{% endif %} +{% if step.type == 'ForensicArtifact' %} - **Type**: [ForensicArtifact](https://github.com/ForensicArtifacts/artifacts#digital-forensics-artifacts-repository) - **Value**: {{ step.value }} ([view on GitHub](https://github.com/ForensicArtifacts/artifacts/search?q={{ step.value }})) -{% elif step.type == 'opensearch-query' %} +{% elif step.type == 'opensearch-query' %} - **Type**: OpenSearch query - **Value**: ``` - {{ step.value }} + {{ step.value.rstrip() | indent(9) }} ``` -{% elif step.type == 'splunk-query' %} +{% elif step.type == 'splunk-query' %} - **Type**: Splunk query - **Value**: ``` - {{ step.value }} + {{ step.value.rstrip() | indent(9) }} ``` -{% elif step.type == 'googlesql-query' %} +{% elif step.type == 'googlesql-query' %} - **Type**: GoogleSQL query - **Value**: ```googlesql - {{ step.value }} + {{ step.value.rstrip() | indent(9) }} ``` -{% elif step.type == 'pandas' %} +{% elif step.type == 'pandas' %} +{% set pandas_query = step.value.rstrip() if step.value.startswith('df') else 'df.' ~ step.value.rstrip() %} - **Type**: Pandas (`pandas`) - **Value**: ```python - {% if step.value.startswith('df') %}{{ step.value }}{% else %}df.{{ step.value }}{% endif %} - + {{ pandas_query | indent(9) }} ``` -{% else %} +{% else %} - **Type**: {{ step.type }} - **Value**: {{ step.value.rstrip() }} -{% endif %} +{% endif %} -{% endfor %} -{% endif %} -{% endif %} +{% endfor %} +{% endif %} {% endfor %} diff --git a/dfiq/templates/questions_index.jinja2 b/dfiq/templates/questions_index.jinja2 index 9220d67..b8018e6 100644 --- a/dfiq/templates/questions_index.jinja2 +++ b/dfiq/templates/questions_index.jinja2 @@ -26,8 +26,10 @@ Some quick facts about Questions in DFIQ: | ID | Question | Tags | Approaches | | ----------- | ------------------------------------ | ---- | ---------- | {% for id, q in components.items() | sort %} -{% if q.type == 'question' and (q.is_internal == False or allow_internal == True) %} -| {{ id }} | {% if q.approaches|length %}{{ q.name }}{% else %}{{ q.name }}{% endif %} | {% if q.all_tags|length %}{{ q.all_tags|join(' ') }}{% endif %} | {{ q.approaches|length }} | +{% if q.type == 'question' and (not q.is_internal or allow_internal == True) %} +{% set approaches = q.visible_approaches(allow_internal) %} +{% set tags = q.visible_tags(allow_internal)|sort %} +| {{ id }} | {% if approaches|length %}{{ q.name }}{% else %}{{ q.name }}{% endif %} | {% if tags|length %}{{ tags|join(' ') }}{% endif %} | {{ approaches|length }} | {% endif %} {% endfor %} diff --git a/dfiq/templates/scenario.jinja2 b/dfiq/templates/scenario.jinja2 index 772462c..9c7f69a 100644 --- a/dfiq/templates/scenario.jinja2 +++ b/dfiq/templates/scenario.jinja2 @@ -4,10 +4,11 @@ **UUID**: {{ scenario.uuid }} {% if scenario.id %} + **ID**: {{ scenario.id }} {% endif %} - {% if scenario.description %} + **Description**: {{ scenario.description }} {% endif %} @@ -20,7 +21,7 @@ {% for question in components[child].questions %} {% if not components[question].is_internal or allow_internal == True %} -{% if components[question].approaches|length %} +{% if components[question].visible_approaches(allow_internal)|length %} - {{ question }}  {{ components[question].name }} {% else %} - {{ question }}  {{ components[question].name }} @@ -39,7 +40,7 @@ ## Questions {% for question in direct_questions %} -{% if components[question].approaches|length %} +{% if components[question].visible_approaches(allow_internal)|length %} - {{ question }}  {{ components[question].name }} {% else %} - {{ question }}  {{ components[question].name }} diff --git a/dfiq/utils/question_spec.yaml b/dfiq/utils/question_spec.yaml index b6cb03b..427e3e7 100644 --- a/dfiq/utils/question_spec.yaml +++ b/dfiq/utils/question_spec.yaml @@ -14,6 +14,7 @@ approaches: list(include('approach'), required=False) approach: name: str() description: str(required=False) + internal: bool(required=False) tags: list(str(), required=False) references: list(str(), required=False) references_internal: list(str(), required=False) diff --git a/site/docs/contributing/specification.md b/site/docs/contributing/specification.md index 8fdd7ca..4e15788 100644 --- a/site/docs/contributing/specification.md +++ b/site/docs/contributing/specification.md @@ -156,6 +156,7 @@ Approaches are tightly linked to their Question and are defined inline under the |-----------------------|------------|--------------------------------------------------------------------------------------------------------------------------| | `name` | `string` | A human readable name for the approach. | | `description` | `string` | Optional. A description of the approach. Markdown syntax MAY be used for rich text representation. | +| `internal` | `boolean` | Optional. Whether the approach is internal (private) or public. | | `tags` | `[string]` | Optional. List of tags. | | `references` | `[string]` | Optional. List of URLs of public references to this approach. Markdown syntax MAY be used for rich text representation. | | `references_internal` | `[string]` | Optional. List of URLs of private references to this approach. Markdown syntax MAY be used for rich text representation. | @@ -165,7 +166,7 @@ Approaches are tightly linked to their Question and are defined inline under the Example ([source](https://github.com/google/dfiq/blob/main/dfiq/data/questions/Q1001.yaml#L153-L205)): ```yaml - name: Collect download records from local browser artifacts (Plaso) - description: >- + description: |- Parse download records from web browsers' own databases. Most web browsers track file downloads (at least in non-Incognito/private sessions) diff --git a/site/docs/questions/Q1001.md b/site/docs/questions/Q1001.md index f4f10de..cbbc2c1 100644 --- a/site/docs/questions/Q1001.md +++ b/site/docs/questions/Q1001.md @@ -20,8 +20,8 @@ hide: # What files were downloaded using a web browser? **UUID**: 8620a183-d67f-481e-a63c-d8b8dfa5e968 -**ID**: Q1001 +**ID**: Q1001 **Approaches to Answer** @@ -48,22 +48,27 @@ hide: ## Detect browser downloads via change journal records ### 🗂️ Explanation -File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using NTFS change journal (USN journal) records. +File downloads by some web browsers create a specific pattern of events on the +file system. We can use this to see browser downloads using NTFS change journal +(USN journal) records. + Chrome downloads on Windows create a specific pattern of events on the file system: -1. **Download starts with a `FILE CREATE` event to `.tmp` file; older Chrome versions - have been observed creating four character file names (like `7DEE.tmp`) + +1. **Download starts with a `FILE CREATE` event to `.tmp` file**; older Chrome + versions have been observed creating four character file names (like `7DEE.tmp`) while newer versions use file names consistent with Version 4 UUIDs (like `183011a0-f96c-4c98-b71b-ab8754fb0e0e.tmp`). -1. That `.tmp` file might be `RENAME`d to `Unconfirmed [6 digits].crdownload`. 1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the `.tmp` file is - renamed to the eventual filename (with extension) with `.crdownload` -appended - at the end (like `cat.jpg.crdownload`). **In either case ([2] or [3]), -at - this point we have a file ending in .crdownload.** +1. That `.tmp` file might be `RENAME`d to `Unconfirmed [6 digits].crdownload`. +1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the `.tmp` file is + renamed to the eventual filename (with extension) with `.crdownload` appended + at the end (like `cat.jpg.crdownload`). **In either case ([2] or [3]), at + this point we have a file ending in `.crdownload`.** 1. Once the download completes, the `.crdownload` suffix is removed via a `USN_REASON_RENAME_OLD_NAME` event, leaving the downloaded file with its -final name. -Since [4] above captures the key information about the file download, we can search change journal records for it. + final name. + +Since [4] above captures the key information about the file download, we can search +change journal records for it. #### References - [Change Journals](https://learn.microsoft.com/en-gb/windows/win32/fileio/change-journals) @@ -116,21 +121,26 @@ ambiguity. ## Detect browser downloads via file system event logs ### 🗂️ Explanation -File downloads by some web browsers create a specific pattern of events on the file system. We can use this to see browser downloads using file system logs (like Santa). +File downloads by some web browsers create a specific pattern of events on the +file system. We can use this to see browser downloads using file system logs (like +Santa). + Chrome downloads on macOS create a specific pattern of file system events: + 1. **Download starts with a `WRITE` event to a temp file named like - `.com.google.Chrome.avXx0U`** (the suffix looks to be 6 -letters/numbers). 1. That .com.google.Chrome... temp file might be `RENAME`d to `Unconfirmed [6 - digits].crdownload`. -1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the .com.google. - temp file is renamed to the eventual filename (with extension) with - `.crdownload` appended at the end (like `cat.jpg.crdownload`). **In -either - case ([2] or [3]), at this point we have a file ending in .crdownload.** + `.com.google.Chrome.avXx0U`** (the suffix looks to be 6 letters/numbers). +1. That `.com.google.Chrome...` temp file might be `RENAME`d to + `Unconfirmed [6 digits].crdownload`. +1. If [2] `Unconfirmed...crdownload` `RENAME` didn't happen, the + `.com.google.Chrome...` temp file is renamed to the eventual filename (with + extension) with `.crdownload` appended at the end (like `cat.jpg.crdownload`). + **In either case ([2] or [3]), at this point we have a file ending in + `.crdownload`.** 1. Once the download completes, the `.crdownload` suffix is removed via a `RENAME` event, leaving the downloaded file with its final name. -Since [4] above captures the key information about the file download, we can search file system logs for it. +Since [4] above captures the key information about the file download, we can search +file system logs for it. ### 📝 Notes @@ -172,7 +182,11 @@ ambiguity. ## Collect download records from local browser artifacts (Plaso) ### 🗂️ Explanation Parse download records from web browsers' own databases. -Most web browsers track file downloads (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. + +Most web browsers track file downloads (at least in non-Incognito/private sessions) +in local artifacts on the system. We can collect and review these records. This +approach is useful when you have remote access to a system (via GRR for example) +or a disk image. #### References - [Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on ForensicsWiki @@ -229,7 +243,11 @@ ambiguity. ## Collect download records from local browser artifacts (Hindsight) ### 🗂️ Explanation Parse download records from web browsers' own databases. -Most web browsers track file downloads (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. + +Most web browsers track file downloads (at least in non-Incognito/private sessions) +in local artifacts on the system. We can collect and review these records. This +approach is useful when you have remote access to a system (via GRR for example) +or a disk image. #### References - [Chrome](https://forensics.wiki/google_chrome/#downloadsstart_time), [Firefox](https://forensics.wiki/mozilla_firefox/#downloads), and [Safari](https://forensics.wiki/apple_safari/#downloads) downloads on ForensicsWiki diff --git a/site/docs/questions/Q1018.md b/site/docs/questions/Q1018.md index 908dfe1..d31410b 100644 --- a/site/docs/questions/Q1018.md +++ b/site/docs/questions/Q1018.md @@ -16,8 +16,8 @@ hide: # What process made the DNS query? **UUID**: 9f9d6a06-d4de-4abd-a5b7-0ac9964cf707 -**ID**: Q1018 +**ID**: Q1018 **Approaches to Answer** @@ -45,7 +45,9 @@ hide: ## Use Crowdstrike event search to link source processes to DNS queries ### 🗂️ Explanation CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. -Crowdstrike is a detection platform, not a logging platform, so not all DNS requests are logged. Content Filter needs to be enabled to capture DNS request queries. + +Crowdstrike is a detection platform, not a logging platform, so not all DNS requests +are logged. Content Filter needs to be enabled to capture DNS request queries. #### References - https://www.crowdstrike.com/blog/hunt-threat-activity-falcon-host-endpoint-protection/bulk-domain-search-results/ @@ -87,7 +89,9 @@ ambiguity. ## Use Crowdstrike "Bulk Domains" to link source processes to DNS queries ### 🗂️ Explanation CrowdStrike records the source process ID (ContextProcessId) for DNSRequest event. -Crowdstrike is a detection platform, not a logging platform, so not all DNS requests are logged. Content Filter needs to be enabled to capture DNS request queries. + +Crowdstrike is a detection platform, not a logging platform, so not all DNS requests +are logged. Content Filter needs to be enabled to capture DNS request queries. #### References - https://www.crowdstrike.com/blog/hunt-threat-activity-falcon-host-endpoint-protection/bulk-domain-search-results/ @@ -125,7 +129,9 @@ ambiguity. ## Use Sysmon (Event ID 22) to link source processes to DNS queries (Splunk) ### 🗂️ Explanation Sysmon Event ID 22 DnsQuery stores source process ID -DNS Query, event ID 22, records a DNS query being issued by a specific host and the originating process. + +DNS Query, event ID 22, records a DNS query being issued by a specific host and +the originating process. #### References - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=90022 @@ -167,7 +173,9 @@ ambiguity. ## Use Sysmon (Event ID 22) to link source processes to DNS queries (Plaso) ### 🗂️ Explanation Sysmon Event ID 22 DnsQuery stores source process ID -DNS Query, event ID 22, records a DNS query being issued by a specific host and the originating process. + +DNS Query, event ID 22, records a DNS query being issued by a specific host and +the originating process. #### References - https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=90022 diff --git a/site/docs/questions/Q1019.md b/site/docs/questions/Q1019.md index 04b892f..54a0e37 100644 --- a/site/docs/questions/Q1019.md +++ b/site/docs/questions/Q1019.md @@ -13,8 +13,8 @@ hide: # What web browsers were running at a given time? **UUID**: ee3ccd42-9b45-4071-8a8d-c11bf00ddd0f -**ID**: Q1019 +**ID**: Q1019 **Approaches to Answer** @@ -33,7 +33,9 @@ hide: ## Collect process executions in Crowdstrike event search ### 🗂️ Explanation CrowdStrike records process executions in ProcessRollup event. -CrowdStrike is a detection platform, not a logging platform, so not all ProcessRollup events might be logged. + +CrowdStrike is a detection platform, not a logging platform, so not all ProcessRollup +events might be logged. #### References - https://www.crowdstrike.com/blog/understanding-indicators-attack-ioas-power-event-stream-processing-crowdstrike-falcon/ diff --git a/site/docs/questions/Q1020.md b/site/docs/questions/Q1020.md index 5cecbec..6ce0ff1 100644 --- a/site/docs/questions/Q1020.md +++ b/site/docs/questions/Q1020.md @@ -18,8 +18,8 @@ hide: # What pages did web browsers visit? **UUID**: e6fe3320-7051-4c0e-9d6e-61ee44b2b116 -**ID**: Q1020 +**ID**: Q1020 **Approaches to Answer** @@ -41,7 +41,11 @@ hide: ## Collect URL visit records from local browser artifacts (Plaso) ### 🗂️ Explanation Parse URL visit records from web browsers' own databases. -Most web browsers track URL visits (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. + +Most web browsers track URL visits (at least in non-Incognito/private sessions) +in local artifacts on the system. We can collect and review these records. This +approach is useful when you have remote access to a system (via GRR for example) +or a disk image. #### References - [Chrome](https://forensics.wiki/google_chrome/#history), [Firefox](https://forensics.wiki/mozilla_firefox/#history), and [Safari](https://forensics.wiki/apple_safari/#history) History on ForensicsWiki @@ -99,7 +103,11 @@ ambiguity. ## Collect URL visit records from local browser artifacts (Hindsight) ### 🗂️ Explanation Parse URL visit records from web browsers' own databases. -Most web browsers track URL visits (at least in non-Incognito/private sessions) in local artifacts on the system. We can collect and review these records. This approach is useful when you have remote access to a system (via GRR for example) or a disk image. + +Most web browsers track URL visits (at least in non-Incognito/private sessions) +in local artifacts on the system. We can collect and review these records. This +approach is useful when you have remote access to a system (via GRR for example) +or a disk image. #### References - [Chrome](https://forensics.wiki/google_chrome/#history), [Firefox](https://forensics.wiki/mozilla_firefox/#history), and [Safari](https://forensics.wiki/apple_safari/#history) History on ForensicsWiki diff --git a/site/docs/questions/Q1024.md b/site/docs/questions/Q1024.md index 8d63491..0a2a2ea 100644 --- a/site/docs/questions/Q1024.md +++ b/site/docs/questions/Q1024.md @@ -13,8 +13,8 @@ hide: # Was an Incognito/Private browser session used? **UUID**: 74753f61-48e7-4f61-9357-018589fdfa5b -**ID**: Q1024 +**ID**: Q1024 **Approaches to Answer** @@ -32,8 +32,14 @@ hide: ## Search CrowdStrike logs for Incognito Chrome processes ### 🗂️ Explanation -CrowdStrike records the source process ID (ContextProcessId) for ProcessRollup events. -Crowdstrike is a detection platform, not a logging platform, so not all executions are logged. We cannot always connect a running browser process with observed DNS requests. When we do see DNS requests coming from a browser process, yet we don't see browsing history, there are several possible explanations, including browser extensions or private browsing. +CrowdStrike records the source process ID (ContextProcessId) for ProcessRollup +events. + +Crowdstrike is a detection platform, not a logging platform, so not all executions +are logged. We cannot always connect a running browser process with observed DNS +requests. When we do see DNS requests coming from a browser process, yet we don't +see browsing history, there are several possible explanations, including browser +extensions or private browsing. #### References - https://www.crowdstrike.com/blog/tech-center/hunt-threat-activity-falcon-endpoint-protection/ diff --git a/site/docs/questions/Q1036.md b/site/docs/questions/Q1036.md index b8a90d2..c8be2bc 100644 --- a/site/docs/questions/Q1036.md +++ b/site/docs/questions/Q1036.md @@ -13,6 +13,7 @@ hide: # Have there been any executions of PsExec? **UUID**: b557f2d1-ecba-4660-992e-2d714398499f + **ID**: Q1036 **Description**: PsExec is a command-line tool that allows you to execute commands on remote computers. It is part of the Sysinternals suite of tools, which are a collection of free and open-source utilities for Windows system administration. It works by establishing a remote connection to the target computer and then executing the specified command. The command can be anything that you would normally run on a local computer, such as a batch file, a PowerShell script, or a simple command-line instruction. @@ -37,7 +38,10 @@ hide: ## Examine Windows Event Logs for PsExec executions ### 🗂️ Explanation Parse the Windows Security Event Log and look for PsExec processes being created. -Windows systems can be set to log new process creation events to the Security event log. The logs contain the new process name, process ID, parent process name, process creation time, and many more useful fields. + +Windows systems can be set to log new process creation events to the Security +event log. The logs contain the new process name, process ID, parent process name, +process creation time, and many more useful fields. #### References - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) @@ -83,7 +87,10 @@ ambiguity. ## Examine Windows Prefetch for evidence of PsExec usage ### 🗂️ Explanation Parse Windows Prefetch files and look for PsExec. -Windows Prefetch files are designed to speed up application start times. To do this, they store information about recently launched applications, including the file name of the executable and the number of times it has been run. + +Windows Prefetch files are designed to speed up application start times. To do +this, they store information about recently launched applications, including the +file name of the executable and the number of times it has been run. #### References - [Prefetch on the ForensicsWiki](https://forensics.wiki/prefetch/) diff --git a/site/docs/questions/Q1037.md b/site/docs/questions/Q1037.md index 934080d..de1a0fa 100644 --- a/site/docs/questions/Q1037.md +++ b/site/docs/questions/Q1037.md @@ -13,6 +13,7 @@ hide: # Have there been any executions of PsExeSrv? **UUID**: 4c06449b-33bb-414b-a877-d902710fbd3a + **ID**: Q1037 **Description**: PsExec is a command-line tool that allows you to execute commands on remote computers. It is part of the Sysinternals suite of tools, which are a collection of free and open-source utilities for Windows system administration. It works by establishing a remote connection to the target computer and then executing the specified command. In order to do this, it copies an executable to the target system and installs a service to run that executable. @@ -40,7 +41,11 @@ hide: ## Examine Windows Event Logs for PsExeSvc Service Installations ### 🗂️ Explanation Parse the Windows Security Event Log and look for the PsExeSvc service being installed. -Windows systems can be set to log new service installations to the System event log. The logs contain the new service name, service file name, and more. When used to access a remote system, PsExec installs a service (by default named `PSEXESVC`) on the target system. + +Windows systems can be set to log new service installations to the System event +log. The logs contain the new service name, service file name, and more. When +used to access a remote system, PsExec installs a service (by default named `PSEXESVC`) +on the target system. #### References - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) @@ -86,7 +91,10 @@ ambiguity. ## Examine Windows Prefetch for evidence of PsExeSvc ### 🗂️ Explanation Parse Windows Prefetch files and look for PsExeSvc. -Windows Prefetch files are designed to speed up application start times. To do this, they store information about recently launched applications, including the file name of the executable and the number of times it has been run. + +Windows Prefetch files are designed to speed up application start times. To do +this, they store information about recently launched applications, including the +file name of the executable and the number of times it has been run. #### References - [Prefetch on the ForensicsWiki](https://forensics.wiki/prefetch/) @@ -134,7 +142,10 @@ ambiguity. ## Examine Windows Event Logs for PsExeSvc executions ### 🗂️ Explanation Parse the Windows Security Event Log and look for PsExeSvc processes being created. -Windows systems can be set to log new process creation events to the Security event log. The logs contain the new process name, process ID, parent process name, process creation time, and many more useful fields. + +Windows systems can be set to log new process creation events to the Security +event log. The logs contain the new process name, process ID, parent process name, +process creation time, and many more useful fields. #### References - [4688(S): A new process has been created](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688) diff --git a/site/docs/questions/Q1074.md b/site/docs/questions/Q1074.md index 1fbc3ce..f98fbc7 100644 --- a/site/docs/questions/Q1074.md +++ b/site/docs/questions/Q1074.md @@ -18,8 +18,8 @@ hide: # Were any system event logs cleared? **UUID**: b85d4036-8c25-49c1-ab1a-04a45c57bf5a -**ID**: Q1074 +**ID**: Q1074 **Approaches to Answer** @@ -40,8 +40,12 @@ hide: ## Examine Windows Event Logs for Audit Log cleared ### 🗂️ Explanation -Parse the Windows Security Event Log and look for "the audit log was cleared" event. -On Windows systems, log clearance events for Security event log will be logged with event ID 1102. The logs contain the actor account name, domain name, logon id fields. +Parse the Windows Security Event Log and look for "the audit log was cleared" +event. + +On Windows systems, log clearance events for Security event log will be logged +with event ID 1102. The logs contain the actor account name, domain name, logon +id fields. #### References - [1102(S): The audit log was cleared.](https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-1102) @@ -86,7 +90,9 @@ ambiguity. ## Search CrowdStrike logs for indicator removal on host ### 🗂️ Explanation CrowdStrike has built-in detections for "indicator removal on host" events. -Clearance/deletion of system logs would be recorded in CrowdStrike as a part of their "indicator removal on host" detections. + +Clearance/deletion of system logs would be recorded in CrowdStrike as a part of +their "indicator removal on host" detections. #### References - https://www.crowdstrike.com/blog/tech-center/hunt-threat-activity-falcon-endpoint-protection/ diff --git a/site/docs/questions/index.md b/site/docs/questions/index.md index 4d7ca4b..749739f 100644 --- a/site/docs/questions/index.md +++ b/site/docs/questions/index.md @@ -24,7 +24,7 @@ Some quick facts about Questions in DFIQ: | ID | Question | Tags | Approaches | | ----------- | ------------------------------------ | ---- | ---------- | -| Q1001 | What files were downloaded using a web browser? | USN Journal Plaso Hindsight Web Browser macOS NTFS SQLite Chrome Safari Windows Edge | 4 | +| Q1001 | What files were downloaded using a web browser? | Chrome Edge Hindsight macOS NTFS Plaso Safari SQLite USN Journal Web Browser Windows | 4 | | Q1002 | What USB devices were attached to a computer? | | 0 | | Q1003 | What files were copied from a computer to a USB device? | | 0 | | Q1004 | What screenshots were taken on a computer? | | 0 | @@ -41,13 +41,13 @@ Some quick facts about Questions in DFIQ: | Q1015 | What syncing activities did external "cloud storage" applications do on a computer? | | 0 | | Q1016 | What files were sent externally via email attachments? | | 0 | | Q1017 | Were any files collected into a container? | | 0 | -| Q1018 | What process made the DNS query? | Plaso CrowdStrike Sysmon Windows Crowdstrike Investigate (UI) DNS Splunk | 4 | -| Q1019 | What web browsers were running at a given time? | Process Execution CrowdStrike Web Browser Splunk | 1 | -| Q1020 | What pages did web browsers visit? | Internet Explorer Plaso Hindsight Web Browser SQLite Chrome Safari Firefox Edge | 2 | +| Q1018 | What process made the DNS query? | CrowdStrike Crowdstrike Investigate (UI) DNS Plaso Splunk Sysmon Windows | 4 | +| Q1019 | What web browsers were running at a given time? | CrowdStrike Process Execution Splunk Web Browser | 1 | +| Q1020 | What pages did web browsers visit? | Chrome Edge Firefox Hindsight Internet Explorer Plaso Safari SQLite Web Browser | 2 | | Q1021 | What Chrome extensions are installed? | Web Browser | 0 | -| Q1022 | What actions did a Chrome extension perform? | Web Browser Browser Extension Chrome | 0 | -| Q1023 | Is a given Chrome extension associated with a given domain? | T1176 Chrome | 0 | -| Q1024 | Was an Incognito/Private browser session used? | Process Execution CrowdStrike Web Browser Splunk | 1 | +| Q1022 | What actions did a Chrome extension perform? | Browser Extension Chrome Web Browser | 0 | +| Q1023 | Is a given Chrome extension associated with a given domain? | Chrome T1176 | 0 | +| Q1024 | Was an Incognito/Private browser session used? | CrowdStrike Process Execution Splunk Web Browser | 1 | | Q1025 | What external accounts has the actor used in their web browser? | | 0 | | Q1026 | What files were downloaded from messaging apps? | | 0 | | Q1027 | Are there any sudden changes in the number of files on a device? | | 0 | @@ -59,8 +59,8 @@ Some quick facts about Questions in DFIQ: | Q1033 | Was shell history cleared? | | 0 | | Q1034 | Was content copied from a file? | | 0 | | Q1035 | Were any copies made of sensitive files? | | 0 | -| Q1036 | Have there been any executions of PsExec? | Windows Event Logs Plaso Prefetch | 2 | -| Q1037 | Have there been any executions of PsExeSrv? | Windows Event Logs Plaso Prefetch | 3 | +| Q1036 | Have there been any executions of PsExec? | Event Logs Plaso Prefetch Windows | 2 | +| Q1037 | Have there been any executions of PsExeSrv? | Event Logs Plaso Prefetch Windows | 3 | | Q1038 | Were any files sent via CLI utilities? | | 0 | | Q1039 | Are there any detections of exposed service account credentials? | | 0 | | Q1040 | Are there any interaction with the cloud project resources from an unknown external IP address (including Tor Exit nodes, C2 tagged addresses)? | | 0 | @@ -77,14 +77,14 @@ Some quick facts about Questions in DFIQ: | Q1051 | Are there any signs of data within the cloud project being transferred externally? | | 0 | | Q1052 | What browser extensions (non-Chrome) are installed? | Web Browser | 0 | | Q1053 | What Launch Agents are configured? | macOS T1543.001 | 0 | -| Q1054 | What Launch Daemons are configured? | T1543.004 macOS | 0 | +| Q1054 | What Launch Daemons are configured? | macOS T1543.004 | 0 | | Q1055 | What Windows logon scripts are configured? | T1037.001 Windows | 0 | | Q1056 | What login hooks are configured? | macOS T1037.002 | 0 | -| Q1057 | What network logon scripts are configured? | Windows T1037.003 | 0 | -| Q1058 | What domain accounts have been created? | Windows T1136.002 | 0 | -| Q1059 | What local accounts have been created? | Linux T1136.001 Windows macOS | 0 | +| Q1057 | What network logon scripts are configured? | T1037.003 Windows | 0 | +| Q1058 | What domain accounts have been created? | T1136.002 Windows | 0 | +| Q1059 | What local accounts have been created? | Linux macOS T1136.001 Windows | 0 | | Q1060 | What AT jobs are configured? | Linux macOS T1053.002 | 0 | -| Q1061 | What Scheduled Tasks are configured? | Windows T1053.005 | 0 | +| Q1061 | What Scheduled Tasks are configured? | T1053.005 Windows | 0 | | Q1062 | What cron jobs are configured? | Linux macOS T1053.003 | 0 | | Q1063 | What periodic scripts are configured? | macOS | 0 | | Q1064 | What systemd timers are configured? | Linux T1053.006 | 0 | @@ -94,10 +94,10 @@ Some quick facts about Questions in DFIQ: | Q1068 | When were system services last modified? | Linux macOS Windows | 0 | | Q1069 | Are there any indications of dylib hijacking? | macOS T1574.004 | 0 | | Q1070 | Are there any indications of dylib proxying? | macOS | 0 | -| Q1071 | Are there any indications of dynamic linker hijacking? | Linux T1574.006 macOS | 0 | -| Q1072 | Did Chrome's DNS Prefetching cause a DNS query? | Web Browser DNS | 0 | +| Q1071 | Are there any indications of dynamic linker hijacking? | Linux macOS T1574.006 | 0 | +| Q1072 | Did Chrome's DNS Prefetching cause a DNS query? | DNS Web Browser | 0 | | Q1073 | Have there been any modifications to the "hosts" file? | | 0 | -| Q1074 | Were any system event logs cleared? | Plaso Event Logs T1070.001 Splunk Linux T1070.002 macOS CrowdStrike Windows | 2 | +| Q1074 | Were any system event logs cleared? | CrowdStrike Event Logs Linux macOS Plaso Splunk T1070.001 T1070.002 Windows | 2 | | Q1075 | Is the recipient account controlled by the sender? | | 0 | | Q1076 | Were the files screenshots? | | 0 | | Q1077 | Were there bulk downloads from Google Drive? | | 0 | diff --git a/site/docs/scenarios/S1001.md b/site/docs/scenarios/S1001.md index 53923bf..972aa63 100644 --- a/site/docs/scenarios/S1001.md +++ b/site/docs/scenarios/S1001.md @@ -1,6 +1,7 @@ # Data Exfiltration **UUID**: aba6b02b-2ee7-49ab-9cbe-20b7259d4661 + **ID**: S1001 **Description**: An employee is suspected of unauthorized copying of sensitive data (code, trade secrets, etc) from internal systems to those outside of the company's control. diff --git a/site/docs/scenarios/S1002.md b/site/docs/scenarios/S1002.md index 598230b..508b116 100644 --- a/site/docs/scenarios/S1002.md +++ b/site/docs/scenarios/S1002.md @@ -1,6 +1,7 @@ # Data Infiltration **UUID**: 7c4066fb-526b-43ea-9850-6fa1f797cdc4 + **ID**: S1002 **Description**: An employee is suspected of taking confidential information or trade secrets from a prior employer and introducing it to internal systems. diff --git a/site/docs/scenarios/S1003.md b/site/docs/scenarios/S1003.md index c35e9f6..20a7874 100644 --- a/site/docs/scenarios/S1003.md +++ b/site/docs/scenarios/S1003.md @@ -1,6 +1,7 @@ # Suspicious DNS Query **UUID**: 5305f225-b274-4fc4-b60f-a87d9e2a7c11 + **ID**: S1003 **Description**: A DNS query to an unexpected domain can be an indicator of abnormal activity on a host. If a domain has been marked as malicious, an investigator may be tasked with determining what caused the DNS query (or response) and if it indicates the host has been compromised. diff --git a/site/docs/scenarios/S1005.md b/site/docs/scenarios/S1005.md index 976e86e..7e1f659 100644 --- a/site/docs/scenarios/S1005.md +++ b/site/docs/scenarios/S1005.md @@ -1,6 +1,7 @@ # Cloud Project Compromise Assessment **UUID**: 716752f6-1580-461d-9d07-387d2e8784bf + **ID**: S1005 **Description**: Evaluate a cloud project for malicious or unknown activities and determine if the cloud project is compromised. This is distinct from evaluating whether a particular instance in that cloud project is compromised. diff --git a/site/docs/scenarios/S1007.md b/site/docs/scenarios/S1007.md index 39c1698..02e4533 100644 --- a/site/docs/scenarios/S1007.md +++ b/site/docs/scenarios/S1007.md @@ -1,6 +1,7 @@ # Host Persistence Audit **UUID**: e8539ec2-53c2-492c-9070-6e4955d38f11 + **ID**: S1007 **Description**: Once an attacker is on a system, a main goal becomes trying to maintain that access. Persistence mechanisms give the attacker the ability to run malware that will survive reboots and credential changes. diff --git a/site/docs/scenarios/S1008.md b/site/docs/scenarios/S1008.md index f786895..e0f8dd5 100644 --- a/site/docs/scenarios/S1008.md +++ b/site/docs/scenarios/S1008.md @@ -1,6 +1,7 @@ # Lateral Movement **UUID**: 098db976-2553-4df2-b1c1-f341652a0549 + **ID**: S1008 **Description**: Lateral movement is the process of an attacker moving from one system to another within a network after they have gained initial access to a system. This can be done through a variety of methods, such as exploiting vulnerabilities in software, using stolen credentials, installing their own remote access tools, or using native system utilities. diff --git a/tests/test_dfiq.py b/tests/test_dfiq.py new file mode 100644 index 0000000..65e304a --- /dev/null +++ b/tests/test_dfiq.py @@ -0,0 +1,206 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from pathlib import Path +import tempfile +import unittest + +from dfiq import DFIQ, Question + +REPO_ROOT = Path(__file__).resolve().parent.parent +TEMPLATES_DIR = REPO_ROOT / "dfiq" / "templates" + + +class DFIQTest(unittest.TestCase): + def test_bundled_data_loads(self) -> None: + kb = DFIQ(templates_path=TEMPLATES_DIR) + self.assertGreaterEqual(len(kb.scenarios()), 6) + self.assertGreaterEqual(len(kb.facets()), 30) + self.assertGreaterEqual(len(kb.questions()), 90) + self.assertGreaterEqual(len(kb.approaches()), 18) + self.assertIn("F1008", kb.components["S1001"].facets) + self.assertIn("Q1001", kb.components["F1008"].questions) + + def test_v1_1_custom_data_and_markdown_generation(self) -> None: + scenario_uuid = "11111111-1111-4111-8111-111111111111" + q_mixed_uuid = "22222222-2222-4222-8222-222222222222" + q_internal_approach_uuid = "33333333-3333-4333-8333-333333333333" + + with tempfile.TemporaryDirectory() as tmp: + data_dir = Path(tmp) / "data" + out_public = Path(tmp) / "out_public" + out_internal = Path(tmp) / "out_internal" + (data_dir / "scenarios").mkdir(parents=True) + (data_dir / "questions").mkdir(parents=True) + # Intentionally omit data_dir / "facets" and add a non-YAML file. + (data_dir / "questions" / "README.txt").write_text( + "ignore me", encoding="utf-8" + ) + + (data_dir / "scenarios" / "scenario.yaml").write_text( + f"""--- +name: Direct Question Scenario +type: scenario +description: Scenario without facets or legacy IDs. +uuid: {scenario_uuid} +dfiq_version: 1.1.0 +""", + encoding="utf-8", + ) + + (data_dir / "questions" / "q_mixed.yaml").write_text( + f"""--- +name: Mixed visibility approaches question? +type: question +uuid: {q_mixed_uuid} +dfiq_version: 1.1.0 +tags: + - PublicQuestionTag +parent_ids: + - {scenario_uuid} +approaches: + - name: Public SQL Approach + description: |- + First summary paragraph + spanning two lines. + + Second detail paragraph. + tags: + - PublicApproachTag + steps: + - name: Run multi-line GoogleSQL + stage: analysis + type: googlesql-query + value: |- + SELECT * + FROM events + WHERE ok = TRUE + - name: Internal Approach + internal: true + tags: + - SecretInternalTag + steps: + - name: Query internal logs + stage: collection + type: internal-tool + value: secret_source +""", + encoding="utf-8", + ) + + (data_dir / "questions" / "q_only_internal_approach.yaml").write_text( + f"""--- +name: Internal-only approach question? +type: question +uuid: {q_internal_approach_uuid} +dfiq_version: 1.1.0 +parent_ids: + - {scenario_uuid} +approaches: + - name: Private Approach + internal: true + tags: + - OnlyInternalTag + steps: + - name: Collect private artifact + stage: collection + type: internal-tool + value: private_artifact +""", + encoding="utf-8", + ) + + kb = DFIQ( + yaml_data_path=data_dir, + markdown_output_path=out_public, + templates_path=TEMPLATES_DIR, + ) + self.assertEqual(len(kb.scenarios()), 1) + self.assertEqual(len(kb.facets()), 0) + self.assertEqual(len(kb.questions()), 2) + + scenario = kb.components[scenario_uuid] + self.assertEqual( + scenario.facets, + sorted([q_mixed_uuid, q_internal_approach_uuid]), + ) + + q_mixed = kb.components[q_mixed_uuid] + assert isinstance(q_mixed, Question) + self.assertEqual( + q_mixed.all_tags, {"PublicQuestionTag", "PublicApproachTag"} + ) + self.assertEqual( + q_mixed.visible_tags(allow_internal=True), + {"PublicQuestionTag", "PublicApproachTag", "SecretInternalTag"}, + ) + + kb.generate_scenario_md(scenario_uuid, allow_internal=False) + kb.generate_question_md(q_mixed_uuid, allow_internal=False) + kb.generate_question_md(q_internal_approach_uuid, allow_internal=False) + kb.generate_question_index_md(allow_internal=False) + + self.assertFalse( + (out_public / "questions" / f"{q_internal_approach_uuid}.md").exists() + ) + scenario_md = (out_public / "scenarios" / f"{scenario_uuid}.md").read_text( + encoding="utf-8" + ) + self.assertIn("## Questions", scenario_md) + self.assertIn(f'/questions/{q_mixed_uuid}"', scenario_md) + self.assertNotIn(f'/questions/{q_internal_approach_uuid}"', scenario_md) + + index_md = (out_public / "questions" / "index.md").read_text( + encoding="utf-8" + ) + self.assertNotIn("SecretInternalTag", index_md) + self.assertNotIn("OnlyInternalTag", index_md) + self.assertNotIn(f'/questions/{q_internal_approach_uuid}"', index_md) + + q_md = (out_public / "questions" / f"{q_mixed_uuid}.md").read_text( + encoding="utf-8" + ) + self.assertNotIn("SecretInternalTag", q_md) + self.assertIn( + "- First summary paragraph spanning two lines.", + q_md, + ) + self.assertIn( + "First summary paragraph\nspanning two lines.\n\nSecond detail paragraph.", + q_md, + ) + self.assertIn( + " ```googlesql\n" + " SELECT *\n" + " FROM events\n" + " WHERE ok = TRUE\n" + " ```", + q_md, + ) + + kb.markdown_output_path = out_internal + kb.generate_question_md(q_mixed_uuid, allow_internal=True) + kb.generate_question_md(q_internal_approach_uuid, allow_internal=True) + self.assertTrue( + (out_internal / "questions" / f"{q_internal_approach_uuid}.md").exists() + ) + q_internal_md = ( + out_internal / "questions" / f"{q_mixed_uuid}.md" + ).read_text(encoding="utf-8") + self.assertIn("SecretInternalTag", q_internal_md) + self.assertIn("## Internal Approach", q_internal_md) + + +if __name__ == "__main__": + unittest.main()