Skip to content

Payload Compilation Failure on Kali Linux ARM64 (mingw-w64) #563

@KaOs-12

Description

@KaOs-12

Hello,

I am unable to compile any Demon payload on a clean installation of Kali Linux on an ARM64 (aarch64) device. The compilation consistently fails with multiple C-level errors related to pointer types, integer conversions, and implicit function declarations.

Environment:

  • OS:
    PRETTY_NAME="Kali GNU/Linux Rolling"
    NAME="Kali GNU/Linux"
    VERSION_ID="2025.2"
    VERSION="2025.2"
    VERSION_CODENAME=kali-rolling
    ID=kali
    ID_LIKE=debian
    
  • Kernel:
    Linux kali 6.12.33+kali-arm64 #1 SMP Kali 6.12.33-1kali1 (2025-06-25) aarch64 GNU/Linux
    
  • Compiler Version:
    x86_64-w64-mingw32-gcc (GCC) 14-win32
    
  • Havoc Version: Latest main branch (also tested v0.7 archive with the same results).

Troubleshooting Steps Taken:

I have already performed extensive troubleshooting, including:

  1. Ensuring all system dependencies are installed and up-to-date.
  2. Performing a fresh git clone of the repository.
  3. Attempting to compile the v0.7 release from a direct ZIP download.
  4. Completely purging and reinstalling the mingw-w64 toolchain.
  5. Manually patching payloads/Demon/include/core/MiniStd.h to add (PBYTE) casts to MemSet and MemZero macros. This successfully fixed the initial batch of errors.
  6. Manually editing payloads/Demon/CMakeLists.txt to add compiler flags (-Wno-incompatible-pointer-types, etc.) to suppress warnings.

Even after all these steps, the compilation still fails with the following errors.

Final Compile Output:

