I have to evaluate how difficult it would be to extract some object (e.g. java.security.PrivateKey
) from memory of a running java program.
I'm not very into this low level memory stuff, so I started out with small C programs and familiarized myself with gdb
, /proc/<pid>/maps
, /proc/<pid>/mem
and a script that dumps all the memory areas.
However, things change when switching to java. Memory is allocated and managed very differently with java thanks to garbage collection. In C programs I'd look at a stack address and know for certain that it contained the variable I wanted to extract.
So my questions are:
- Do Java objects have some kind of type ID so I can locate objects of that type in a memory dump?
- If so, how do I find out the ID of a type (e.g. what's the ID of a
String
)? - If there is no such type ID, what other possibilities would attackers have to extract, let's say, a
java.security.PrivateKey
from a java process?
Suppose that JMX is turned off.
Thanks for your help