Skip to content

Instantly share code, notes, and snippets.

View DhavalKapil's full-sized avatar

Dhaval Kapil DhavalKapil

View GitHub Profile

ELF

ELF Header

The first portion of any ELF file is the ELF header. This generally provides offsets to other headers (program headers and section headers) within an ELF.

typedef struct {
  unsigned char e_ident[EI_NIDENT];
 uint16_t e_type;
/* Similar to overlapping_chunks.c (from how2heap) with a small change.
* Instead of overwriting size of unsorted chunk, overwrite size of small chunk.
* Now you have to malloc the original size to retrieve this chunk
* Freeing again will now create an overlapped chunk in the unsorted bin which
* can later be retrieved using malloc(corrupt_size);
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main() {
uintptr_t *p1 = malloc(0);
uintptr_t *p2 = malloc(0);
free(p2);

Keybase proof

I hereby claim:

  • I am dhavalkapil on github.
  • I am dhavalkapil (https://keybase.io/dhavalkapil) on keybase.
  • I have a public key ASC05olYuQRKfgaxTIZVm7Yinc4JjZ7j2e1D_D4WSvXngAo

To claim this, I am signing this object: