A Guide to Kernel Exploitation: Attacking the Core by Perla Enrico & Oldani Massimiliano
Author:Perla, Enrico & Oldani, Massimiliano [Perla, Enrico]
Language: eng
Format: mobi, epub, pdf
ISBN: 9781597494861
Publisher: Elsevier Science
Published: 2010-10-27T22:00:00+00:00
It is also possible to query the state of all the kernel extensions mapped into the kernel as an unprivileged user, as well as their load address, size, and other useful information. You can do this either by using the kextstat command-line utility that dumps each kernel extension in a readable format (as shown in the following code), or by using the Mach kmod_get_info() API to programmatically query the same information.
Index Refs Address Size Wired Name (Version) <Linked Against>
12 19 0x0 0x0 0x0 com.apple.kernel.6.0 (7.9.9)
13 1 0x0 0x0 0x0 com.apple.kernel.bsd (7.9.9)
14 1 0x0 0x0 0x0 com.apple.kernel.iokit (7.9.9)
15 1 0x0 0x0 0x0 com.apple.kernel.libkern (7.9.9)
16 1 0x0 0x0 0x0 com.apple.kernel.mach (7.9.9)
17 18 0x5ce000 0x11000 0x10000 com.apple.iokit.IOPCIFamily (2.6) <7 6 5
The Mach interface to query this information is pretty straightforward and can be useful for automating the process inside an exploit. It is just a matter of calling the kmod_get_info() function and passing in the address of a kmod_info struct pointer. This pointer is then updated to a freshly allocated list of kmods on the system. Here is a snippet of code that prints output similar to the kextstat program. As usual, the code in its entirety is available online at www.attackingthecore.com.
int
main (int ac, char **av)
{
mach_port_t task;
kmod_info_t *kmods;
unsigned int nokexts;
task = mach_host_self();
if ((kmod_get_info (task, (void *) &kmods, &nokexts) != KERN_SUCCESS)){
printf("error: could not retrieve list of kexts.\n");
return 1;
}
for (; kmods; kmods = (kmods->next) ? (kmods + 1): NULL)
printf ("- Name: %s, Version: %s, Load Address: 0x%08x Size: 0x%x\n", kmods->name, kmods->version, kmods->address, kmods- >size);
return 0;
}
IOKit
When writing device drivers on Mac OS X, developers generally utilize an API known as IOKit. An object-oriented framework, IOKit implements a limited version of C++ derived from Embedded C++. The implementation of this is in the libkern/ directory of the XNU source tree. This implementation of C++ has runtime-type information, multiple inheritance, templating, and exception handling removed.
Note
Since other C++ components are implemented, this means from a vulnerability hunter's perspective that C++-specific vulnerabilities are now possible in kernel space. Therefore, when auditing an IOKit kernel extension, you must keep an eye out for mismatched new and delete calls, such as creating a single object and then using delete[] on it, for example. Also, since GCC is used to compile these kernel extensions, new[] will actually wrap when allocating large numbers of objects.
Download
A Guide to Kernel Exploitation: Attacking the Core by Perla Enrico & Oldani Massimiliano.epub
A Guide to Kernel Exploitation: Attacking the Core by Perla Enrico & Oldani Massimiliano.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7787)
Grails in Action by Glen Smith Peter Ledbrook(7700)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6421)
Kotlin in Action by Dmitry Jemerov(5070)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3826)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3336)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(3088)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2872)
The Art Of Deception by Kevin Mitnick(2610)
Drugs Unlimited by Mike Power(2471)
The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution by Walter Isaacson(2329)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2315)
Writing for the Web: Creating Compelling Web Content Using Words, Pictures and Sound (Eva Spring's Library) by Lynda Felder(2263)
A Blueprint for Production-Ready Web Applications: Leverage industry best practices to create complete web apps with Python, TypeScript, and AWS by Dr. Philip Jones(2220)
SEO 2018: Learn search engine optimization with smart internet marketing strategies by Adam Clarke(2194)
JavaScript by Example by S Dani Akash(2138)
DarkMarket by Misha Glenny(2085)
Wireless Hacking 101 by Karina Astudillo(2079)
Full-Stack React Projects by Shama Hoque(1991)
