guardicode / log4shell-exploiter

GNU General Public License v3.0
0 stars 0 forks source link

build_agent_plugin #1

Open sec13b opened 6 days ago

sec13b commented 6 days ago

i follow all steps

─$ poetry run build_agent_plugin .
2024-10-03 01:23:25,150 - Agent Plugin Builder started with arguments: plugin_path: ., build_dir_path: /home/kali/Desktop/JNDIExploit/log4shell-exploiter/build, dist_dir_path: /home/kali/Desktop/JNDIExploit/log4shell-exploiter/dist, source_dir: None, platform_dependencies: PlatformDependencyPackagingMethod.AUTODETECT, verify: True, verbosity: -1
2024-10-03 01:23:25,151 - Reading plugin manifest file: manifest.yml
2024-10-03 01:23:25,152 - Clearing build directory: /home/kali/Desktop/JNDIExploit/log4shell-exploiter/build
2024-10-03 01:23:25,369 - Copying plugin code to build directory: . -> /home/kali/Desktop/JNDIExploit/log4shell-exploiter/build
2024-10-03 01:23:26,514 - Writing log file to /home/kali/Desktop/JNDIExploit/log4shell-exploiter/build/agent_plugin_builder.log
2024-10-03 01:23:26,515 - Generating vendor directories for plugin: Log4Shell, dependency_method: PlatformDependencyPackagingMethod.AUTODETECT
2024-10-03 01:23:26,515 - Generating requirements file
2024-10-03 01:23:27,337 - Requirements file generated
2024-10-03 01:23:27,338 - Generating requirements file
2024-10-03 01:23:28,118 - Requirements file generated
2024-10-03 01:23:28,120 - Error building plugin: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Traceback (most recent call last):
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    conn.request(
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 398, in request
    self.endheaders()
  File "/usr/lib/python3.11/http/client.py", line 1298, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1058, in _send_output
    self.send(msg)
  File "/usr/lib/python3.11/http/client.py", line 996, in send
    self.connect()
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py", line 26, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 843, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 474, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 495, in _make_request
    conn.request(
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 398, in request
    self.endheaders()
  File "/usr/lib/python3.11/http/client.py", line 1298, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1058, in _send_output
    self.send(msg)
  File "/usr/lib/python3.11/http/client.py", line 996, in send
    self.connect()
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py", line 26, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/api/client.py", line 223, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
                        ^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/utils/decorators.py", line 44, in inner
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/api/client.py", line 246, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/requests/adapters.py", line 682, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/agent_plugin_builder/agent_plugin_builder.py", line 134, in main
    build_agent_plugin(
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/agent_plugin_builder/build_plugin.py", line 85, in build_agent_plugin
    create_agent_plugin_archive(agent_plugin_build_options, agent_plugin_manifest)
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/agent_plugin_builder/build_plugin.py", line 115, in create_agent_plugin_archive
    generate_vendor_directories(
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/agent_plugin_builder/build_plugin.py", line 170, in generate_vendor_directories
    common_dir_possible = check_if_common_vendor_dir_possible(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/agent_plugin_builder/vendor_dirs.py", line 70, in check_if_common_vendor_dir_possible
    output = _run_container_with_plugin_dir(LINUX_PLUGIN_BUILDER_IMAGE, command, build_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/agent_plugin_builder/vendor_dirs.py", line 116, in _run_container_with_plugin_dir
    client = docker.from_env()  # type: ignore [attr-defined]
             ^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/client.py", line 94, in from_env
    return cls(
           ^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/api/client.py", line 207, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kali/Desktop/JNDIExploit/log4shell-exploiter/.venv/lib/python3.11/site-packages/docker/api/client.py", line 230, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

┌──(kali㉿kali)-[~/Desktop/JNDIExploit/log4shell-exploiter]
└─$ 
ilija-lazoroski commented 6 days ago

Hey, thanks for reporting this issue.

Can you please run the command again but up the verbosity: poetry run build_agent_plugin . -vvvvvv

Reply with the output of this so I will know more on what is going on.

ilija-lazoroski commented 6 days ago

Hey @sec13b, I managed to reproduce the error. The build_agent_plugin tool expects that you have docker on your system to build the plugin's dependencies. Please check if have docker on your system and that the docker service is up and running. For more read on: https://github.com/guardicode/agent-plugin-builder?tab=readme-ov-file#agent-plugin-builder

sec13b commented 6 days ago

hi , i dont use doker .