I'm trying to get myself into more Android development lately and I have been curious about how rooting is done under the hood. Ideally, I would like to develop something myself that will root a phone, even if it's just one phone for now.
I have rooted all Android phones I have and have a good understanding of how it works and also what to do. I am also very familiar with Linux and most of the concepts behind it. What I have been unable to find is how tools like SuperOneClick or the Galaxy Nexus Toolkit are created and what they do under the hood to give you root access.
What actually needs to be done at the programming level to gain root access? How would I go about making my own application/package to do this? Is this only obtainable through the use of exploits?