src/core/Command.c: In functionCommandProcList’:
src/core/Command.c:618:64: error: passing argument 2 ofPackageAddBytesfrom incompatible pointer type [-Wincompatible-pointer-types]
618 | PackageAddBytes( Package, SysProcessInfo->ImageName.Buffer, SysProcessInfo->ImageName.Length );
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
| |
| PWSTR {aka short unsigned int *}
In file included from include/Demon.h:20,
from src/core/Command.c:1:
include/core/Package.h:53:11: note: expectedPBYTE’ {aka ‘unsigned char *’} but argument is of typePWSTR’ {aka ‘short unsigned int *’}
53 | PBYTE data,
| ~~~~~~^~~~
src/core/Command.c: In functionCommandFS’:
src/core/Command.c:700:45: error: initialization ofUINT32’ {aka ‘unsigned int’} fromvoid *makes integer from pointer without a cast [-Wint-conversion]
700 | UINT32 PathSize = NULL;
| ^~~~
src/core/Command.c: In functionCommandInjectShellcode’:
src/core/Command.c:1289:39: error: passing argument 2 ofParserGetBytesfrom incompatible pointer type [-Wincompatible-pointer-types]
1289 | Payload = ParserGetBytes( Parser, &Size );
| ^~~~~
| |
| DWORD * {aka long unsigned int *}
In file included from include/core/Command.h:4,
from include/core/Package.h:4:
include/core/Parser.h:23:48: note: expectedPUINT32’ {aka ‘unsigned int *’} but argument is of typeDWORD *’ {aka ‘long unsigned int *’}
23 | PBYTE ParserGetBytes( PPARSER parser, PUINT32 size );
| ~~~~~~~~^~~~
src/core/Command.c:1290:39: error: passing argument 2 ofParserGetBytesfrom incompatible pointer type [-Wincompatible-pointer-types]
1290 | Argv = ParserGetBytes( Parser, &Argc );
| ^~~~~
| |
| DWORD * {aka long unsigned int *}
include/core/Parser.h:23:48: note: expectedPUINT32’ {aka ‘unsigned int *’} but argument is of typeDWORD *’ {aka ‘long unsigned int *’}
23 | PBYTE ParserGetBytes( PPARSER parser, PUINT32 size );
| ~~~~~~~~^~~~
src/core/Command.c: In functionCommandToken’:
src/core/Command.c:1393:53: error: passing argument 2 ofPackageAddStringfrom incompatible pointer type [-Wincompatible-pointer-types]
1393 | PackageAddString( Package, TokenData->DomainUser );
| ~~~~~~~~~^~~~~~~~~~~~
| |
| LPWSTR {aka short unsigned int *}
include/core/Package.h:59:11: note: expectedPCHAR’ {akachar *’} but argument is of typeLPWSTR’ {aka ‘short unsigned int *’}
59 | PCHAR data
| ~~~~~~^~~~
src/core/Command.c:1562:48: error: passing argument 2 ofStringConcatWfrom incompatible pointer type [-Wincompatible-pointer-types]
1562 | StringConcatW( UserDomain, Deli );
| ^~~~
| |
| CHAR * {aka char *}
In file included from src/core/Command.c:8:
include/core/MiniStd.h:20:45: note: expectedPWCHAR’ {aka ‘short unsigned int *’} but argument is of typeCHAR *’ {akachar *’}
20 | PWCHAR StringConcatW(PWCHAR String, PWCHAR String2);
| ~~~~~~~^~~~~~~
src/core/Command.c: In functionCommandAssemblyListVersion’:
src/core/Command.c:1799:10: error: implicit declaration of functionRtMscoree’ [-Wimplicit-function-declaration]
1799 | if ( RtMscoree() )
| ^~~~~~~~~
src/core/Command.c: In functionCommandExit’:
src/core/Command.c:3472:15: error: assignment toSIZE_T’ {aka ‘long long unsigned int’} fromvoid *makes integer from pointer without a cast [-Wint-conversion]
3472 | ImageSize = NULL;
| ^
src/core/ObjectApi.c: In functionBeaconSpawnTemporaryProcess’:
src/core/ObjectApi.c:477:111: error: passing argument 9 ofInstance->Win32.CreateProcessWfrom incompatible pointer type [-Wincompatible-pointer-types]
477 | bSuccess = Instance->Win32.CreateProcessW(NULL, Path, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, sInfo, pInfo);
| ^~~~~
| |
| STARTUPINFO * {aka STARTUPINFOA *}
src/core/ObjectApi.c:477:111: note: expectedLPSTARTUPINFOW’ {akastruct _STARTUPINFOW *’} but argument is of typeSTARTUPINFO *’ {akaSTARTUPINFOA *’}
src/core/ObjectApi.c:481:140: error: passing argument 8 ofInstance->Win32.CreateProcessWithTokenWfrom incompatible pointer type [-Wincompatible-pointer-types]
481 | bSuccess = Instance->Win32.CreateProcessWithTokenW(hToken, LOGON_WITH_PROFILE, NULL, Path, CREATE_UNICODE_ENVIRONMENT, NULL, NULL, sInfo, pInfo);
| ^~~~~
| |
| STARTUPINFO * {aka STARTUPINFOA *}
src/core/ObjectApi.c:481:140: note: expectedLPSTARTUPINFOW’ {akastruct _STARTUPINFOW *’} but argument is of typeSTARTUPINFO *’ {akaSTARTUPINFOA *’}
src/core/Socket.c: In functionSocketNew’:
src/core/Socket.c:78:95: error: passing argument 6 ofInstance->Win32.WSASocketAmakes integer from pointer without a cast [-Wint-conversion]
78 | WinSock = Instance->Win32.WSASocketA( AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, NULL );
| ^~~~
| |
| void *
src/core/Socket.c:78:95: note: expectedDWORD’ {aka ‘long unsigned int’} but argument is of typevoid *src/core/Socket.c: In functionSocketRead’:
src/core/Socket.c:323:77: error: passing argument 3 ofInstance->Win32.ioctlsocketfrom incompatible pointer type [-Wincompatible-pointer-types]
323 | if ( Instance->Win32.ioctlsocket( Socket->Socket, FIONREAD, &PartialData.Length ) == SOCKET_ERROR )
| ^~~~~~~~~~~~~~~~~~~
| |
| UINT32 * {aka unsigned int *}
src/core/Socket.c:323:77: note: expectedu_long *’ {aka ‘long unsigned int *’} but argument is of typeUINT32 *’ {aka ‘unsigned int *’}
src/core/Socket.c:338:93: error: passing argument 4 ofRecvAllfrom incompatible pointer type [-Wincompatible-pointer-types]
338 | if ( ! RecvAll( Socket->Socket, PartialData.Buffer, PartialData.Length, &PartialData.Length ) ) {
| ^~~~~~~~~~~~~~~~~~~
| |
| UINT32 * {aka unsigned int *}
src/core/Socket.c:7:65: note: expectedPDWORD’ {aka ‘long unsigned int *’} but argument is of typeUINT32 *’ {aka ‘unsigned int *’}
7 | BOOL RecvAll( SOCKET Socket, PVOID Buffer, DWORD Length, PDWORD BytesRead )
| ~~~~~~~^~~~~~~~~
src/core/Syscalls.c: In functionFindSsnOfHookedSyscall’:
src/core/Syscalls.c:207:31: error: initialization ofWORD’ {aka ‘short unsigned int’} fromvoid *makes integer from pointer without a cast [-Wint-conversion]
207 | WORD NeighbourSsn = NULL;
| ^~~~
src/core/Token.c: In functionProcessUserToken’:
src/core/Token.c:846:10: error: implicit declaration of functionGetTokenInfo’; did you meanGetIconInfo’? [-Wimplicit-function-declaration]
846 | if ( GetTokenInfo( hToken, &TokenType, &Integrity, &ImpersonationLevel, &UserDomain ) )
| ^~~~~~~~~~~~
| GetIconInfo
src/core/Token.c:854:18: error: implicit declaration of functionIsNotCurrentUser’; did you meanNtCurrentPeb’? [-Wimplicit-function-declaration]
854 | if ( IsNotCurrentUser( CheckUsername, CurrentUser, &UserDomain ) )
| ^~~~~~~~~~~~~~~~
| NtCurrentPeb
src/core/Win32.c: In functionLdrModuleSearch’:
src/core/Win32.c:179:16: error: assignment toPLDR_DATA_TABLE_ENTRY’ {akastruct _LDR_DATA_TABLE_ENTRY *’} from incompatible pointer typestruct _LIST_ENTRY *’ [-Wincompatible-pointer-types]
179 | Entry = Instance->Teb->ProcessEnvironmentBlock->Ldr->InLoadOrderModuleList.Flink;
| ^
src/core/Win32.c:184:12: error: implicit declaration of functionEndsWithIW’ [-Wimplicit-function-declaration]
184 | if ( ! EndsWithIW( ModuleName, Dll ) )
| ^~~~~~~~~~
src/core/Win32.c:193:16: error: implicit declaration of functionStringCompareIW’; did you meanStringNCompareIW’? [-Wimplicit-function-declaration]
193 | if ( ! StringCompareIW( Name, Entry->BaseDllName.Buffer ) ) {
| ^~~~~~~~~~~~~~~
| StringNCompareIW
src/core/Win32.c:197:15: error: assignment toPLDR_DATA_TABLE_ENTRY’ {akastruct _LDR_DATA_TABLE_ENTRY *’} from incompatible pointer typestruct _LIST_ENTRY *’ [-Wincompatible-pointer-types]
197 | Entry = Entry->InLoadOrderLinks.Flink;
| ^
src/core/Win32.c: In functionlistDir’:
src/core/Win32.c:1503:38: error: initialization ofUINT32’ {aka ‘unsigned int’} fromvoid *makes integer from pointer without a cast [-Wint-conversion]
1503 | UINT32 PathSize = NULL;
| ^~~~
src/inject/InjectUtil.c: In functionGetReflectiveLoaderOffset’:
src/inject/InjectUtil.c:47:147: error: passing argument 2 ofRva2Offsetmakes integer from pointer without a cast [-Wint-conversion]
47 | ExportDir = ReflectiveLdrAddr + Rva2Offset( NtHeaders->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ].VirtualAddress, ReflectiveLdrAddr );
| ^~~~~~~~~~~~~~~~~
| |
| PVOID {aka void *}
src/inject/InjectUtil.c:12:41: note: expectedUINT_PTR’ {aka ‘long long unsigned int’} but argument is of typePVOID’ {akavoid *’}
12 | DWORD Rva2Offset( DWORD dwRva, UINT_PTR uiBaseAddress )
| ~~~~~~~~~^~~~~~~~~~~~~
src/inject/InjectUtil.c:48:86: error: passing argument 2 ofRva2Offsetmakes integer from pointer without a cast [-Wint-conversion]
48 | AddrOfNames = ReflectiveLdrAddr + Rva2Offset( ExportDir->AddressOfNames, ReflectiveLdrAddr );
| ^~~~~~~~~~~~~~~~~
| |
| PVOID {aka void *}
src/inject/InjectUtil.c:12:41: note: expectedUINT_PTR’ {aka ‘long long unsigned int’} but argument is of typePVOID’ {akavoid *’}
12 | DWORD Rva2Offset( DWORD dwRva, UINT_PTR uiBaseAddress )
| ~~~~~~~~~^~~~~~~~~~~~~
src/inject/InjectUtil.c:48:25: error: assignment toUINT_PTR’ {aka ‘long long unsigned int’} fromPVOID’ {akavoid *’} makes integer from pointer without a cast [-Wint-conversion]
48 | AddrOfNames = ReflectiveLdrAddr + Rva2Offset( ExportDir->AddressOfNames, ReflectiveLdrAddr );
| ^
src/inject/InjectUtil.c:49:93: error: passing argument 2 ofRva2Offsetmakes integer from pointer without a cast [-Wint-conversion]
49 | AddrOfNameOrdinals = ReflectiveLdrAddr + Rva2Offset( ExportDir->AddressOfNameOrdinals, ReflectiveLdrAddr );
| ^~~~~~~~~~~~~~~~~
| |
| PVOID {aka void *}
src/inject/InjectUtil.c:12:41: note: expectedUINT_PTR’ {aka ‘long long unsigned int’} but argument is of typePVOID’ {akavoid *’}
12 | DWORD Rva2Offset( DWORD dwRva, UINT_PTR uiBaseAddress )
| ~~~~~~~~~^~~~~~~~~~~~~
src/inject/InjectUtil.c:49:25: error: assignment toUINT_PTR’ {aka ‘long long unsigned int’} fromPVOID’ {akavoid *’} makes integer from pointer without a cast [-Wint-conversion]
49 | AddrOfNameOrdinals = ReflectiveLdrAddr + Rva2Offset( ExportDir->AddressOfNameOrdinals, ReflectiveLdrAddr );
| ^
src/inject/InjectUtil.c:54:92: error: passing argument 2 ofRva2Offsetmakes integer from pointer without a cast [-Wint-conversion]
54 | FunctionName = ( PCHAR )( ReflectiveLdrAddr + Rva2Offset( DEREF_32( AddrOfNames ), ReflectiveLdrAddr ) );
| ^~~~~~~~~~~~~~~~~
| |
| PVOID {aka void *}
src/inject/InjectUtil.c:12:41: note: expectedUINT_PTR’ {aka ‘long long unsigned int’} but argument is of typePVOID’ {akavoid *’}
12 | DWORD Rva2Offset( DWORD dwRva, UINT_PTR uiBaseAddress )
| ~~~~~~~~~^~~~~~~~~~~~~
src/inject/InjectUtil.c:59:96: error: passing argument 2 ofRva2Offsetmakes integer from pointer without a cast [-Wint-conversion]
59 | AddrOfFunctions = ReflectiveLdrAddr + Rva2Offset( ExportDir->AddressOfFunctions, ReflectiveLdrAddr );
| ^~~~~~~~~~~~~~~~~
| |
| PVOID {aka void *}
src/inject/InjectUtil.c:12:41: note: expectedUINT_PTR’ {aka ‘long long unsigned int’} but argument is of typePVOID’ {akavoid *’}
12 | DWORD Rva2Offset( DWORD dwRva, UINT_PTR uiBaseAddress )
| ~~~~~~~~~^~~~~~~~~~~~~
src/inject/InjectUtil.c:59:29: error: assignment toUINT_PTR’ {aka ‘long long unsigned int’} fromPVOID’ {akavoid *’} makes integer from pointer without a cast [-Wint-conversion]
59 | AddrOfFunctions = ReflectiveLdrAddr + Rva2Offset( ExportDir->AddressOfFunctions, ReflectiveLdrAddr );
| ^
src/inject/InjectUtil.c:62:61: error: passing argument 2 ofRva2Offsetmakes integer from pointer without a cast [-Wint-conversion]
62 | return Rva2Offset( DEREF_32( AddrOfFunctions ), ReflectiveLdrAddr );
| ^~~~~~~~~~~~~~~~~
| |
| PVOID {aka void *}
src/inject/InjectUtil.c:12:41: note: expectedUINT_PTR’ {aka ‘long long unsigned int’} but argument is of typePVOID’ {akavoid *’}
12 | DWORD Rva2Offset( DWORD dwRva, UINT_PTR uiBaseAddress )
| ~~~~~~~~~^~~~~~~~~~~~~
src/Demon.c: In functionDemonMetaData’:
src/Demon.c:253:36: error: passing argument 1 ofInstance->Win32.RtlGetVersionfrom incompatible pointer type [-Wincompatible-pointer-types]
253 | Instance->Win32.RtlGetVersion( &OsVersions );
| ^~~~~~~~~~~
| |
| OSVERSIONINFOEXW *
src/Demon.c:253:36: note: expectedPRTL_OSVERSIONINFOWbut argument is of typeOSVERSIONINFOEXW *In file included from include/Demon.h:11,
from src/Demon.c:1:
src/Demon.c: In functionDemonInit’:
src/Demon.c:371:53: error: passing argument 1 ofInstance->Win32.RtlGetVersionfrom incompatible pointer type [-Wincompatible-pointer-types]
371 | if ( NT_SUCCESS( Instance->Win32.RtlGetVersion( &OSVersionExW ) ) ) {
| ^~~~~~~~~~~~~
| |
| OSVERSIONINFOEXW *
include/common/Macros.h:12:60: note: in definition of macroNT_SUCCESS12 | #define NT_SUCCESS(Status) ( ( ( NTSTATUS ) ( Status ) ) >= 0 )
| ^~~~~~
src/Demon.c:371:53: note: expectedPRTL_OSVERSIONINFOWbut argument is of typeOSVERSIONINFOEXW *371 | if ( NT_SUCCESS( Instance->Win32.RtlGetVersion( &OSVersionExW ) ) ) {
| ^~~~~~~~~~~~~
include/common/Macros.h:12:60: note: in definition of macroNT_SUCCESS12 | #define NT_SUCCESS(Status) ( ( ( NTSTATUS ) ( Status ) ) >= 0 )
| ^~~~~~

It seems the codebase has a fundamental incompatibility with the current mingw-w64 toolchain on the aarch64 platform. Any help would be greatly appreciated.

Thank you for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions