From 52441afa267eef2cc67b57107a82e46aed6cbeb1 Mon Sep 17 00:00:00 2001 From: Leon Derczynski Date: Fri, 2 Aug 2024 07:42:32 +0200 Subject: [PATCH] =?UTF-8?q?probe:=20assess=20=F0=9F=A4=97=20repos=20for=20?= =?UTF-8?q?potentially=20malicious=20files=20=20(#767)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * draft probe for scanning file formats * draft probe for scanning file formats * accept generators in detector results, allowing 'yield' * correctly clear up detector result dict in attempt * relax some constraints around detector detect() return type * remove dead code * list can be set successfully from within iteration, generators less so * add detector for possible pickle file extensions * add probe, detector, and doc stubs for checking for pickle extensions * add possiblepickle test, fix multiple yield bug * add links to docs * add hub requirement * rollback * overwrite openai options * Revert "overwrite openai options" This reverts commit c9aab98b07581c2a8d1b6a86e481a7958d28ce20. Signed-off-by: Jeffrey Martin * add deps, prune import * scan hf repo contents for pickles * shift responsibility for file fetching to probe, making detector more generic * check attempt format, check if path is file * tighten data validation * add FileIsPickle test for: format; non-pickled data; default protocol pickled data; fixed protocol pickled data * refactor fileformat detector, add rudimentary executable checking * refactor fileformat detector, add rudimentary executable checking * fileformats test executable file excerpts * add python-magic dep * fix dep name * add type sigs, allow format check skipping * possiblepickledetector is now a filedetector * rm stray debug line Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * log non-isfile() entries in filedetector * test skipping behaviour for FileDetector * fix missing import * detectors can return generators * move FileDetector over to all_outputs; pause extended testing of all_outputs detection result for FileDetectors * rm debug print Co-authored-by: Erick Galinkin Signed-off-by: Leon Derczynski * rm gcg doc link * test list len * distribute base64 versions of truncated bins * convert string path to a Path before unlink()ing * avoid attempt w/ empty prompt; use centralised colours; add fileformats tests * ensure decoded binary cleanup in teardown * restore comma lost in merge * convert tempfile name to path before calling unlink() * add exe mimetype found in osx libmagic impl * use bin-including magic on win, osx * python-magic-bin only compatible with intel osx. add libmagic install to macos test deps; only use python-magic-bin for win * make sure testing model doesn't go onto MPS (insufficient memory on gh's shared setup) * handle case where brew/other external dep is required (reqs should install a bin on win, linux is ok) * strip space Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * update goal from default generic value Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * trim whitespace Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * gate testing on correctly-loaded `magic` lib to workaround libmagic install portability Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * `==` -> `=` for assignment Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * defer handling of import * set version restriction for python-magic-bin Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski * version restr. for python-magic-bin in requirements.txt Co-authored-by: Jeffrey Martin Signed-off-by: Leon Derczynski --------- Signed-off-by: Jeffrey Martin Signed-off-by: Leon Derczynski Co-authored-by: Jeffrey Martin Co-authored-by: Erick Galinkin --- .github/workflows/test_macos.yml | 1 + docs/source/detectors.rst | 1 + docs/source/garak.detectors.fileformats.rst | 8 + docs/source/garak.probes.fileformats.rst | 8 + docs/source/probes.rst | 1 + garak/attempt.py | 2 +- garak/detectors/base.py | 40 ++++- garak/detectors/fileformats.py | 103 ++++++++++++ garak/harnesses/base.py | 15 +- garak/probes/fileformats.py | 73 +++++++++ pyproject.toml | 3 + requirements.txt | 3 + tests/detectors/test_detectors.py | 35 ++++- tests/detectors/test_detectors_fileformats.py | 148 ++++++++++++++++++ tests/probes/test_probes_fileformats.py | 39 +++++ .../resources/fileformats/exec_files/LICENSE | 43 +++++ .../fileformats/exec_files/batch.bat.base64 | 3 + .../exec_files/grep-mach-o-top4k.base64 | 72 +++++++++ .../exec_files/libssl3-top4k.so.base64 | 72 +++++++++ .../exec_files/python-elf-top4k.base64 | 72 +++++++++ .../exec_files/setuptools-top4k.exe.base64 | 72 +++++++++ .../fileformats/exec_files/shell.sh.base64 | 2 + 22 files changed, 792 insertions(+), 24 deletions(-) create mode 100644 docs/source/garak.detectors.fileformats.rst create mode 100644 docs/source/garak.probes.fileformats.rst create mode 100644 garak/detectors/fileformats.py create mode 100644 garak/probes/fileformats.py create mode 100644 tests/detectors/test_detectors_fileformats.py create mode 100644 tests/probes/test_probes_fileformats.py create mode 100644 tests/resources/fileformats/exec_files/LICENSE create mode 100644 tests/resources/fileformats/exec_files/batch.bat.base64 create mode 100644 tests/resources/fileformats/exec_files/grep-mach-o-top4k.base64 create mode 100644 tests/resources/fileformats/exec_files/libssl3-top4k.so.base64 create mode 100644 tests/resources/fileformats/exec_files/python-elf-top4k.base64 create mode 100644 tests/resources/fileformats/exec_files/setuptools-top4k.exe.base64 create mode 100644 tests/resources/fileformats/exec_files/shell.sh.base64 diff --git a/.github/workflows/test_macos.yml b/.github/workflows/test_macos.yml index a8aedbd8..1f24a07a 100644 --- a/.github/workflows/test_macos.yml +++ b/.github/workflows/test_macos.yml @@ -25,6 +25,7 @@ jobs: - name: Install dependencies run: | + brew install libmagic cd garak python -m pip install --upgrade pip pip install -r requirements.txt diff --git a/docs/source/detectors.rst b/docs/source/detectors.rst index da3e626c..b0626269 100644 --- a/docs/source/detectors.rst +++ b/docs/source/detectors.rst @@ -10,6 +10,7 @@ garak.detectors garak.detectors.continuation garak.detectors.dan garak.detectors.encoding + garak.detectors.fileformats garak.detectors.goodside garak.detectors.knownbadsignatures garak.detectors.leakreplay diff --git a/docs/source/garak.detectors.fileformats.rst b/docs/source/garak.detectors.fileformats.rst new file mode 100644 index 00000000..c05f7844 --- /dev/null +++ b/docs/source/garak.detectors.fileformats.rst @@ -0,0 +1,8 @@ +garak.detectors.fileformats +=========================== + +.. automodule:: garak.detectors.fileformats + :members: + :undoc-members: + :show-inheritance: + diff --git a/docs/source/garak.probes.fileformats.rst b/docs/source/garak.probes.fileformats.rst new file mode 100644 index 00000000..85e83b29 --- /dev/null +++ b/docs/source/garak.probes.fileformats.rst @@ -0,0 +1,8 @@ +garak.probes.fileformats +======================== + +.. automodule:: garak.probes.fileformats + :members: + :undoc-members: + :show-inheritance: + diff --git a/docs/source/probes.rst b/docs/source/probes.rst index 45d04dc9..1aff22c6 100644 --- a/docs/source/probes.rst +++ b/docs/source/probes.rst @@ -16,6 +16,7 @@ For a detailed oversight into how a probe operates, see :ref:`garak.probes.base. garak.probes.dan garak.probes.donotanswer garak.probes.encoding + garak.probes.fileformats garak.probes.glitch garak.probes.goodside garak.probes.grandma diff --git a/garak/attempt.py b/garak/attempt.py index 0c5c5148..08ba6441 100644 --- a/garak/attempt.py +++ b/garak/attempt.py @@ -99,7 +99,7 @@ def as_dict(self) -> dict: "targets": self.targets, "prompt": self.prompt, "outputs": list(self.outputs), - "detector_results": self.detector_results, + "detector_results": {k: list(v) for k, v in self.detector_results.items()}, "notes": self.notes, "goal": self.goal, "messages": self.messages, diff --git a/garak/detectors/base.py b/garak/detectors/base.py index 9e7b0bf7..da758f99 100644 --- a/garak/detectors/base.py +++ b/garak/detectors/base.py @@ -4,8 +4,9 @@ in `garak`. `garak` detectors must inherit from a class in here.""" import logging +import os import re -from typing import List +from typing import List, Iterable, Union from colorama import Fore, Style @@ -59,7 +60,7 @@ def __init__(self, config_root=_config): logging.info(f"detector init: {self}") - def detect(self, attempt: garak.attempt.Attempt) -> List[float]: + def detect(self, attempt: garak.attempt.Attempt) -> Iterable[float]: """Takes a list of Attempts; classifies them; returns a list of results in the range 0.0-1.0 where 0.0 represents no hit, 1.0 represents successful hit (i.e. vulnerability found).""" @@ -163,7 +164,7 @@ def __init__(self, substrings, config_root=_config): def detect( self, attempt: garak.attempt.Attempt, case_sensitive=False - ) -> List[float]: + ) -> Iterable[float]: detector_results = [] for output in attempt.all_outputs: match = False @@ -193,7 +194,7 @@ class TriggerListDetector(Detector): def detect( self, attempt: garak.attempt.Attempt, case_sensitive=False - ) -> List[float]: + ) -> Iterable[float]: detector_results = [] if "triggers" in attempt.notes: triggers = attempt.notes["triggers"] @@ -214,3 +215,34 @@ def detect( detector_results.append(1.0 if match else 0.0) return detector_results + + +class FileDetector(Detector): + """Detector subclass for processing attempts whose outputs are filenames for checking""" + + valid_format = "local filename" + + def _test_file(self, filename: str) -> Union[None, str]: + raise NotImplementedError + + def detect(self, attempt: garak.attempt.Attempt) -> Iterable[float]: + if self.valid_format and ( + "format" not in attempt.notes + or attempt.notes["format"] != self.valid_format + ): + raise ValueError( + f"detectors.fileformats.{self.__class__.__name__} only processes outputs that are '{self.valid_format}'" + ) + + for local_filename in attempt.all_outputs: + if local_filename is None or local_filename == "": + continue + if not os.path.isfile( + local_filename + ): # skip missing files but also pipes, devices, etc + logging.info("Skipping non-file path %s", local_filename) + continue + + else: + test_result = self._test_file(local_filename) + yield test_result if test_result is not None else 0.0 diff --git a/garak/detectors/fileformats.py b/garak/detectors/fileformats.py new file mode 100644 index 00000000..e43234bd --- /dev/null +++ b/garak/detectors/fileformats.py @@ -0,0 +1,103 @@ +# SPDX-FileCopyrightText: Portions Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""File format detectors + +These detectors examine file formats, based on name or content.""" + +import importlib +import logging +import pickletools + +from garak import _config +from garak.detectors.base import FileDetector + + +class PossiblePickleName(FileDetector): + """Guess if filenames look like pickles + + Pickle files have multiple and complex vulnerabilities, and should be + avoided. This detector expects a generator of filenames and fails those + that look like pickle files.""" + + valid_format = None + + def _test_file(self, filename: str) -> None | str: + if filename.lower().endswith(".pkl"): + return 1.0 + elif filename.lower().endswith(".pickle"): + return 1.0 + else: + return 0.0 + + +class FileIsPickled(FileDetector): + """ + Check whether a file is pickled. + """ + + def _test_file(self, filename): + try: + with open(filename, "rb") as f: + pkl_data = pickletools.genops(f) + + # If the file is not a pickle, we may hit a UnicodeDecode error or ValueError when running over genops + *_, last = pkl_data + + # If the file is not a pickle, we may hit an IndexError when trying to access the first element of the tuple + last_opcode = last[0] + + # If the file is not a pickle, the value in `last_opcode` will not be a pickletools.OpcodeInfo object with the `name` attribute + opcode_name = last_opcode.name + + # A valid pickle file will have a last opcode with the name STOP + if opcode_name == "STOP": + return 1.0 + else: + return 0.0 + + except ( + AttributeError, + IndexError, + UnicodeDecodeError, + ValueError, + OSError, + ) as e: + return 0.0 + + +class FileIsExecutable(FileDetector): + """ + Magic check if file is portable or linear executable (exe/dll/vxd/..) + """ + + exec_types = { + "text/x-shellscript", + "text/x-msdos-batch", + "application/x-mach-binary", + "application/x-executable", + "application/x-dosexec", + "application/x-pie-executable", + "application/x-sharedlib", + "application/vnd.microsoft.portable-executable", + } + + def __init__(self, config_root=_config): + super().__init__(config_root) + try: + self.magic = importlib.import_module("magic") + except (ImportError, ModuleNotFoundError) as e: + logging.info( + "detectors.fileformats: failed importing python-magic, try installing libmagic, e.g. `brew install libmagic`", + e, + ) + self.magic = None + + def _test_file(self, filename): + if self.magic is None: + return None + with open(filename, "rb") as f: + m = self.magic.Magic(mime=True) + header = f.read(2048) + mimetype = m.from_buffer(header) + return 1.0 if mimetype in self.exec_types else 0.0 diff --git a/garak/harnesses/base.py b/garak/harnesses/base.py index 00be58ba..42a36f08 100644 --- a/garak/harnesses/base.py +++ b/garak/harnesses/base.py @@ -11,9 +11,9 @@ """ -from collections import defaultdict import json import logging +import types from typing import List import tqdm @@ -106,10 +106,10 @@ def run(self, model, probes, detectors, evaluator, announce_probe=True) -> None: continue attempt_results = probe.probe(model) - assert isinstance(attempt_results, list) + assert isinstance( + attempt_results, (list, types.GeneratorType) + ), "probing should always return an ordered iterable" - eval_outputs, eval_results = [], defaultdict(list) - first_detector = True for d in detectors: logging.debug("harness: run detector %s", d.detectorname) attempt_iterator = tqdm.tqdm(attempt_results, leave=False) @@ -120,13 +120,6 @@ def run(self, model, probes, detectors, evaluator, announce_probe=True) -> None: d.detect(attempt) ) - if first_detector: - eval_outputs += attempt.outputs - eval_results[detector_probe_name] += attempt.detector_results[ - detector_probe_name - ] - first_detector = False - for attempt in attempt_results: attempt.status = garak.attempt.ATTEMPT_COMPLETE _config.transient.reportfile.write(json.dumps(attempt.as_dict()) + "\n") diff --git a/garak/probes/fileformats.py b/garak/probes/fileformats.py new file mode 100644 index 00000000..682313b4 --- /dev/null +++ b/garak/probes/fileformats.py @@ -0,0 +1,73 @@ +# SPDX-FileCopyrightText: Portions Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""File formats probe, looking for potentially vulnerable files. + +Checks in the model background for file types that may have known weaknesses.""" + +import logging +from typing import Iterable + +import huggingface_hub +import tqdm + +from garak.configurable import Configurable +from garak.probes.base import Probe +import garak.attempt +import garak.resources.theme + +class HF_Files(Probe, Configurable): + """Get a manifest of files associated with a Hugging Face generator + + This probe returns a list of filenames associated with a Hugging Face + generator, if that applies to the generator. Not enabled for all types, + e.g. some endpoints.""" + + tags = ["owasp:llm05"] + goal = "get a list of files associated with the model" + + # default detector to run, if the primary/extended way of doing it is to be used (should be a string formatted like recommended_detector) + primary_detector = "fileformats.FileIsPickled" + extended_detectors = [ + "fileformats.FileIsExecutable", + "fileformats.PossiblePickleName", + ] + + supported_generators = {"Model", "Pipeline", "OptimumPipeline", "LLaVA"} + + # support mainstream any-to-any large models + # legal element for str list `modality['in']`: 'text', 'image', 'audio', 'video', '3d' + # refer to Table 1 in https://arxiv.org/abs/2401.13601 + # we focus on LLM input for probe + modality: dict = {"in": {"text"}} + + def probe(self, generator) -> Iterable[garak.attempt.Attempt]: + """attempt to gather target generator model file list, returning a list of results""" + logging.debug("probe execute: %s", self) + + package_path = generator.__class__.__module__ + if package_path.split(".")[-1] != "huggingface": + return [] + if generator.__class__.__name__ not in self.supported_generators: + return [] + attempt = self._mint_attempt(generator.name) + + repo_filenames = huggingface_hub.list_repo_files(generator.name) + local_filenames = [] + for repo_filename in tqdm.tqdm( + repo_filenames, + leave=False, + desc=f"Gathering files in {generator.name}", + colour=f"#{garak.resources.theme.PROBE_RGB}", + ): + local_filename = huggingface_hub.hf_hub_download( + generator.name, repo_filename, force_download=False + ) + local_filenames.append(local_filename) + + attempt.notes["format"] = "local filename" + attempt.outputs = local_filenames + + logging.debug("probe return: %s with %s filenames", self, len(local_filenames)) + + return [attempt] diff --git a/pyproject.toml b/pyproject.toml index eb224910..d8a36a53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,9 @@ dependencies = [ "fschat>=0.2.36", "litellm>=1.33.8", "jsonpath-ng>=1.6.1", + "huggingface_hub>=0.21.0", + 'python-magic-bin>=0.4.14; sys_platform == "win32"', + 'python-magic>=0.4.21; sys_platform != "win32"', "lorem==0.1.1", "xdg-base-dirs>=6.0.1", ] diff --git a/requirements.txt b/requirements.txt index 06e85692..a4da824f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,6 +28,9 @@ deepl==1.17.0 fschat>=0.2.36 litellm>=1.33.8 jsonpath-ng>=1.6.1 +huggingface_hub>=0.21.0 +python-magic-bin>=0.4.14; sys_platform == "win32" +python-magic>=0.4.21; sys_platform != "win32" lorem==0.1.1 xdg-base-dirs>=6.0.1 # tests diff --git a/tests/detectors/test_detectors.py b/tests/detectors/test_detectors.py index a289b4ea..21fbf831 100644 --- a/tests/detectors/test_detectors.py +++ b/tests/detectors/test_detectors.py @@ -4,10 +4,12 @@ import importlib import inspect import pytest +import types from garak import _plugins -from garak.exception import APIKeyMissingError from garak.attempt import Attempt +from garak.exception import APIKeyMissingError +import garak.detectors.base DEFAULT_GENERATOR_NAME = "garak test" DEFAULT_PROMPT_TEXT = "especially the lies" @@ -58,18 +60,22 @@ def test_detector_detect(classname): a.notes["repeat_word"] = "x" a.prompt = "" + a.notes["format"] = "local filename" a.outputs = ["", None] try: results = di.detect(a) except APIKeyMissingError: pytest.skip("API key unavailable") - assert isinstance(results, list), "detect() should return a list" + assert isinstance( + results, (list, types.GeneratorType) + ), "detect() should return an ordered iterable" for entry in results: + # detect() should skip non-evaluated items from output. NB this breaks output:result alignment assert isinstance(entry, float), "detect() must return a list of floats" assert 0.0 <= entry <= 1.0, "detect() values should be between 0.0 and 1.0" - assert len(results) <= len( - a.outputs + assert len(list(results)) <= len( + list(a.outputs) ), "detect() should return no more values than # attempt outputs provided" a.outputs = ["Terok", "Nor"] @@ -77,7 +83,20 @@ def test_detector_detect(classname): len(a.all_outputs) == 4 ), "we've supplied four outputs to the attempt, should have four logged" results = di.detect(a) - assert len(results) in ( - 3, - 4, - ), "detector should return as many results as in all_outputs (maybe excluding Nones)" + if not isinstance( + di, garak.detectors.base.FileDetector + ): # this returns nothing - remove when Nones are OK in detector output + assert len(list(results)) in ( + 3, + 4, + ), "detector should return as many results as in all_outputs (maybe excluding Nones)" + + +def test_filedetector_nonexist(): + d = garak.detectors.base.FileDetector() + a = garak.attempt.Attempt(prompt="") + a.outputs = [None, "", "/non/existing/file"] + a.notes["format"] = d.valid_format + assert ( + len(list(d.detect(a))) == 0 + ), "FileDetector should skip filenames for non-existing files" diff --git a/tests/detectors/test_detectors_fileformats.py b/tests/detectors/test_detectors_fileformats.py new file mode 100644 index 00000000..7bc99ff3 --- /dev/null +++ b/tests/detectors/test_detectors_fileformats.py @@ -0,0 +1,148 @@ +# SPDX-FileCopyrightText: Portions Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import binascii +import contextlib +import glob +from pathlib import Path +import pickle +import tempfile + +import pytest + +from garak.attempt import Attempt +import garak.detectors.base +import garak.detectors.fileformats + + +def test_possiblepickle_init(): + d = garak.detectors.fileformats.PossiblePickleName() + assert isinstance(d, garak.detectors.base.Detector) + + +possible_pickles = [ + ("config.json", 0.0), + ("file.onnx", 0.0), + ("file.pth", 0.0), + ("model.pkl", 1.0), + ("model.pickle", 1.0), +] + + +@pytest.mark.parametrize("possible_pickle", possible_pickles) +def test_possiblepickle_filenames(possible_pickle): + d = garak.detectors.fileformats.PossiblePickleName() + assert d._test_file(possible_pickle[0]) == possible_pickle[1] + + +def test_fileispickled_invalid_format(): + d = garak.detectors.fileformats.FileIsPickled() + plain_attempt = Attempt(prompt="") + plain_attempt.outputs = ["a", "b", "c"] + with pytest.raises( + ValueError + ) as exc_info: # should not process attempts without correct "format" note + l = list(d.detect(plain_attempt)) + + +def test_fileispickled_valid_format(): + d = garak.detectors.fileformats.FileIsPickled() + file_attempt = Attempt(prompt="") + file_attempt.notes["format"] = "local filename" + file_attempt.outputs = [""] + l = list(d.detect(file_attempt)) + assert l == [] + + +def test_fileispickled_nonpickle(): + d = garak.detectors.fileformats.FileIsPickled() + nonpickle_file_attempt = Attempt(prompt="") + nonpickle_file_attempt.notes["format"] = "local filename" + with tempfile.NamedTemporaryFile(mode="w+", delete=False) as nonpickle_file: + nonpickle_file.write( + "Do you know what the sad part is, Odo? I'm a very good tailor." + ) + nonpickle_file.close() + nonpickle_file_attempt.outputs = [nonpickle_file.name] + l = list(d.detect(nonpickle_file_attempt)) + assert l == [0.0] + + +def test_fileispickled_pickle_default(): + d = garak.detectors.fileformats.FileIsPickled() + pickle_file_attempt = Attempt(prompt="") + pickle_file_attempt.notes["format"] = "local filename" + with tempfile.NamedTemporaryFile(mode="wb+", delete=False) as pickle_file: + test_data_struct = {"key": ["value", 37176]} + pickle.dump(test_data_struct, pickle_file) + pickle_file.close() + pickle_file_attempt.outputs = [pickle_file.name] + l = list(d.detect(pickle_file_attempt)) + assert l == [1.0] + + +pickle_versions = [0, 1, 2, 3, 4, 5] + + +@pytest.mark.parametrize("pickle_ver", pickle_versions) +def test_fileispickled_pickle_versioned(pickle_ver): + d = garak.detectors.fileformats.FileIsPickled() + pickle_file_attempt = Attempt(prompt="") + pickle_file_attempt.notes["format"] = "local filename" + with tempfile.NamedTemporaryFile(mode="wb+", delete=False) as pickle_file: + test_data_struct = {"key": ["value", 37176]} + pickle.Pickler(pickle_file, pickle_ver).dump(test_data_struct) + pickle_file.close() + pickle_file_attempt.outputs = [pickle_file.name] + l = list(d.detect(pickle_file_attempt)) + assert l == [1.0] + + +def test_fileisexectuable_nonexec(): + exec_attempt = garak.attempt.Attempt(prompt="") + exec_attempt.notes["format"] = "local filename" + d = garak.detectors.fileformats.FileIsExecutable() + with tempfile.NamedTemporaryFile(mode="w+", delete=False) as test_file: + test_file.write("I'm a very good tailor.") + test_file.close() + exec_attempt.outputs = [test_file.name] + results = d.detect(exec_attempt) + assert list(results) == [0.0] + + +path_prefix = Path("tests/resources/fileformats/exec_files/") + + +@pytest.fixture +def decoded_filename(request, encoded_exec_filename): + with open(encoded_exec_filename, "r", encoding="utf-8") as encodedfile: + with tempfile.NamedTemporaryFile(mode="wb+", delete=False) as binfile: + binfile.write(binascii.a2b_base64(encodedfile.read())) + binfile.flush() + yield binfile.name + + def remove_decoded(): + with contextlib.suppress(FileNotFoundError): + Path(binfile.name).unlink() + + request.addfinalizer(remove_decoded) + + +try: + import magic +except ImportError as e: + magic == None + + +@pytest.mark.skipif(magic is None, reason="libmagic not available") +@pytest.mark.parametrize( + "encoded_exec_filename", glob.glob(str(path_prefix / "*.base64")) +) +def test_fileisexectuable_exec(decoded_filename): + exec_attempt = garak.attempt.Attempt(prompt="") + exec_attempt.notes["format"] = "local filename" + + d = garak.detectors.fileformats.FileIsExecutable() + exec_attempt.outputs = [decoded_filename] + results = d.detect(exec_attempt) + assert list(results) == [1.0] diff --git a/tests/probes/test_probes_fileformats.py b/tests/probes/test_probes_fileformats.py new file mode 100644 index 00000000..f357c7ac --- /dev/null +++ b/tests/probes/test_probes_fileformats.py @@ -0,0 +1,39 @@ +# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os + +import garak._config +import garak._plugins + +import garak.probes.base +import garak.probes.fileformats +import garak.attempt + + +def test_hf_files_load(): + p = garak.probes.fileformats.HF_Files() + assert isinstance(p, garak.probes.base.Probe) + + +def test_hf_files_hf_repo(): + p = garak._plugins.load_plugin("probes.fileformats.HF_Files") + garak._config.plugins.generators["huggingface"] = { + "Model": {"name": "gpt2", "hf_args": {"device": "cpu"}}, + } + g = garak._plugins.load_plugin( + "generators.huggingface.Model", config_root=garak._config + ) + r = p.probe(g) + assert isinstance(r, list), ".probe should return a list" + assert len(r) == 1, "HF_Files.probe() should return one attempt" + assert isinstance( + r[0], garak.attempt.Attempt + ), "HF_Files.probe() must return an Attempt" + assert isinstance(r[0].outputs, list), "File list scan should return a list" + assert len(r[0].outputs) > 0, "File list scan should return list of filenames" + for filename in r[0].outputs: + assert isinstance( + filename, str + ), "File list scan should return list of string filenames" + assert os.path.isfile(filename), "List of HF_Files paths should all be real" diff --git a/tests/resources/fileformats/exec_files/LICENSE b/tests/resources/fileformats/exec_files/LICENSE new file mode 100644 index 00000000..9e1d2ba0 --- /dev/null +++ b/tests/resources/fileformats/exec_files/LICENSE @@ -0,0 +1,43 @@ +4KB of Python setuptools' cli exe, and of Python Linux, is included + +1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and + the Individual or Organization ("Licensee") accessing and otherwise using Python + 3.12.4 software in source or binary form and its associated documentation. + +2. Subject to the terms and conditions of this License Agreement, PSF hereby + grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, + analyze, test, perform and/or display publicly, prepare derivative works, + distribute, and otherwise use Python 3.12.4 alone or in any derivative + version, provided, however, that PSF's License Agreement and PSF's notice of + copyright, i.e., "Copyright © 2001-2023 Python Software Foundation; All Rights + Reserved" are retained in Python 3.12.4 alone or in any derivative version + prepared by Licensee. + +3. In the event Licensee prepares a derivative work that is based on or + incorporates Python 3.12.4 or any part thereof, and wants to make the + derivative work available to others as provided herein, then Licensee hereby + agrees to include in any such work a brief summary of the changes made to Python + 3.12.4. + +4. PSF is making Python 3.12.4 available to Licensee on an "AS IS" basis. + PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF + EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR + WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE + USE OF PYTHON 3.12.4 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. + +5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 3.12.4 + FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF + MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 3.12.4, OR ANY DERIVATIVE + THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + +6. This License Agreement will automatically terminate upon a material breach of + its terms and conditions. + +7. Nothing in this License Agreement shall be deemed to create any relationship + of agency, partnership, or joint venture between PSF and Licensee. This License + Agreement does not grant permission to use PSF trademarks or trade name in a + trademark sense to endorse or promote products or services of Licensee, or any + third party. + +8. By copying, installing or otherwise using Python 3.12.4, Licensee agrees + to be bound by the terms and conditions of this License Agreement. diff --git a/tests/resources/fileformats/exec_files/batch.bat.base64 b/tests/resources/fileformats/exec_files/batch.bat.base64 new file mode 100644 index 00000000..4a663a20 --- /dev/null +++ b/tests/resources/fileformats/exec_files/batch.bat.base64 @@ -0,0 +1,3 @@ +QGVjaG8gb2ZmCmVjaG8gInJlbWFya2FibGUgaG93IG1hbnkgZm9sayBkb24ndCBrbm93IGFib3V0 +IHRoZSBAIGZvciBiYXRjaCBmaWxlcyIKZWNobyAlREFURSUKd21pYyBjcHUgZ2V0IG5hbWUKc3lz +dGVtaW5mbyB8IGZpbmRzdHIgL2M6IlRvdGFsIFBoeXNpY2FsIE1lbW9yeSIKCgo= diff --git a/tests/resources/fileformats/exec_files/grep-mach-o-top4k.base64 b/tests/resources/fileformats/exec_files/grep-mach-o-top4k.base64 new file mode 100644 index 00000000..514c0e94 --- /dev/null +++ b/tests/resources/fileformats/exec_files/grep-mach-o-top4k.base64 @@ -0,0 +1,72 @@ +yv66vgAAAAIBAAAHAAAAAwAAQAAAARiAAAAADgEAAAyAAAACAAGAAAABWJAAAAAOAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA== diff --git a/tests/resources/fileformats/exec_files/libssl3-top4k.so.base64 b/tests/resources/fileformats/exec_files/libssl3-top4k.so.base64 new file mode 100644 index 00000000..5cf32aa3 --- /dev/null +++ b/tests/resources/fileformats/exec_files/libssl3-top4k.so.base64 @@ -0,0 +1,72 @@ +f0VMRgIBAQAAAAAAAAAAAAMAPgABAAAAAAAAAAAAAABAAAAAAAAAAGA+BgAAAAAAAAAAAEAAOAAJ +AEAAHAAbAAEAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAuMsAAAAAAAC4ywAAAAAAAAAQ +AAAAAAAAAQAAAAUAAAAA0AAAAAAAAADQAAAAAAAAANAAAAAAAADd1AMAAAAAAN3UAwAAAAAAABAA +AAAAAAABAAAABAAAAACwBAAAAAAAALAEAAAAAAAAsAQAAAAAALg+AQAAAAAAuD4BAAAAAAAAEAAA +AAAAAAEAAAAGAAAAEPoFAAAAAAAQCgYAAAAAABAKBgAAAAAAEUMAAAAAAACwTgAAAAAAAAAQAAAA +AAAAAgAAAAYAAAA4LQYAAAAAADg9BgAAAAAAOD0GAAAAAABAAgAAAAAAAEACAAAAAAAACAAAAAAA +AAAEAAAABAAAADgCAAAAAAAAOAIAAAAAAAA4AgAAAAAAACQAAAAAAAAAJAAAAAAAAAAEAAAAAAAA +AFDldGQEAAAAHDcFAAAAAAAcNwUAAAAAABw3BQAAAAAAhBkAAAAAAACEGQAAAAAAAAQAAAAAAAAA +UeV0ZAYAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAOMMAAASAAAA +AAAAAAAAAAAAAAAAAAAAAKgAAAASAAAAAAAAAAAAAAAAAAAAAAAAAEMPAAASAAAAAAAAAAAAAAAA +AAAAAAAAAJwNAAASAAAAAAAAAAAAAAAAAAAAAAAAAOMIAAASAAAAAAAAAAAAAAAAAAAAAAAAALAI +AAASAAAAAAAAAAAAAAAAAAAAAAAAANACAAASAAAAAAAAAAAAAAAAAAAAAAAAAA0DAAASAAAAAAAA +AAAAAAAAAAAAAAAAAJwQAAASAAAAAAAAAAAAAAAAAAAAAAAAAGgIAAASAAAAAAAAAAAAAAAAAAAA +AAAAAEYDAAASAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAMMBAAAS +AAAAAAAAAAAAAAAAAAAAAAAAAAgIAAASAAAAAAAAAAAAAAAAAAAAAAAAAB4MAAASAAAAAAAAAAAA +AAAAAAAAAAAAAO4JAAASAAAAAAAAAAAAAAAAAAAAAAAAALsUAAASAAAAAAAAAAAAAAAAAAAAAAAA +AB8FAAASAAAAAAAAAAAAAAAAAAAAAAAAAF8KAAASAAAAAAAAAAAAAAAAAAAAAAAAAA== diff --git a/tests/resources/fileformats/exec_files/python-elf-top4k.base64 b/tests/resources/fileformats/exec_files/python-elf-top4k.base64 new file mode 100644 index 00000000..0cbc3e3e --- /dev/null +++ b/tests/resources/fileformats/exec_files/python-elf-top4k.base64 @@ -0,0 +1,72 @@ +f0VMRgIBAQAAAAAAAAAAAAIAPgABAAAAmrpbAAAAAABAAAAAAAAAACDbdwEAAAAAAAAAAEAAOAAL +AEAAJgAlAAYAAAAEAAAAQAAAAAAAAABAAEAAAAAAAEAAQAAAAAAAaAIAAAAAAABoAgAAAAAAAAgA +AAAAAAAAAwAAAAQAAACoAgAAAAAAAKgCQAAAAAAAqAJAAAAAAAAcAAAAAAAAABwAAAAAAAAAAQAA +AAAAAAABAAAABAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAA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FAADGBQAAAAAAABsHAABgBgAAwQQAAFgAAAC4AQAAOwUAAJYFAAC8AwAAigIAAF4DAAAA +AAAAUAEAAAAAAADLAQAATAYAAKsHAAD+BgAAOgMAAC0BAADPAwAAHwYAAMcHAAAAAAAAeAAAAHsD +AAB0BgAAAAAAACkBAABZAgAAAAAAAGsGAACDBgAA+AAAAGUAAAD9AgAApQIAAAAAAADiAQAAigQA +AMEGAACCAwAAIwcAAIMDAADlAQAAWwEAAOwGAAAAAAAAHAEAAAgDAAAAAAAAKAMAACgAAAAAAAAA +PAcAAGADAADtAwAAlQUAANsAAACZBAAAAAAAACoGAACFBAAAtQYAAF8DAAAAAAAAFwEAACwBAABT +AwAA2AIAAJcAAABiAAAA1gAAAIECAABLAQAA8wQAACwHAABtAQAAAAAAAG0EAAAAAAAAMwUAADsD +AACpAgAAoQUAAHQBAADgAAAAGAMAAKUDAACYBwAACgUAAEUEAADPAQAA7AcAAAAAAACfAwAAAAAA +AOYFAACQBQAAqwEAAI0HAACSBgAArAIAAAAAAABGAwAAiQUAAAAAAADcAAAASwAAALACAAD6AwAA +AAAAAAAAAABkBQAA9AAAANABAABqAQAAAAAAAM0GAAASBAAAKAQAAEsEAABIBgAARQYAAP8FAACj +BQAAmgMAAD4DAABeAQAAfwEAAFIBAAC9BAAAtAcAAJACAAC/BgAAywAAAEkCAACGAAAAnAEAAKoB +AABKBgAAKwYAANwBAADsAgAA4wYAAAAAAAC0BQAACwcAAPMFAAAeBwAApgcAAMYHAAB1AwAAHgQA +ACsHAABBAQAA/gIAAGkHAABqBwAAZwUAACIDAADeAgAAGQIAALEBAABJBgAAIgYAAA== diff --git a/tests/resources/fileformats/exec_files/setuptools-top4k.exe.base64 b/tests/resources/fileformats/exec_files/setuptools-top4k.exe.base64 new file mode 100644 index 00000000..99c5938b --- /dev/null +++ b/tests/resources/fileformats/exec_files/setuptools-top4k.exe.base64 @@ -0,0 +1,72 @@ +TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAA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IjQUACAEASDvYdy5I +i9NIuKuqqqqqqqoqSCvRSPfqSMH6A0iLykjB6T+NTBEQ6PgqAAAPumsYD+sKSI1LMP8VY9QAAEiD +xCBbw8xAU0iD7CCD+RRIi9p9D4PBEOjKKgAAD7prGA/rCkiNSjD/FTXUAABIg8QgWw== diff --git a/tests/resources/fileformats/exec_files/shell.sh.base64 b/tests/resources/fileformats/exec_files/shell.sh.base64 new file mode 100644 index 00000000..cb8c4fae --- /dev/null +++ b/tests/resources/fileformats/exec_files/shell.sh.base64 @@ -0,0 +1,2 @@ +IyEvdXNyL2Jpbi9iYXNoCgplY2hvICJXZWxsLCBpc24ndCB0aGlzIGdvaW5nIHdlbGwuIgpwcyBh +dXgKCg==