NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
50.93k stars 5.81k forks source link

bsim postgres LOG: could not receive data from client: Connection reset by peer #6951

Open infinitesteps opened 1 week ago

infinitesteps commented 1 week ago

Describe the bug The postgres log has some suspicious entries when the bsim client connects:

To Reproduce Steps to reproduce the behavior:

  1. Use the following Dockerfile to create an image
    • Create an assets directory adjacent to the Dockerfile and place ghidra_11.1.2_PUBLIC_20240709.zip in it (or adjust Dockerfile to obtain the zip in another way)
  2. Run the container
    • docker run --rm -it -p 5432:5432 --entrypoint='/bin/bash' bsimdbbare
  3. Start (after prepping directory, etc)
    • $GHIDRA_HOME/support/bsim_ctl start "$DATA_DIRECTORY" --auth password
  4. tail -f $DATA_DIRECTORY/logfile
  5. From separate host create DB:
    • $GHIDRA_INSTALL_DIR/support/bsim createdatabase postgresql://127.0.0.1:5432/bsim medium_nosize --user gradle
FROM gradle:7.6-jdk-jammy

RUN apt-get update
RUN apt-get install -y unzip

COPY assets/ghidra_11.1.2_PUBLIC_20240709.zip /tmp/ghidra.zip
RUN unzip -d /tmp/decompress /tmp/ghidra.zip
RUN mv /tmp/decompress/ghidra* /ghidra
RUN rm /tmp/ghidra.zip
RUN apt-get install -y bison flex build-essential
RUN /ghidra/support/buildNatives

# req: https://www.postgresql.org/docs/current/install-requirements.html
RUN apt-get install -y libreadline8 libreadline-dev libicu70 libicu-dev liblz4-1 liblz4-dev libzstd1 libzstd-dev zlib1g zlib1g-dev libssl3 libssl-dev
WORKDIR /ghidra/Ghidra/Features/BSim
RUN ./make-postgres.sh

WORKDIR /ghidra/support
ENTRYPOINT /bin/bash

Expected behavior Expect the log file not to have these entries.

Environment (please complete the following information): See Dockerfile

ghidracadabra commented 6 days ago

I was able to reproduce the LOG and WARNING messages manually (i.e., without using the docker file). It should be possible to clean those up.

I could only get that FATAL error to appear in the logs by entering an incorrect password. Did you add the appropriate user using bsim_ctl adduser?