After I see some examples of shellcodes in various exploit examples they try to spawn a shell.
I want to understand why after spawn the shell have privileged access?
Doesn't the shell should have the same privileges as the user running the process?
Information Security Stack Exchange is a question and answer site for information security professionals. It only takes a minute to sign up.Sign up to join this community
Well, what to say except that you are fully right?
The spawn shell will have the exact same privileges as the process from which it is spawned, no more, but no less either. All the interest is here: the greater privileges the vulnerable application has, the greater privileges your spawned shell will have.
However, once you have a shell running on the machine, nothing prevents you from trying to run local privilege escalation exploits. But this will be done at a second step: