280 likes | 948 Views
Privilege Escalation. Two case studies. Privilege Escalation. To better understand how privilege escalation can work, we will look at two relatively recent examples . Both cases impacted all recent versions of the Windows family of operating systems. Case 1.
E N D
Privilege Escalation Two case studies
Privilege Escalation • To better understand how privilege escalation can work, we will look at two relatively recent examples. • Both cases impacted all recent versions of the Windows family of operating systems.
Case 1 • The first case is the Windows Task Scheduler vulnerability. • This exploit affected all versions of Windows from Vista onwards. • Includes the server operating systems. • A real zero day exploit.
Task Scheduler • The exploit takes advantage of the changes made to the Windows task scheduler. • As of Vista, scheduled task config files are stored as XML files in c:\Windows\system32\tasks\ • Authenticated users have RW access to this folder and can edit their own tasks.
Modification • What stops users from elevating the context of their jobs? • Jobs are configured within the XML file to run as the user who created them in the case of non-admins. • A CRC32 check ensures that the XML config files are not modified after creation.
What’s the problem? • CRC can catch accidental modification. • Intentional changes can be introduced that do not change the CRC. • A config file can be changed to elevate rights and then a properly constructed XML comment can be appended to the end of the file so that the CRC checks out ok.
Method • Create a task as a standard user that will create a new user and add it to administrators. • Modify the XML config to run as System. • Calculate the end string needed to give the modified file the same CRC32 result as the original task. • Append the end string to the file. • Let it run. A new admin account is created.
In the wild • This exploit was one of two exploits used by Stuxnet to elevate privileges. • This zero day was found to be present in all recent Microsoft operating systems and may have been actively used for years.
The fix is in • A patch was implemented in late 2010. • A new layer of checking was done to rule out intentional modification. • A SHA256 hash was added on top of the CRC32, effectively preventing undetected modification.
Case Study 2 • The second case is the sysret bug. • Security researchers discovered this flaw in Intel’s implementation of AMD’s sysret operation that allows for privilege escalation. • This impacted all Intel 64 bit architectures running AMD compiled code.
What’s sysret? • Sysret is AMD’s 64 bit method of context switching between kernel and user levels or hypervisor and guest OSes. • The AMD implementation is secure. • Intel supported the AMD spec in a way that allowed a bad return address to be pushed into the return stack pointer in kernel mode.
Why is this bad? • The bad address would be caught but within the context of the kernel or hypervisor, instead of the normal user level. • A protection fault would be triggered in an elevated state, leaving the process that triggered the fault with elevated status. • Attaching the running program to a process such as Explorer would give the logged in user kernel rights.
Extent of the problem • All 64 bit Windows operating systems were impacted. • Xen, FreeBSD and NetBSD were also vulnerable. • Linux and OpenBSD had both patched the issue prior to its discovery. • Linux developers patched their OS 6 years prior but described the patch in such a way that no one noticed it might apply to other OSes. • Only a problem on Intel hardware.
Reactions • Open source OSes were quick to release patches. • Microsoft took 3 months to release a patch. • Intel affirmed that the behaviour of its implementation of sysret is well documented and that it is up to the OS developers to handle it properly.
In the wild? • Despite the fact the weakness had existed for at least 6 years prior to its discovery there were no known exploits associated with this bug. • Microsoft released a patch in mid-June of 2012. • Only systems that do not participate in automatic updates are considered at risk.
StuxnetExploit References http://www.eset.com/us/resources/white-papers/Stuxnet_Under_the_Microscope.pdf http://vishnuvalentino.com/tips-and-trick/privilege-escalation-from-guest-to-administrator-windows7-windows2008/ http://technet.microsoft.com/en-us/security/bulletin/ms10-092
Sysret Exploit References http://blog.xen.org/index.php/2012/06/13/the-intel-sysret-privilege-escalation/ http://blog.xen.org/index.php/2012/06/13/the-intel-sysret-privilege-escalation/ http://technet.microsoft.com/en-us/security/bulletin/MS12-042