BMAC
BMAC

Reputation: 141

Having issues compiling an exploit using GCC

I was trying to compile a C exploit for a security class I'm in and was struggling to get GCC to perform. The issue is that my /usr/include folder is missing folders that GCC is looking for to handle the includes of the file. The first error below describes a folder that doesn't exist.

asm/page.h: No such file or directory

What I've tried so far:

  1. Symlink it with my /usr/src/linux-headers-4.4.0-kali1-common/include/* folders, but files within that folder start throwing errors that they in turn can't find other files.
  2. Using GCC's -I parameter to manually specify each folder to look in for my includes but this also doesn't work. (Below)

gcc 10613.c -o workdamnit-I/usr/src/linux-headers-4.4.0-kali1-common/include/asm-generic/ -I/usr/src/linux-headers-4.4.0-kali1-common/include/linux/ -I/usr/src/linux-headers-4.4.0-kali1-common/include/uapi/asm-generic/ -I/usr/src/linux-headers-4.4.0-kali1-common/include/uapi/linux/

ERROR: In file included from /usr/include/stdio.h:33:0, from 10613.c:2: /usr/src/linux-headers-4.4.0-kali1-common/include/linux/stddef.h:4:31: fatal error: uapi/linux/stddef.h: No such file or directory compilation terminated.

  1. I updated the import statement to use page.h from my kali linux common headers. When I tried to run this, I received the below error:

    'PAGE_SIZE' undeclared (first use in this function).

  2. Lastly, I tried to compile with wine gcc but this particular exploit uses a socket library that I guess can't be compiled on a windows machine.

GCC version: 5.3.1 Link to exploit: https://www.exploit-db.com/exploits/10613/

My knowledge of C and its compilation requirements is very limited. Any assistance would be greatly appreciated.

Upvotes: 1

Views: 2686

Answers (1)

Taywee
Taywee

Reputation: 1335

Please give a usable and compilable example: https://stackoverflow.com/help/mcve

Based on the errors, it looks like -I/usr/src/linux-headers-4.4.0-kali1-common/include/uapi/linux/ should actually probably be -I/usr/src/linux-headers-4.4.0-kali1-common/include.

Upvotes: -2

Related Questions