Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/* gcc -o nostdlib nostdlib.c -m32 -z execstack -nostdlib */
/* Who needs libc or asm() when you can abuse the ABI in horrible ways?*/
typedef int (*sc_fun)(int,int,int,int,int,int,int);
void _start(void) {
char syscall[] = "\x60\x83\xc4\x24\x58\x5b\x59\x5a\x5e\x5f\x5d\xcd\x80\x83\xec\x40\x61\xc3";
((sc_fun)syscall)(4, 0, "Hello, World\n", 13, 0, 0, 0);
((sc_fun)syscall)(1, 0, 0, 0, 0, 0, 0);
}
commit 6297e8bbfa2ef9b870a182c29a26f189297b4b63
Author: Nelson Elhage <nelhage@ksplice.com>
Date: Tue Oct 5 10:57:58 2010 -0400
Don't use a pager when called through M-x grep.
diff --git a/pager.c b/pager.c
index dac358f..32ff2f3 100644
--- a/pager.c
+++ b/pager.c
Hi pdos,
For tomorrow's group meeting, I will be giving a talk on a survey of
linux kernel vulnerabilities.
The talk will present data on 141 Linux kernel vulnerabilities discovered in
the past 15 months, and examine how well state-of-the-art techniques
address these real bugs. The main findings are that no techniques are
fully effective, and that semantic bugs---violations of high-level security
#include <stdio.h>
#include <stdlib.h>
struct hentry {
int foo;
char word[1];
};
int main(void) {
struct hentry h, *h1 = &h, *h2 = (struct hentry*)malloc(sizeof(struct hentry) - 1 + 10);
@nelhage
nelhage / findROP.hs
Created August 18, 2011 16:26
Simple ROP-gadget finder using hdis86
{-
Copyright (c) 2011 Nelson Elhage
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
class smart_object_base {
public:
smart_object_base() : obj_(0) {
};
operator git_object** () {
return &obj_;
}
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <stdint.h>
#include <string.h>
fluid-let
#include <stdlib.h>
#include <stdio.h>
#define NALLOC (1 << 10)
#define ALLOCSZ (1 << 12)
int main(void) {
void *buffers[NALLOC];
int i;
#include <stdlib.h>
#include <stdio.h>
struct doit_kwargs {
int a, b, c;
};
void __doit(struct doit_kwargs kw) {
printf("%d %d %d\n", kw.a, kw.b, kw.c);
}