What's the risk of deploying debug symbols (pdb file) in a production environment?
Solution 1:
Here is another question to look at:
Are there any security issues leaving the PDB debug files on the live servers?
And more info on PDB files:
PDB Files: What Every Developer Must Know
In general, I always include pdb files in my deployments, the gains are too huge to ignore.
If you never expose a stack trace to your users (and generally you shouldn't), there isn't really any additional security risk of deploying PDB files.
When a user visible stack trace happens, the user can see the full stack trace including your file name and file line numbers. This could give them some idea of how your app is architected which would potentially help them if hacking.
A bigger security threat is something like Reflector which when used on your DLLs will allow them to view your source code, with or without pdb files.
Solution 2:
If you're deploying to a production environement in your own organization, then it's not a security problem.
If you're selling your software to other entities, then .pdb file can give someone interested in reverse engineering a leg up - that may or may not be a problem for you.
However (to be clear), you don't want your stack traces being displayed to the client - whether or not the .pdbs are available. But if you're just logging the traces and presenting a 'pretty' error page to the client, it's not an issue.
Solution 3:
By having debugging symbols, an attacker can determine global variables, function offsets, etc., of interest.
So he could see your system has a function like:
AddAdminUser(string name, string password);
And know its offset. If your program is compromised, he could call this function to give himself admin privileges.
Or something like:
typedef enum {Basic, NTLM} AuthenticationMode;
AuthenticationMode g_authenticationMode;
And knows what bit to flip to switch your application into an insecure mode.
Alternatively, this would take quite a bit of reverse engineering time to figure out. Not an insurmountable amount of time, however.
But . . . this all implies your attacker is already in a position where he can compromise your program. If that's the case, you already lost.
If you have a good business reason to deploy pdb symbols, go ahead. Deploying PDB's won't make you insecure. If you don't have a good reason to deploy, you shouldn't do this as it will make attacks slightly easier.
You can also create public PDB files - these strip certain pieces of information, but give you enough symbols to generate a stack trace and do basic debugging. Details are here. Microsoft deploys public PDB's on its symbol server for all to use.
EDIT: Most of what I said applies to the concerns around deploying PDB's for native code - I think a lot of these concerns people carry over to .NET as well, even though assembly metadata conveys quite a bit of this already.
Solution 4:
Somebody can "restore" the complete source code of your application. If it is Open Source you do not need to worry. If it has some IP (algorithms, protection, licenses), it is probably not a good idea.
It is true that tools like Reflector can reconstruct parts of your code even without PDB files, but obfuscations can help (well, just a little bit).