TheWover / donut

Generates x86, x64, or AMD64+x86 position-independent shellcode that loads .NET Assemblies, PE files, and other Windows payloads from memory and runs them with parameters
BSD 3-Clause "New" or "Revised" License
3.38k stars 610 forks source link

[Feature] - ARM64 support #139

Open QU35T-code opened 8 months ago

QU35T-code commented 8 months ago

Donut-shellcode is not supported for arm64.

ib -o build/lib.linux-aarch64-cpython-311/donut.cpython-311-aarch64-linux-gnu.so
      /usr/bin/ld: lib/aplib64.a(elfstubs.o): Relocations in generic ELF (EM: 62)
      /usr/bin/ld: lib/aplib64.a: error adding symbols: file in wrong format
      collect2: error: ld returned 1 exit status
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for donut-shellcode
  Building wheel for pysecretsocks (pyproject.toml) ... done
  Created wheel for pysecretsocks: filename=PySecretSOCKS-0.9.1-py3-none-any.whl size=6507 sha256=892605faf4c31cb84664e88b278e52c55cec574514da387be5bf32a16b8c68c8
  Stored in directory: /tmp/pip-ephem-wheel-cache-p35y6ikg/wheels/55/a0/82/4c161cb29a49ea7f46c645f6655b8b5a52a59d78fd51d9a63c
  Building wheel for pyvnc (pyproject.toml) ... done
  Created wheel for pyvnc: filename=pyVNC-0.1-py3-none-any.whl size=20856 sha256=f2aeb2cb7947664ed741902b0f2d57ac99501a0161a6998dbaa8c4793627f802
  Stored in directory: /tmp/pip-ephem-wheel-cache-p35y6ikg/wheels/78/27/30/426b889076fe069e33aaaf6bbc8d81642d903893924119b329
Successfully built empire-bc-security-fork pysecretsocks pyvnc
Failed to build donut-shellcode
ERROR: Could not build wheels for donut-shellcode, which is required to install pyproject.toml-based projects
ShutdownRepo commented 8 months ago

Here is what's raised when making (ARM64 arch as well)

rm -f loader.exe exe2h.exe exe2h loader32.exe loader64.exe donut.o hash.o encrypt.o format.o clib.o hash encrypt donut hash.exe encrypt.exe donut.exe lib/libdonut.a lib/libdonut.so
gcc -Wunused-function -Wall -fpack-struct=8 -DDONUT_EXE -I include donut.c hash.c encrypt.c format.c loader/clib.c lib/aplib64.a -odonut
format.c: In function ‘uuid_template’:
format.c:242:18: warning: pointer ‘p’ used after ‘realloc’ [-Wuse-after-free]
  242 |         memcpy(p + len, uuid_null, rem);
      |                ~~^~~~~
format.c:241:15: note: call to ‘realloc’ here
  241 |         pic = realloc(pic, len+rem);
      |               ^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: lib/aplib64.a(elfstubs.o): Relocations in generic ELF (EM: 62)
/usr/bin/ld: lib/aplib64.a: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make: *** [Makefile:2: donut] Error 1