I run Kali in a VM on an M1 Mac. Unfortunately, the default configuration for DVGA fails to build due to issues with gevent on arm64. However, it can be done successfully by updating the Dockerfile (I also updated it to use Python 3.9 instead of 3.7 or 3.10, since 3.10 is not yet supported - although it will build with Python 3.7).
The two lines changed are the first, specifying the Python version, and the RUN apk add
line, which specifies the dependencies. Detailed explanation below of these changes.
FROM python:3.9-alpine
LABEL description="Damn Vulnerable GraphQL Application"
LABEL github="https://github.com/dolevf/Damn-Vulnerable-GraphQL-Application"
LABEL maintainers="Dolev Farhi & Connor McKinnon & Nick Aleks"
ARG TARGET_FOLDER=/opt/dvga
WORKDIR $TARGET_FOLDER/
RUN apk add --virtual build-deps file make curl gcc musl-dev libffi-dev g++
RUN adduser -D dvga
RUN chown dvga. $TARGET_FOLDER/
USER dvga
RUN python -m venv venv
RUN source venv/bin/activate
RUN pip3 install --upgrade pip --no-warn-script-location --disable-pip-version-check
ADD --chown=dvga:dvga core /opt/dvga/core
ADD --chown=dvga:dvga db /opt/dvga/db
ADD --chown=dvga:dvga static /opt/dvga/static
ADD --chown=dvga:dvga templates /opt/dvga/templates
COPY --chown=dvga:dvga app.py /opt/dvga
COPY --chown=dvga:dvga config.py /opt/dvga
COPY --chown=dvga:dvga setup.py /opt/dvga/
COPY --chown=dvga:dvga version.py /opt/dvga/
COPY --chown=dvga:dvga requirements.txt /opt/dvga/
RUN pip3 install -r requirements.txt --user --no-warn-script-location
RUN python setup.py
EXPOSE 5013/tcp
CMD ["python", "app.py"]
The reason this is necessary is that although gevent recently began to support arm64 binary wheels, they are only supported on manylinux2014-compatible systems - which Alpine is not. (Per: https://www.gevent.org/install.html) As specified in the gevent install docs, when a binary wheel is not available, pip will fall back on building from source. However this is where the problem is.
The default package list does not provide all the dependencies to build gevent, presumably because it depends on the binary wheel. Which is not available for arm64.
The gevent install from source docs https://www.gevent.org/development/installing_from_source.html include the dependencies, specifically referencing building on Alpine. Using the apk add
line for Alpine from there, it builds successfully.