Cyber security

Elevation Station: Mastering Privilege Escalation with Advanced Token Manipulation Techniques

ElevationStation is a privilege escalation tool. It works by borrowing from commonly used escalation techniques involving manipulating/duplicating process and thread tokens.

Why reinvent the wheel with yet another privilege escalation utility?

This was a combined effort between avoiding AV alerts using Metasploit and furthering my research into privilege escalation methods using tokens. In brief: My main goal here was to learn about token management and manipulation, and to effectively bypass AV. I knew there were other tools out there to achieve privilege escalation using token manip but I wanted to learn for myself how it all works.

So…How does it work?

Looking through the terribly organized code, you’ll see I used two primary methods to get SYSTEM so far; stealing a Primary token from a SYSTEM level process, and stealing an Impersonation thread token to convert to a primary token from another SYSTEM level process. That’s the general approach at least.

CreateProcessAsUser versus CreateProcessWithToken

This was another driving force behind furthering my research. Unless one resorts to using named pipes for escalation, or inject a dll into a system level process, I couldn’t see an easy way to spawn a SYSTEM shell within the same console AND meet token privilege requirements.

Let me explain…

When using CreateProcessWithToken, it ALWAYS spawns a separate cmd shell. As best that I can tell, this “bug” is unavoidable. It is unfortunate, because CreateProcessWithToken doesn’t demand much as far as token privileges are concerned. Yet, if you want a shell with this Windows API you’re going to have to resort to dealing with a new SYSTEM shell in a separate window.

That leads us to CreateProcessAsUser. I knew this would spawn a shell within the current shell, but I needed to find a way to achieve this without resorting to using a windows service to meet the token privilege requirements, namely:

  • SE_ASSIGNPRIMARYTOKEN_NAME TEXT(“SeAssignPrimaryTokenPrivilege”)
  • SE_INCREASE_QUOTA_NAME TEXT(“SeIncreaseQuotaPrivilege”)

I found a way around that…stealing tokens from SYSTEM process threads 🙂 We duplicate the thread IMPERSONATION token, set the thread token, and then convert it to primary and then re-run our enable privileges function. This time, the enabling of the two privileges above succeeds and we are presented with a shell within the same console using CreateProcessAsUser. No dll injections, no named pipe impersonations, just token manipulation/duplication.

Progress

This has come a long way so far…and I’ll keep adding to it and cleaning up the code as time permits me to do so. Thanks for all the support and testing!

For More Click Here

Tamil S

Tamil has a great interest in the fields of Cyber Security, OSINT, and CTF projects. Currently, he is deeply involved in researching and publishing various security tools with Kali Linux Tutorials, which is quite fascinating.

Recent Posts

Facebook Friend List Scraper – A Powerful OSINT Tool For Efficient Data Collection

OSINT tool to scrape names and usernames from large friend lists on Facebook, without being…

23 hours ago

Telepathy – Mastering Telegram OSINT For Enhanced Digital Investigations

Telepathy has been described as the "swiss army knife of Telegram tools," allowing OSINT analysts,…

23 hours ago

Blackbird – The Advanced OSINT Tool For Digital Investigations

Blackbird is a robust OSINT tool that facilitates rapid searches for user accounts by username…

23 hours ago

Natudump – Automating The Extraction Of Naturalisation Decrees From LegiFrance

This is example of scraping public LegiFrance registry's naturalisation decrees for research purposes only (naturalisation…

23 hours ago

Sabonis – The Ultimate Tool For Enhanced Digital Forensics And Incident Response

Sabonis provides a way of quickly parsing EVTX, proxy and PCAP files and extracting just…

23 hours ago

AutoExif – Simplifying Image Metadata Editing With Bash

AutoExif is a powerful Bash script designed to streamline the process of editing image metadata…

4 days ago