0

I would like to know if there is any information that can identify a computer or a person that compiled a program (let's talk only about c++ on visual studio, windows , with no particular library). How can i say, by looking at an executable, which entity has produced it ?

3
  • Every .exe file has a description. In visual studio the author can change this description, and maybe put some informations that you need in it, like the author's name. Check this superuser.com/questions/1060460/…
    – Thelouras
    Feb 13 '19 at 16:16
  • It depends, some constants/predefined macros used in C/C++ like __FILE__ may include path information that has things like a username/domain. You would have to open the file in a binary/hex editor to see the ASCII data.
    – Ron Beyer
    Feb 13 '19 at 16:55
  • Note that reproducible builds will actively seek to prevent this, since any such information would change the output of the build. Also, even if there is such information, it may not be usable - if (for whatever bizarre reason) the compiler includes the MAC address of the network card, you will have almost no way to trace the MAC back to a physical person. Why are you asking? What is it you're really trying to find out here? Feb 13 '19 at 21:42
0

From an inspection of an executable compiled with Visual Studio 2010, it doesn't appear that the compiler, by default, includes any identifiable information about the user who ran the compilation or the host it was run on.

It may be possible to determine exactly which version of the compiler was used by looking at the executable. The GNU compiler puts the compiler's exact version-string in its output.

For "managed" executables, Visual Studio does allow various metadata like author and copyright to be specified; but it would require some sort of customization or build-script to put build-user or build-host information in the executable.

It's certainly possible to use a build-script and the source-code itself to make sure that such identifying information is in the program. For example, if you compile the following program with gcc -Wall -D USER=$USER -o build/q203507.exe src/q203507.c, it will include the building user's user ID as a string in the executable:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#ifndef USER
#error please define USER in compile command
#endif

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

const char * sourceFilename = __FILE__ ;
const char * compilingUser  = TOSTRING(USER) ;

int main(int argc, char **argv)
{
  if (fopen(sourceFilename, "r")) {
    printf("%s\n", "You still have the source-code for this program.");
  }
  if (0 == strcmp(getenv("USER"), compilingUser)) {
    printf("%s\n", "You compiled this program.");
  }
  return 0;
}
1
  • This isn't strictly true; paths are commonly included in the debug metadata section and may reveal both the fully-qualified path of the PDB itself as well as the path of source files. These may contain the username (e.g. C:\Users\david\Documents\Visual Studio 2010\Projects\foo\bin\Release\foo.pdb)
    – Polynomial
    Feb 18 '19 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.