fkie-cad / FACT_docker

Dockerfile for building the FACT container
GNU General Public License v3.0
21 stars 10 forks source link

[cwe_checker] Error during trying to start container plugin #25

Open bcordobaq opened 1 year ago

bcordobaq commented 1 year ago

cwe_checker can't be executed, since the container can't be created. According to the logs, it seems something is broken with the volume where the files are stored, but as far as I could check, the folder exists. We're using the latest stable image, and with the previous build (the earlier docker checksum) I didn't experience problems.

Here is the stacktrace:

[2022-07-28 14:48:37][analysis][INFO]: Analysis Completed:
UID: a9bb44df19d9ea51c0d6a4ff75b3fd4054a9114b7b333279ff86bea30e13cab9_18900
 Processed analysis: ['unpacker', 'file_type', 'software_components', 'cpu_architecture', 'cwe_checker']
 Files included: set()
[2022-07-28 14:48:37][docker][WARNING]: [Docker]: encountered docker error while processing
Process ExceptionSafeProcess-14:1432:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/docker/api/client.py", line 268, in _raise_for_status
    response.raise_for_status()
  File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.41/containers/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/opt/FACT_core/src/helperFunctions/process.py", line 57, in run
    raise exception
  File "/opt/FACT_core/src/helperFunctions/process.py", line 52, in run
    Process.run(self)
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/FACT_core/src/analysis/PluginBase.py", line 123, in process_next_object
    finished_task = self.analyze_file(task)
  File "/opt/FACT_core/src/analysis/PluginBase.py", line 69, in analyze_file
    fo = self.process_object(file_object)
  File "/opt/FACT_core/src/plugins/analysis/cwe_checker/code/cwe_checker.py", line 128, in process_object
    file_object = self._do_full_analysis(file_object)
  File "/opt/FACT_core/src/plugins/analysis/cwe_checker/code/cwe_checker.py", line 102, in _do_full_analysis
    output = self._run_cwe_checker_in_docker(file_object)
  File "/opt/FACT_core/src/plugins/analysis/cwe_checker/code/cwe_checker.py", line 66, in _run_cwe_checker_in_docker
    result = run_docker_container(
  File "/opt/FACT_core/src/helperFunctions/docker.py", line 35, in run_docker_container
    container = client.containers.run(image, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/docker/models/containers.py", line 819, in run
    container = self.create(image=image, command=command,
  File "/usr/local/lib/python3.8/dist-packages/docker/models/containers.py", line 878, in create
    resp = self.client.api.create_container(**create_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/docker/api/container.py", line 428, in create_container
    return self.create_container_from_config(config, name)
  File "/usr/local/lib/python3.8/dist-packages/docker/api/container.py", line 439, in create_container_from_config
    return self._result(res, True)
  File "/usr/local/lib/python3.8/dist-packages/docker/api/client.py", line 274, in _result
    self._raise_for_status(response)
  File "/usr/local/lib/python3.8/dist-packages/docker/api/client.py", line 270, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.41/containers/create: Bad Request ("invalid mount config for type "bind": bind source path does not exist: /media/data/fact_fw_data/ee/eed9c131aab170dfb0fe38caddf4347afabbbe7345a69137987a95875cc00f89_18500")
[2022-07-28 14:48:37][PluginBase][ERROR]: Worker 1: Exception during analysis cwe_checker on eed9c131aab170dfb0fe38caddf4347afabbbe7345a69137987a95875cc00f89_18500
jstucke commented 1 year ago

Hi, sorry for the late response. We are not entirely sure what causes your problem (except for it being related to path issues with docker in docker). A new release for FACT 4.0 will come soon (when #20 gets merged) with some fixes for path-related problems and hopefully it will also fix your problem. You could already try to use the branch but it requires some manual editing because the referenced docker images don't exist yet in the registry.

maringuu commented 8 months ago

Might be the same issue as #41.

Edit: Nevermind.