4 ms·
If anything, it's a bug in the language design: If the client is written in C or C++, a wild pointer could potentially point to any data in the process's memory
by derleth 13y ago
If anything, it's a bug in the language design: If the client is written in C or C++, a wild pointer could potentially point to any data in the process's memory space, including sensitive key information, and from there it's a small step to revealing that information in a core dump or similar. (Or, you know, printing it to stdout because something hinky was passed in to printf.)
The solution is to make everyone only write code in languages which use a runtime that controls memory access better than the OS can. Python or Java, for example. Failing that, relying on the OS is the safest way, and the simplest, most secure way to do that is to keep GPG in its own process.
- eugenejen 13y agoso as a digression, which language do you think has a runtime that controls memory access better than OS? I wonder can a language like Rust and Golang meet that criteria?
- derleth 13y ago> so as a digression, which language do you think has a runtime that controls memory access better than OS? I mentioned two: Python and Java. In general, I mean any language where the runtime only hands programs valid pointers and the language doesn't allow pointer arithmetic. This means it's possible to guarantee that pointers will only point into objects that can be validly accessed by the code which holds those pointers. This is generally done to make garbage collection easier, but it can be done to implement security policy: Basically, if your security policy trusts a given runtime, you can use that runtime to enforce access policies on objects of all kinds, including memory.
- eugenejen 13y agoI misread you sentences. I thought you meant Python and Java fails memory management than OS. That caused me to ask the question. Thank you for getting back to me.