wietze / windows-dll-hijacking

Project for identifying executables and DLLs vulnerable to relative path DLL hijacking.
GNU General Public License v3.0
438 stars 73 forks source link

Unable to compile dll files #6

Closed Sidhy closed 5 months ago

Sidhy commented 5 months ago

Hi,

I attempted to test this on my system for learning purposes but for some reason I am not able to build the evil DLL's As you already are aware the docker image is offline but I attempted to compile one of the files manually.

Any suggestions or clarification why the below will fail?

Compile command:"

$ x86_64-w64-mingw32-gcc -shared -mwindows -o winmm.dll winmm.dll.c winmm.dll.def

Errors:

winmm.dll.c:64:7: error: conflicting types for ‘mmioSeek’; have ‘void *()’
   64 | VOID *mmioSeek(){ generate_fingerprint(__func__); }
      |       ^~~~~~~~
In file included from /usr/share/mingw-w64/include/mmsystem.h:26,
                 from /usr/share/mingw-w64/include/windows.h:86,
                 from winmm.dll.c:1:
/usr/share/mingw-w64/include/mmiscapi.h:222:22: note: previous declaration of ‘mmioSeek’ with type ‘LONG(struct HMMIO__ *, LONG,  int)’ {aka ‘long int(struct HMMIO__ *, long int,  int)’}
  222 | WINMMAPI LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, int iOrigin);
      |                      ^~~~~~~~
winmm.dll.c:65:7: error: conflicting types for ‘midiInGetID’; have ‘void *()’
   65 | VOID *midiInGetID(){ generate_fingerprint(__func__); }
      |       ^~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/mmsystem.h:29:
/usr/share/mingw-w64/include/mmeapi.h:609:26: note: previous declaration of ‘midiInGetID’ with type ‘MMRESULT(struct HMIDIIN__ *, UINT *)’ {aka ‘unsigned int(struct HMIDIIN__ *, unsigned int *)’}
  609 | WINMMAPI MMRESULT WINAPI midiInGetID(HMIDIIN hmi, LPUINT puDeviceID);
      |                          ^~~~~~~~~~~
winmm.dll.c:66:7: error: conflicting types for ‘mciFreeCommandResource’; have ‘void *()’
   66 | VOID *mciFreeCommandResource(){ generate_fingerprint(__func__); }
      |       ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/mingw-w64/include/mmsystem.h:23:
/usr/share/mingw-w64/include/mciapi.h:868:18: note: previous declaration of ‘mciFreeCommandResource’ with type ‘WINBOOL(UINT)’ {aka ‘int(unsigned int)’}
  868 | WINBOOL APIENTRY mciFreeCommandResource(UINT wTable);
      |                  ^~~~~~~~~~~~~~~~~~~~~~
winmm.dll.c:67:7: error: conflicting types for ‘midiInGetErrorTextW’; have ‘void *()’
   67 | VOID *midiInGetErrorTextW(){ generate_fingerprint(__func__); }
      |       ^~~~~~~~~~~~~~~~~~~
/usr/share/mingw-w64/include/mmeapi.h:598:26: note: previous declaration of ‘midiInGetErrorTextW’ with type ‘MMRESULT(MMRESULT,  WCHAR *, UINT)’ {aka ‘unsigned int(unsigned int,  short unsigned int *, unsigned int)’}
  598 | WINMMAPI MMRESULT WINAPI midiInGetErrorTextW(MMRESULT mmrError, LPWSTR pszText, UINT cchText);
wietze commented 5 months ago

Hi @Sidhy , thanks for checking out this project and taking the time to open an issue for the errors you are encountering.

I have just pushed an update that includes a custom Docker image, that ensures the right tools, versions and dependencies are installed.

To make things clearer, there have also been minor updates to the README files.

Should you still encounter issues, please let me know!