Tag Info

New answers tagged

2

Yes, there certainly are circumstances that require programmers to hold security clearances. The most common is when working for directly for the federal government at any of a number of agencies including the Department of Defense, Department of State, FBI, NSA, and a number of others. In the private sector, you'll most commonly see clearance ...


-2

Isn't int secret=13123 a constant in local scope? You shouldn't be too taken up with what you're writing is anywhere close to being worthwhile to being read. In fact, I'd suggest, in a bit of contrarian advice, that you deliberately leave it readable. And further, populate it randomly with strings that are correlated in time, that are not called in the ...


1

Actually the answer is yes, you probably should overwrite it before deleting it. It you are a web-application developer then you should probably overwrite all data before using delete or free functions. Example of how this bug can be exploited: The user can insert some malicious data into input field. You proceed the data and then call free function of ...


0

There are two types of linking: static linking and dynamic linking. DLL Hijacking is when a malicious program takes advantage of dynamic linking. For dynamic linking to work there needs to be a list of paths to find the shared library that is being linked. In Windows there are various ways for the search path to be affected. But there is generally an ...


3

For a (hopefully interesting) addition to the rest of the answers, many people underestimate the difficulty in properly overwriting memory with C. I am going to be quoting heavily from Colin Percival's blog post titled "How to zero a buffer". The main problem facing naive attempts at overwriting memory in C is compiler optimizations. Most modern compilers ...


0

If you are good enough you don't really need a degree to work as a malware analyst. But chance is that in certain position for example, Data Scientist which relates to malware domain, you may need a research degree (for e.g: PhD in Computer Science) to secure that position. Unless you want to stick in the analyst position forever...


0

Simply ... ... don't compare strings, compare their hashes! Yes, I mean this for timeing safety (the side effect of password safety, left aside). What This Does When comparing hashes, you don't need to worry about following (which might not be obvious at first) The hashing process taking more time, for longer strings Why? The correct hash you are ...


3

The original example shows a stack variable because it's a native int type. Overwriting it is a good idea otherwise it lingers on the stack until overwritten by something else. I suspect if you are in C++ with heap objects or C native types allocated via pointers and malloc that it would be a good idea to Use volatile Use pragmas to surround the code ...


8

You need a threat model You should not even begin to think about overwriting security variables until you have a threat model describing what sorts of hacks you are trying to prevent. Security always comes at a cost. In this case, the cost is the development cost of teaching developers to maintain all of this extra code to secure the data. This cost ...


2

It is possible that the chunk of memory was paged out before you went and deleted it, depending on how the usage distribution in the page file plays out the data may live there forever. So to successfully remove the secret from the computer you must first ensure the data never reaches persistent memory by pinning the pages. Then ensure the compiler doesn't ...


3

It is important to overwrite sensitive data immediately after it is needed because, otherwise: The data stays on the stack until overwritten, and might be viewable with a frame overflow from a different procedure. The data is subject to memory scraping. Indeed, if you look at the source code for security-sensitive applications (e.g. openssh), you will ...


13

Yes, it is good practice security-wise to overwrite data that is particularly sensitive when the data is no longer necessary, i.e. as part of an object destructor (either an explicit destructor provided by the language or an action that the program takes before deallocating the object). It is even good practice to overwrite data that isn't in itself ...


32

Storing a value that isn't used again? Seems like something that would be optimized out, regardless of any benefit it might provide. Also, you may not actually overwrite the data in memory depending upon how the language itself works. For example, in a language using a garbage collector, it wouldn't be removed immediately (and this is assuming you didn't ...


58

Yes that is a good idea to overwrite then delete/release the value. Do not assume that all you have to do is "overwrite the data" or let it fall out of scope for the GC to handle, because each language interacts with the hardware differently. When securing a variable you might need to think about: encryption (in case of memory dumps or page caching) ...


0

Correct me if I'm wrong (in reply to Thomas, but also to generally answer the original question), but you should be able to strive towards leak free checks with your code. In this example, "known" is a known value, that has been pre-embedded into a buffer, I.e. If your known value is "qwerty", and you allow a maximum length of 64, then "qwerty" is ...



Top 50 recent answers are included