-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalAccessError when running in Docker Container #137
Comments
Care to share your I have never actually tried this out myself and neither have I tried Ghidra's headless mode with BinExport. |
Dockerfile: FROM ubuntu:22.04.2
ARG DEBIAN_FRONTEND=noninteractive
RUN apt -y update && apt -y upgrade
RUN apt -y -qq install python3 python3-pip build-essential tshark zip vim nano pkg-config python3-dev openjdk-21-jdk
COPY ./ghidra /ghidra
COPY ./.ghidra /home/user/.ghidra
RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 install --no-cache-dir python_bindiff-0.2.3-py3-none-any.whl python_binexport-0.3.5-py3-none-any.whl Command line:
Export Script: from com.google.security.binexport import BinExportExporter
from java.io import File
exporter = BinExportExporter()
exporter.export(File(currentProgram.getName() + ".BinExport"), currentProgram, currentProgram.getMemory(), monitor) |
Thanks. Maybe try with a less recent JDK version? I think Ghidra is still on JDK 17. Other than that, I don't see anthing out of the ordinary in your |
I tried with 17 through to 21 and same result, thanks for looking though! |
I was able to avoid the illegal access error but now I get an import error that there is no module named security |
Can you please post the full error log? |
|
Additionally:
|
I figured it out. For anyone looking to generate .BinExport files in a gitlab/github pipeline (or any other automated fashion) using headless ghidra:
Ghidra documentation claims that you can install extensions by unzipping them in a specified directory and that they will work with the headless version. However, it looks like when you install them using the GUI, ghidra calls some internal methods to configure the extensions. In the headless version, the methods are NULL so some extensions fail to get configured properly which is what resulted in these errors. Thus, if you install the extensions through the GUI using a VNC connection and save the state of the container, the extensions will be configured properly and you can now use them correctly in headless mode as well. |
I also ran into this issue and I found a simpler solution. When you install extensions through the Ghidra GUI, they end up in the Ghidra config directory. The way I worked around this issue was to find that directory (in my system it's at |
I am running ghidra in a docker container so I can use the headless analyzer in a pipeline. I have installed the binexport extension in ghidra and am running a custom post script with the headless analyzer to export the file as a .BinExport file. I developed this on my host machine (Ubuntu 22.04 with jdk 21) where it worked perfectly and made the docker container with the same dependencies and OS version.
However, when I run this on the docker container, the analysis succeeds but it is unable to export the .BinExport file and I get the following error:
I cannot find what is causing this issue or why it is only an issue when I run this workflow in the docker container. Any insight or suggestions would be appreciated!
The text was updated successfully, but these errors were encountered: